… | |
… | |
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 |
54 | rxvt_img * |
55 | rxvt_img * |
55 | rxvt_img::new_from_pixbuf (rxvt_screen *s, GdkPixbuf *pb) |
56 | rxvt_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 | |
172 | void |
174 | void |
173 | rxvt_img::destroy () |
175 | rxvt_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 | |
|
|
319 | static Picture |
|
|
320 | create_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 | |
334 | static void |
321 | static void |
335 | extract (int32_t cl0, int32_t cl1, int32_t &c, unsigned short &xc) |
322 | extract (int32_t cl0, int32_t cl1, int32_t &c, unsigned short &xc) |
336 | { |
323 | { |
… | |
… | |
595 | { |
582 | { |
596 | rxvt_img *img2 = clone (); |
583 | rxvt_img *img2 = clone (); |
597 | Display *dpy = s->display->dpy; |
584 | Display *dpy = s->display->dpy; |
598 | Picture src = img->src_picture (); |
585 | Picture src = img->src_picture (); |
599 | Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); |
586 | Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); |
600 | 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); |
601 | |
594 | |
602 | XRenderColor mask_c; |
595 | XRenderColor mask_c; |
603 | |
596 | |
604 | mask_c.alpha = float_to_component (factor); |
597 | mask_c.alpha = float_to_component (factor); |
605 | mask_c.red = |
598 | mask_c.red = |