ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtimg.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtimg.C (file contents):
Revision 1.67 by root, Sat Jun 9 11:13:14 2012 UTC vs.
Revision 1.71 by sf-exg, Sat Jun 9 14:18:53 2012 UTC

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);
374 mask_c.red = -mask_c.red; //TODO: verify that doing clamp, assign, and negation does the right thing
375 mask_c.green = -mask_c.green;
376 mask_c.blue = -mask_c.blue;
377 mask_c.alpha = -mask_c.alpha;
373 XRenderFillRectangle (dpy, PictOpAdd, dst, &mask_c, 0, 0, w, h); 378 XRenderFillRectangle (dpy, PictOpAdd, dst, &mask_c, 0, 0, w, h);
374 XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h); 379 XRenderFillRectangle (dpy, PictOpDifference, dst, &mask_w, 0, 0, w, h);
375 } 380 }
376 } 381 }
377 382
389 } 394 }
390 395
391 unshare (); 396 unshare ();
392 397
393 Display *dpy = s->display->dpy; 398 Display *dpy = s->display->dpy;
394 Picture src = create_xrender_mask (dpy, pm, True);
395 Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); 399 Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0);
396 400
397 XRenderColor mask_c; 401 XRenderColor mask_c;
398 mask_c.red = r; 402 mask_c.red = r;
399 mask_c.green = g; 403 mask_c.green = g;
400 mask_c.blue = b; 404 mask_c.blue = b;
401 mask_c.alpha = a; 405 mask_c.alpha = a;
402 XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); 406 XRenderFillRectangle (dpy, PictOpMultiply, dst, &mask_c, 0, 0, w, h);
403 407
404 XRenderComposite (dpy, PictOpMultiply, src, None, dst, 0, 0, 0, 0, 0, 0, w, h);
405
406 XRenderFreePicture (dpy, src);
407 XRenderFreePicture (dpy, dst); 408 XRenderFreePicture (dpy, dst);
408} 409}
409 410
410rxvt_img * 411rxvt_img *
411rxvt_img::clone () 412rxvt_img::clone ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines