--- rxvt-unicode/src/rxvtimg.C 2012/06/14 18:59:39 1.85 +++ rxvt-unicode/src/rxvtimg.C 2012/06/14 19:44:31 1.89 @@ -532,7 +532,7 @@ XRenderFreePicture (dpy, src); XRenderFreePicture (dpy, dst); - if (mask) + if (mask_p) XRenderFreePicture (dpy, mask_p); } @@ -565,10 +565,10 @@ { XRenderColor rc = { 0, 0, 0, 0 }; XRenderFillRectangle (dpy, PictOpSrc, dst, &rc, 0, 0, w, h);//TODO: split into four fillrectangles - XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, -x, -y, ref->w, ref->h); + XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, x, y, ref->w, ref->h); } else - XRenderComposite (dpy, PictOpSrc, src, None, dst, x, y, 0, 0, 0, 0, w, h); + XRenderComposite (dpy, PictOpSrc, src, None, dst, -x, -y, 0, 0, 0, 0, w, h); XRenderFreePicture (dpy, src); XRenderFreePicture (dpy, dst); @@ -581,8 +581,8 @@ { rxvt_img *img = clone (); - img->x += x; - img->y += y; + img->x -= x; + img->y -= y; if (w != width || h != height) { @@ -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 },