… | |
… | |
630 | |
630 | |
631 | rxvt_img * |
631 | rxvt_img * |
632 | rxvt_img::transform (nv matrix[3][3]) |
632 | rxvt_img::transform (nv matrix[3][3]) |
633 | { |
633 | { |
634 | // find new offset |
634 | // find new offset |
635 | int ox = mat_apply (matrix, 0, -x, -y); |
635 | int ox = mat_apply (matrix, 0, x, y); |
636 | int oy = mat_apply (matrix, 1, -x, -y); |
636 | int oy = mat_apply (matrix, 1, x, y); |
637 | |
637 | |
638 | // calculate new pixel bounding box coordinates |
638 | // calculate new pixel bounding box coordinates |
639 | nv d [2], rmin[2], rmax[2]; |
639 | nv d [2], rmin[2], rmax[2]; |
640 | |
640 | |
641 | for (int i = 0; i < 2; ++i) |
641 | for (int i = 0; i < 2; ++i) |
… | |
… | |
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); |