--- rxvt-unicode/src/rxvtimg.C 2012/06/09 11:14:35 1.68 +++ rxvt-unicode/src/rxvtimg.C 2012/06/09 17:28:03 1.73 @@ -51,6 +51,7 @@ return img; } +# if HAVE_PIXBUF rxvt_img * rxvt_img::new_from_pixbuf (rxvt_screen *s, GdkPixbuf *pb) { @@ -168,6 +169,7 @@ return img; } +# endif void rxvt_img::destroy () @@ -316,21 +318,6 @@ return img; } -static Picture -create_xrender_mask (Display *dpy, Drawable drawable, Bool argb) -{ - Pixmap pixmap = XCreatePixmap (dpy, drawable, 1, 1, argb ? 32 : 8); - - XRenderPictFormat *format = XRenderFindStandardFormat (dpy, argb ? PictStandardARGB32 : PictStandardA8); - XRenderPictureAttributes pa; - pa.repeat = True; - Picture mask = XRenderCreatePicture (dpy, pixmap, format, CPRepeat, &pa); - - XFreePixmap (dpy, pixmap); - - return mask; -} - static void extract (int32_t cl0, int32_t cl1, int32_t &c, unsigned short &xc) { @@ -358,7 +345,8 @@ Display *dpy = s->display->dpy; Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); - while (r | g | b | a) + // loop should not be needed for brightness, as only -1..1 makes sense + //while (r | g | b | a) { unsigned short xr, xg, xb, xa; XRenderColor mask_c; @@ -370,7 +358,7 @@ { XRenderColor mask_w = { 65535, 65535, 65535, 65535 }; XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); - mask_c.red = -mask_c.red; + mask_c.red = -mask_c.red; //TODO: verify that doing clamp, assign, and negation does the right thing mask_c.green = -mask_c.green; mask_c.blue = -mask_c.blue; mask_c.alpha = -mask_c.alpha; @@ -395,7 +383,6 @@ unshare (); Display *dpy = s->display->dpy; - Picture src = create_xrender_mask (dpy, pm, True); Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); XRenderColor mask_c; @@ -403,11 +390,8 @@ mask_c.green = g; mask_c.blue = b; mask_c.alpha = a; - XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); - - XRenderComposite (dpy, PictOpMultiply, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); + XRenderFillRectangle (dpy, PictOpMultiply, dst, &mask_c, 0, 0, w, h); - XRenderFreePicture (dpy, src); XRenderFreePicture (dpy, dst); } @@ -600,7 +584,13 @@ Display *dpy = s->display->dpy; Picture src = img->src_picture (); Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); - Picture mask = create_xrender_mask (dpy, img->pm, False); + + Pixmap pixmap = XCreatePixmap (dpy, img->pm, 1, 1, 8); + XRenderPictFormat *format = XRenderFindStandardFormat (dpy, PictStandardA8); + XRenderPictureAttributes pa; + pa.repeat = True; + Picture mask = XRenderCreatePicture (dpy, pixmap, format, CPRepeat, &pa); + XFreePixmap (dpy, pixmap); XRenderColor mask_c;