- // unset the clip region
- XSetClipMask(ob_display, m->color->gc, None);
- XSetClipOrigin(ob_display, m->color->gc, 0, 0);
+ /* fill in the clipped region */
+ XFillRectangle(RrDisplay(m->mask->inst), p, RrColorGC(m->color), x, y,
+ x + m->mask->width, y + m->mask->height);
+
+ /* unset the clip region */
+ XSetClipMask(RrDisplay(m->mask->inst), RrColorGC(m->color), None);
+ XSetClipOrigin(RrDisplay(m->mask->inst), RrColorGC(m->color), 0, 0);
+}
+
+RrPixmapMask *RrPixmapMaskCopy(const RrPixmapMask *src)
+{
+ RrPixmapMask *m = g_new(RrPixmapMask, 1);
+ m->inst = src->inst;
+ m->width = src->width;
+ m->height = src->height;
+ /* round up to nearest byte */
+ m->data = g_memdup(src->data, (src->width + 7) / 8 * src->height);
+ m->mask = XCreateBitmapFromData(RrDisplay(m->inst), RrRootWindow(m->inst),
+ m->data, m->width, m->height);
+ return m;