… | |
… | |
314 | XRenderFreePicture (dpy, tmp); |
314 | XRenderFreePicture (dpy, tmp); |
315 | |
315 | |
316 | return img; |
316 | return img; |
317 | } |
317 | } |
318 | |
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 | } |
|
|
333 | |
|
|
334 | static void |
319 | static void |
335 | extract (int32_t cl0, int32_t cl1, int32_t &c, unsigned short &xc) |
320 | extract (int32_t cl0, int32_t cl1, int32_t &c, unsigned short &xc) |
336 | { |
321 | { |
337 | int32_t x = clamp (c, cl0, cl1); |
322 | int32_t x = clamp (c, cl0, cl1); |
338 | c -= x; |
323 | c -= x; |
… | |
… | |
595 | { |
580 | { |
596 | rxvt_img *img2 = clone (); |
581 | rxvt_img *img2 = clone (); |
597 | Display *dpy = s->display->dpy; |
582 | Display *dpy = s->display->dpy; |
598 | Picture src = img->src_picture (); |
583 | Picture src = img->src_picture (); |
599 | Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); |
584 | Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); |
600 | Picture mask = create_xrender_mask (dpy, img->pm, False); |
585 | |
|
|
586 | Pixmap pixmap = XCreatePixmap (dpy, img->pm, 1, 1, 8); |
|
|
587 | XRenderPictFormat *format = XRenderFindStandardFormat (dpy, PictStandardA8); |
|
|
588 | XRenderPictureAttributes pa; |
|
|
589 | pa.repeat = True; |
|
|
590 | Picture mask = XRenderCreatePicture (dpy, pixmap, format, CPRepeat, &pa); |
|
|
591 | XFreePixmap (dpy, pixmap); |
601 | |
592 | |
602 | XRenderColor mask_c; |
593 | XRenderColor mask_c; |
603 | |
594 | |
604 | mask_c.alpha = float_to_component (factor); |
595 | mask_c.alpha = float_to_component (factor); |
605 | mask_c.red = |
596 | mask_c.red = |