… | |
… | |
530 | XRenderComposite (dpy, op, src, mask_p, dst, x - img->x, y - img->y, 0, 0, 0, 0, w, h); |
530 | XRenderComposite (dpy, op, src, mask_p, dst, x - img->x, y - img->y, 0, 0, 0, 0, w, h); |
531 | |
531 | |
532 | XRenderFreePicture (dpy, src); |
532 | XRenderFreePicture (dpy, src); |
533 | XRenderFreePicture (dpy, dst); |
533 | XRenderFreePicture (dpy, dst); |
534 | |
534 | |
535 | if (mask) |
535 | if (mask_p) |
536 | XRenderFreePicture (dpy, mask_p); |
536 | XRenderFreePicture (dpy, mask_p); |
537 | } |
537 | } |
538 | |
538 | |
539 | rxvt_img * |
539 | rxvt_img * |
540 | rxvt_img::clone () |
540 | rxvt_img::clone () |
… | |
… | |
563 | |
563 | |
564 | if (alpha) |
564 | if (alpha) |
565 | { |
565 | { |
566 | XRenderColor rc = { 0, 0, 0, 0 }; |
566 | XRenderColor rc = { 0, 0, 0, 0 }; |
567 | XRenderFillRectangle (dpy, PictOpSrc, dst, &rc, 0, 0, w, h);//TODO: split into four fillrectangles |
567 | XRenderFillRectangle (dpy, PictOpSrc, dst, &rc, 0, 0, w, h);//TODO: split into four fillrectangles |
568 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, -x, -y, ref->w, ref->h); |
568 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, x, y, ref->w, ref->h); |
569 | } |
569 | } |
570 | else |
570 | else |
571 | XRenderComposite (dpy, PictOpSrc, src, None, dst, x, y, 0, 0, 0, 0, w, h); |
571 | XRenderComposite (dpy, PictOpSrc, src, None, dst, -x, -y, 0, 0, 0, 0, w, h); |
572 | |
572 | |
573 | XRenderFreePicture (dpy, src); |
573 | XRenderFreePicture (dpy, src); |
574 | XRenderFreePicture (dpy, dst); |
574 | XRenderFreePicture (dpy, dst); |
575 | |
575 | |
576 | return img; |
576 | return img; |
… | |
… | |
579 | rxvt_img * |
579 | rxvt_img * |
580 | rxvt_img::sub_rect (int x, int y, int width, int height) |
580 | rxvt_img::sub_rect (int x, int y, int width, int height) |
581 | { |
581 | { |
582 | rxvt_img *img = clone (); |
582 | rxvt_img *img = clone (); |
583 | |
583 | |
584 | img->x += x; |
584 | img->x -= x; |
585 | img->y += y; |
585 | img->y -= y; |
586 | |
586 | |
587 | if (w != width || h != height) |
587 | if (w != width || h != height) |
588 | { |
588 | { |
589 | img->w = width; |
589 | img->w = width; |
590 | img->h = height; |
590 | img->h = height; |
… | |
… | |
654 | int new_height = ceil (rmax [1] - dy); |
654 | int new_height = ceil (rmax [1] - dy); |
655 | |
655 | |
656 | nv inv[3][3]; |
656 | nv inv[3][3]; |
657 | mat_invert (matrix, inv); |
657 | mat_invert (matrix, inv); |
658 | |
658 | |
659 | rxvt_img *img = new rxvt_img (s, format, ox - dx - d [0], oy - dy - d [1], new_width, new_height, repeat); |
659 | rxvt_img *img = new rxvt_img (s, format, dx + d [0] - ox, dy + d [1] - oy, new_width, new_height, repeat); |
660 | img->alloc (); |
660 | img->alloc (); |
661 | |
661 | |
662 | Display *dpy = s->display->dpy; |
662 | Display *dpy = s->display->dpy; |
663 | Picture src = picture (); |
663 | Picture src = picture (); |
664 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |
664 | Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); |