--- rxvt-unicode/src/rxvtimg.C 2012/06/14 19:31:17 1.86 +++ rxvt-unicode/src/rxvtimg.C 2012/06/14 19:44:31 1.89 @@ -631,22 +631,19 @@ rxvt_img * rxvt_img::transform (nv matrix[3][3]) { - // find new offset - int ox = mat_apply (matrix, 0, -x, -y); - int oy = mat_apply (matrix, 1, -x, -y); - // calculate new pixel bounding box coordinates - nv d [2], rmin[2], rmax[2]; + nv rmin[2], rmax[2]; for (int i = 0; i < 2; ++i) { nv v; - v = mat_apply (matrix, i, 0, 0); rmin [i] = rmax [i] = v; d [i] = v; - v = mat_apply (matrix, i, w, 0); min_it (rmin [i], v); max_it (rmax [i], v); - v = mat_apply (matrix, i, 0, h); min_it (rmin [i], v); max_it (rmax [i], v); - v = mat_apply (matrix, i, w, h); min_it (rmin [i], v); max_it (rmax [i], v); + v = mat_apply (matrix, i, 0+x, 0+y); rmin [i] = rmax [i] = v; + v = mat_apply (matrix, i, w+x, 0+y); min_it (rmin [i], v); max_it (rmax [i], v); + v = mat_apply (matrix, i, 0+x, h+y); min_it (rmin [i], v); max_it (rmax [i], v); + v = mat_apply (matrix, i, w+x, h+y); min_it (rmin [i], v); max_it (rmax [i], v); } + // TODO: adjust matrix for subpixel accuracy int dx = floor (rmin [0]); int dy = floor (rmin [1]); @@ -656,7 +653,7 @@ nv inv[3][3]; mat_invert (matrix, inv); - rxvt_img *img = new rxvt_img (s, format, ox - dx - d [0], oy - dy - d [1], new_width, new_height, repeat); + rxvt_img *img = new rxvt_img (s, format, dx, dy, new_width, new_height, repeat); img->alloc (); Display *dpy = s->display->dpy; @@ -709,7 +706,7 @@ nv c = cos (phi); nv matrix[3][3] = { - { c, -s, cx - c * cx + s * cy }, + { c, -s, cx - c * cx + s * cy + 200 }, { s, c, cy - s * cx - c * cy }, { 0, 0, 1 } //{ c, -s, 0 },