… | |
… | |
356 | unshare (); |
356 | unshare (); |
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 | while (r | g | b | a) |
362 | //while (r | g | b | a) |
362 | { |
363 | { |
363 | unsigned short xr, xg, xb, xa; |
364 | unsigned short xr, xg, xb, xa; |
364 | XRenderColor mask_c; |
365 | XRenderColor mask_c; |
365 | |
366 | |
366 | 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)) |
… | |
… | |
368 | |
369 | |
369 | 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)) |
370 | { |
371 | { |
371 | XRenderColor mask_w = { 65535, 65535, 65535, 65535 }; |
372 | XRenderColor mask_w = { 65535, 65535, 65535, 65535 }; |
372 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
373 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
373 | 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 |
374 | mask_c.green = -mask_c.green; |
375 | mask_c.green = -mask_c.green; |
375 | mask_c.blue = -mask_c.blue; |
376 | mask_c.blue = -mask_c.blue; |
376 | mask_c.alpha = -mask_c.alpha; |
377 | mask_c.alpha = -mask_c.alpha; |
377 | XRenderFillRectangle (dpy, PictOpAdd, dst, &mask_c, 0, 0, w, h); |
378 | XRenderFillRectangle (dpy, PictOpAdd, dst, &mask_c, 0, 0, w, h); |
378 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |
379 | XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); |