1 | /*----------------------------------------------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: rxvtimg.h |
2 | * File: rxvtimg.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 2012 Marc Lehmann <schmorp@schmorp.de> |
6 | * Copyright (c) 2012 Marc Lehmann <schmorp@schmorp.de> |
7 | * Copyright (c) 2012 Emanuele Giaquinta <e.giaquinta@glauco.it> |
7 | * Copyright (c) 2012 Emanuele Giaquinta <e.giaquinta@glauco.it> |
… | |
… | |
316 | uint8_t r = *src++; |
316 | uint8_t r = *src++; |
317 | uint8_t g = *src++; |
317 | uint8_t g = *src++; |
318 | uint8_t b = *src++; |
318 | uint8_t b = *src++; |
319 | |
319 | |
320 | uint32_t v = (255 << 24) | (r << 16) | (g << 8) | b; |
320 | uint32_t v = (255 << 24) | (r << 16) | (g << 8) | b; |
321 | |
321 | |
322 | if (ecb_big_endian () ? !byte_order_mismatch : byte_order_mismatch) |
322 | if (ecb_big_endian () ? !byte_order_mismatch : byte_order_mismatch) |
323 | v = ecb_bswap32 (v); |
323 | v = ecb_bswap32 (v); |
324 | |
324 | |
325 | *dst++ = v; |
325 | *dst++ = v; |
326 | } |
326 | } |
… | |
… | |
449 | rxvt_img *img = new rxvt_img (s, find_alpha_format_for (dpy, format), x, y, w, h, repeat); |
449 | rxvt_img *img = new rxvt_img (s, find_alpha_format_for (dpy, format), x, y, w, h, repeat); |
450 | img->alloc (); |
450 | img->alloc (); |
451 | |
451 | |
452 | Picture src = picture (); |
452 | Picture src = picture (); |
453 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
453 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
454 | |
454 | |
455 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
455 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
456 | |
456 | |
457 | XRenderFreePicture (dpy, src); |
457 | XRenderFreePicture (dpy, src); |
458 | XRenderFreePicture (dpy, dst); |
458 | XRenderFreePicture (dpy, dst); |
459 | |
459 | |
… | |
… | |
667 | |
667 | |
668 | Display *dpy = s->display->dpy; |
668 | Display *dpy = s->display->dpy; |
669 | Picture src = img->picture (); |
669 | Picture src = img->picture (); |
670 | Picture dst = picture (); |
670 | Picture dst = picture (); |
671 | Picture mask_p = 0; |
671 | Picture mask_p = 0; |
672 | |
672 | |
673 | if (mask != 1.) |
673 | if (mask != 1.) |
674 | { |
674 | { |
675 | mask_p = create_xrender_mask (dpy, img->pm, False, False); |
675 | mask_p = create_xrender_mask (dpy, img->pm, False, False); |
676 | XRenderColor mask_c = { 0, 0, 0, float_to_component (mask) }; |
676 | XRenderColor mask_c = { 0, 0, 0, float_to_component (mask) }; |
677 | XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1); |
677 | XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1); |
… | |
… | |
708 | rxvt_img *img = new rxvt_img (s, alpha ? find_alpha_format_for (dpy, format) : format, 0, 0, w, h, repeat); |
708 | rxvt_img *img = new rxvt_img (s, alpha ? find_alpha_format_for (dpy, format) : format, 0, 0, w, h, repeat); |
709 | img->alloc (); |
709 | img->alloc (); |
710 | |
710 | |
711 | Picture src = picture (); |
711 | Picture src = picture (); |
712 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
712 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
713 | |
713 | |
714 | if (alpha) |
714 | if (alpha) |
715 | { |
715 | { |
716 | XRenderColor rc = { 0, 0, 0, 0 }; |
716 | XRenderColor rc = { 0, 0, 0, 0 }; |
717 | XRenderFillRectangle (dpy, PictOpSrc, dst, &rc, 0, 0, w, h);//TODO: split into four fillrectangles |
717 | XRenderFillRectangle (dpy, PictOpSrc, dst, &rc, 0, 0, w, h);//TODO: split into four fillrectangles |
718 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, x, y, ref->w, ref->h); |
718 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, x, y, ref->w, ref->h); |