--- rxvt-unicode/src/rxvtimg.C 2012/06/09 11:13:14 1.67 +++ rxvt-unicode/src/rxvtimg.C 2012/06/09 14:18:53 1.71 @@ -358,7 +358,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,6 +371,10 @@ { XRenderColor mask_w = { 65535, 65535, 65535, 65535 }; XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); + 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; XRenderFillRectangle (dpy, PictOpAdd, dst, &mask_c, 0, 0, w, h); XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); } @@ -391,7 +396,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; @@ -399,11 +403,8 @@ mask_c.green = g; mask_c.blue = b; mask_c.alpha = a; - XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); + XRenderFillRectangle (dpy, PictOpMultiply, dst, &mask_c, 0, 0, w, h); - XRenderComposite (dpy, PictOpMultiply, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); - - XRenderFreePicture (dpy, src); XRenderFreePicture (dpy, dst); }