… | |
… | |
357 | |
357 | |
358 | Display *dpy = s->display->dpy; |
358 | Display *dpy = s->display->dpy; |
359 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
359 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
360 | |
360 | |
361 | // loop should not be needed for brightness, as only -1..1 makes sense |
361 | // loop should not be needed for brightness, as only -1..1 makes sense |
362 | |
|
|
363 | while (r | g | b | a) |
362 | //while (r | g | b | a) |
364 | { |
363 | { |
365 | unsigned short xr, xg, xb, xa; |
364 | unsigned short xr, xg, xb, xa; |
366 | XRenderColor mask_c; |
365 | XRenderColor mask_c; |
367 | |
366 | |
368 | if (extract (0, 65535, r, g, b, a, mask_c.red, mask_c.green, mask_c.blue, mask_c.alpha)) |
367 | if (extract (0, 65535, r, g, b, a, mask_c.red, mask_c.green, mask_c.blue, mask_c.alpha)) |
… | |
… | |
370 | |
369 | |
371 | if (extract (-65535, 0, r, g, b, a, mask_c.red, mask_c.green, mask_c.blue, mask_c.alpha)) |
370 | if (extract (-65535, 0, r, g, b, a, mask_c.red, mask_c.green, mask_c.blue, mask_c.alpha)) |
372 | { |
371 | { |
373 | XRenderColor mask_w = { 65535, 65535, 65535, 65535 }; |
372 | XRenderColor mask_w = { 65535, 65535, 65535, 65535 }; |
374 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
373 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
375 | mask_c.red = -mask_c.red; |
374 | mask_c.red = -mask_c.red; //TODO: verify that doing clamp, assign, and negation does the right thing |
376 | mask_c.green = -mask_c.green; |
375 | mask_c.green = -mask_c.green; |
377 | mask_c.blue = -mask_c.blue; |
376 | mask_c.blue = -mask_c.blue; |
378 | mask_c.alpha = -mask_c.alpha; |
377 | mask_c.alpha = -mask_c.alpha; |
379 | XRenderFillRectangle (dpy, PictOpAdd, dst, &mask_c, 0, 0, w, h); |
378 | XRenderFillRectangle (dpy, PictOpAdd, dst, &mask_c, 0, 0, w, h); |
380 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
379 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |