X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Fmask.c;h=d1659ffbb74cba66dec1f8419e9cd4ae5067f960;hb=3a607fad9df628ab16e0f7436dfbfc9b22634003;hp=8b0f21c04eb83a02629358b77588262f437f99c3;hpb=3f32dfa87e08556d7f6a58efab9b7479e515be26;p=chaz%2Fopenbox diff --git a/render/mask.c b/render/mask.c index 8b0f21c0..d1659ffb 100644 --- a/render/mask.c +++ b/render/mask.c @@ -10,7 +10,7 @@ RrPixmapMask *RrPixmapMaskNew(const RrInstance *inst, m->width = w; m->height = h; /* round up to nearest byte */ - m->data = g_memdup(data, (w * h + 7) / 8); + m->data = g_memdup(data, (w + 7) / 8 * h); m->mask = XCreateBitmapFromData(RrDisplay(inst), RrRootWindow(inst), data, w, h); return m; @@ -25,7 +25,7 @@ void RrPixmapMaskFree(RrPixmapMask *m) } } -void RrPixmapMaskDraw(Pixmap p, const RrTextureMask *m, const Rect *area) +void RrPixmapMaskDraw(Pixmap p, const RrTextureMask *m, const RrRect *area) { int x, y; if (m->mask == None) return; /* no mask given */ @@ -37,16 +37,16 @@ void RrPixmapMaskDraw(Pixmap p, const RrTextureMask *m, const Rect *area) 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); + XSetClipMask(RrDisplay(m->mask->inst), RrColorGC(m->color), m->mask->mask); + XSetClipOrigin(RrDisplay(m->mask->inst), RrColorGC(m->color), x, y); /* fill in the clipped region */ - XFillRectangle(RrDisplay(m->mask->inst), p, m->color->gc, x, y, + 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), m->color->gc, None); - XSetClipOrigin(RrDisplay(m->mask->inst), m->color->gc, 0, 0); + XSetClipMask(RrDisplay(m->mask->inst), RrColorGC(m->color), None); + XSetClipOrigin(RrDisplay(m->mask->inst), RrColorGC(m->color), 0, 0); } RrPixmapMask *RrPixmapMaskCopy(const RrPixmapMask *src) @@ -56,7 +56,7 @@ RrPixmapMask *RrPixmapMaskCopy(const RrPixmapMask *src) m->width = src->width; m->height = src->height; /* round up to nearest byte */ - m->data = g_memdup(src->data, (src->width * src->height + 7) / 8); + 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;