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.70 by root, Sat Jun 9 11:41:28 2012 UTC vs.
Revision 1.73 by sf-exg, Sat Jun 9 17:28:03 2012 UTC

49 img->ref->ours = false; 49 img->ref->ours = false;
50 50
51 return img; 51 return img;
52} 52}
53 53
54# if HAVE_PIXBUF
54rxvt_img * 55rxvt_img *
55rxvt_img::new_from_pixbuf (rxvt_screen *s, GdkPixbuf *pb) 56rxvt_img::new_from_pixbuf (rxvt_screen *s, GdkPixbuf *pb)
56{ 57{
57 Display *dpy = s->display->dpy; 58 Display *dpy = s->display->dpy;
58 59
166 167
167 g_object_unref (pb); 168 g_object_unref (pb);
168 169
169 return img; 170 return img;
170} 171}
172# endif
171 173
172void 174void
173rxvt_img::destroy () 175rxvt_img::destroy ()
174{ 176{
175 if (--ref->cnt) 177 if (--ref->cnt)
312 XRenderFreePicture (dpy, src); 314 XRenderFreePicture (dpy, src);
313 XRenderFreePicture (dpy, dst); 315 XRenderFreePicture (dpy, dst);
314 XRenderFreePicture (dpy, tmp); 316 XRenderFreePicture (dpy, tmp);
315 317
316 return img; 318 return img;
317}
318
319static Picture
320create_xrender_mask (Display *dpy, Drawable drawable, Bool argb)
321{
322 Pixmap pixmap = XCreatePixmap (dpy, drawable, 1, 1, argb ? 32 : 8);
323
324 XRenderPictFormat *format = XRenderFindStandardFormat (dpy, argb ? PictStandardARGB32 : PictStandardA8);
325 XRenderPictureAttributes pa;
326 pa.repeat = True;
327 Picture mask = XRenderCreatePicture (dpy, pixmap, format, CPRepeat, &pa);
328
329 XFreePixmap (dpy, pixmap);
330
331 return mask;
332} 319}
333 320
334static void 321static void
335extract (int32_t cl0, int32_t cl1, int32_t &c, unsigned short &xc) 322extract (int32_t cl0, int32_t cl1, int32_t &c, unsigned short &xc)
336{ 323{
394 } 381 }
395 382
396 unshare (); 383 unshare ();
397 384
398 Display *dpy = s->display->dpy; 385 Display *dpy = s->display->dpy;
399 Picture src = create_xrender_mask (dpy, pm, True);
400 Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); 386 Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0);
401 387
402 XRenderColor mask_c; 388 XRenderColor mask_c;
403 mask_c.red = r; 389 mask_c.red = r;
404 mask_c.green = g; 390 mask_c.green = g;
405 mask_c.blue = b; 391 mask_c.blue = b;
406 mask_c.alpha = a; 392 mask_c.alpha = a;
407 XRenderFillRectangle (dpy, PictOpSrc, src, &mask_c, 0, 0, 1, 1); 393 XRenderFillRectangle (dpy, PictOpMultiply, dst, &mask_c, 0, 0, w, h);
408 394
409 XRenderComposite (dpy, PictOpMultiply, src, None, dst, 0, 0, 0, 0, 0, 0, w, h);
410
411 XRenderFreePicture (dpy, src);
412 XRenderFreePicture (dpy, dst); 395 XRenderFreePicture (dpy, dst);
413} 396}
414 397
415rxvt_img * 398rxvt_img *
416rxvt_img::clone () 399rxvt_img::clone ()
599{ 582{
600 rxvt_img *img2 = clone (); 583 rxvt_img *img2 = clone ();
601 Display *dpy = s->display->dpy; 584 Display *dpy = s->display->dpy;
602 Picture src = img->src_picture (); 585 Picture src = img->src_picture ();
603 Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); 586 Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0);
604 Picture mask = create_xrender_mask (dpy, img->pm, False); 587
588 Pixmap pixmap = XCreatePixmap (dpy, img->pm, 1, 1, 8);
589 XRenderPictFormat *format = XRenderFindStandardFormat (dpy, PictStandardA8);
590 XRenderPictureAttributes pa;
591 pa.repeat = True;
592 Picture mask = XRenderCreatePicture (dpy, pixmap, format, CPRepeat, &pa);
593 XFreePixmap (dpy, pixmap);
605 594
606 XRenderColor mask_c; 595 XRenderColor mask_c;
607 596
608 mask_c.alpha = float_to_component (factor); 597 mask_c.alpha = float_to_component (factor);
609 mask_c.red = 598 mask_c.red =

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines