+void RrPixmapMaskDraw(Pixmap p, const RrTextureMask *m, const Rect *area)
+{
+ int x, y;
+ if (m->mask == None) return; /* no mask given */
+
+ /* set the clip region */
+ x = area->x + (area->width - m->mask->width) / 2;
+ y = area->y + (area->height - m->mask->height) / 2;
+
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
+
+ XSetClipMask(RrDisplay(m->mask->inst), m->color->gc, m->mask->mask);
+ XSetClipOrigin(RrDisplay(m->mask->inst), m->color->gc, x, y);
+
+ /* fill in the clipped region */
+ XFillRectangle(RrDisplay(m->mask->inst), p, m->color->gc, x, y,
+ x + m->mask->width, y + m->mask->height);