ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtimg.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtimg.C (file contents):
Revision 1.87 by root, Thu Jun 14 19:36:35 2012 UTC vs.
Revision 1.88 by root, Thu Jun 14 19:42:01 2012 UTC

629} 629}
630 630
631rxvt_img * 631rxvt_img *
632rxvt_img::transform (nv matrix[3][3]) 632rxvt_img::transform (nv matrix[3][3])
633{ 633{
634 // find new offset
635 int ox = mat_apply (matrix, 0, x, y);
636 int oy = mat_apply (matrix, 1, x, y);
637
638 // calculate new pixel bounding box coordinates 634 // calculate new pixel bounding box coordinates
639 nv d [2], rmin[2], rmax[2]; 635 nv rmin[2], rmax[2];
640 636
641 for (int i = 0; i < 2; ++i) 637 for (int i = 0; i < 2; ++i)
642 { 638 {
643 nv v; 639 nv v;
644 v = mat_apply (matrix, i, 0, 0); rmin [i] = rmax [i] = v; d [i] = v; 640 v = mat_apply (matrix, i, 0+x, 0+y); rmin [i] = rmax [i] = v;
645 v = mat_apply (matrix, i, w, 0); min_it (rmin [i], v); max_it (rmax [i], v); 641 v = mat_apply (matrix, i, w+x, 0+y); min_it (rmin [i], v); max_it (rmax [i], v);
646 v = mat_apply (matrix, i, 0, h); min_it (rmin [i], v); max_it (rmax [i], v); 642 v = mat_apply (matrix, i, 0+x, h+y); min_it (rmin [i], v); max_it (rmax [i], v);
647 v = mat_apply (matrix, i, w, h); min_it (rmin [i], v); max_it (rmax [i], v); 643 v = mat_apply (matrix, i, w+x, h+y); min_it (rmin [i], v); max_it (rmax [i], v);
648 } 644 }
649 645
650 int dx = floor (rmin [0]); 646 int dx = floor (rmin [0]);
651 int dy = floor (rmin [1]); 647 int dy = floor (rmin [1]);
652 648
654 int new_height = ceil (rmax [1] - dy); 650 int new_height = ceil (rmax [1] - dy);
655 651
656 nv inv[3][3]; 652 nv inv[3][3];
657 mat_invert (matrix, inv); 653 mat_invert (matrix, inv);
658 654
659 rxvt_img *img = new rxvt_img (s, format, dx + d [0] - ox, dy + d [1] - oy, new_width, new_height, repeat); 655 rxvt_img *img = new rxvt_img (s, format, dx, dy, new_width, new_height, repeat);
660 img->alloc (); 656 img->alloc ();
661 657
662 Display *dpy = s->display->dpy; 658 Display *dpy = s->display->dpy;
663 Picture src = picture (); 659 Picture src = picture ();
664 Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); 660 Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0);
707{ 703{
708 nv s = sin (phi); 704 nv s = sin (phi);
709 nv c = cos (phi); 705 nv c = cos (phi);
710 706
711 nv matrix[3][3] = { 707 nv matrix[3][3] = {
712 { c, -s, cx - c * cx + s * cy }, 708 { c, -s, cx - c * cx + s * cy + 200 },
713 { s, c, cy - s * cx - c * cy }, 709 { s, c, cy - s * cx - c * cy },
714 { 0, 0, 1 } 710 { 0, 0, 1 }
715 //{ c, -s, 0 }, 711 //{ c, -s, 0 },
716 //{ s, c, 0 }, 712 //{ s, c, 0 },
717 //{ 0, 0, 1 } 713 //{ 0, 0, 1 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines