--- rxvt-unicode/src/rxvtimg.C 2012/06/07 08:36:53 1.35 +++ rxvt-unicode/src/rxvtimg.C 2012/06/07 11:34:09 1.41 @@ -4,8 +4,8 @@ #if HAVE_IMG -rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int x, int y, int width, int height) -: s(screen), x(x), y(y), w(width), h(height), format(format), repeat(RepeatNormal), +rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int x, int y, int width, int height, int repeat) +: s(screen), x(x), y(y), w(width), h(height), format(format), repeat(repeat), pm(0), ref(0) { } @@ -116,9 +116,6 @@ pa.repeat = repeat; Picture pic = XRenderCreatePicture (dpy, pm, format, CPRepeat, &pa); - XRectangle clip = { -x, -y, min (w, ref->w), min (h, ref->h) }; - XRenderSetPictureClipRectangles (dpy, pic, 0, 0, &clip, 1); - return pic; } @@ -181,7 +178,7 @@ int size = max (rh, rv) * 2 + 1; double *kernel = (double *)malloc (size * sizeof (double)); XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); - rxvt_img *img = new rxvt_img (s, format, x, y, w, h); + rxvt_img *img = new rxvt_img (s, format, x, y, w, h, repeat); img->alloc (); Picture src = src_picture (); @@ -402,11 +399,15 @@ if (x == 0 && y == 0 && w == ref->w && h == ref->h) return clone (); - rxvt_img *img = new rxvt_img (s, format, 0, 0, w, h); - img->alloc (); - Display *dpy = s->display->dpy; + bool alpha = !format->direct.alphaMask + && (x || y) + && repeat == RepeatNone; + + rxvt_img *img = new rxvt_img (s, alpha ? XRenderFindStandardFormat (dpy, PictStandardARGB32) : format, 0, 0, w, h, repeat); + img->alloc (); + Picture src = src_picture (); Picture dst = XRenderCreatePicture (dpy, img->pm, img->format, 0, 0); @@ -423,12 +424,18 @@ { rxvt_img *img = clone (); - //TODO: width > w, must reify - img->x += x; img->y += y; - img->w = width; - img->h = height; + + if (w != width || h != height) + { + img->w = width; + img->h = height; + + rxvt_img *img2 = img->reify (); + delete img; + img = img2; + } return img; } @@ -436,7 +443,7 @@ rxvt_img * rxvt_img::transform (int new_width, int new_height, double matrix[9]) { - rxvt_img *img = new rxvt_img (s, format, 0, 0, new_width, new_height); + rxvt_img *img = new rxvt_img (s, format, 0, 0, new_width, new_height, repeat); img->alloc (); Display *dpy = s->display->dpy; @@ -495,7 +502,7 @@ if (new_format == format) return clone (); - rxvt_img *img = new rxvt_img (s, new_format, 0, 0, w, h); + rxvt_img *img = new rxvt_img (s, new_format, 0, 0, w, h, repeat); img->alloc (); Display *dpy = s->display->dpy; @@ -528,7 +535,7 @@ { rxvt_img *img2 = clone (); Display *dpy = s->display->dpy; - Picture src = src_picture (); + Picture src = img->src_picture (); Picture dst = XRenderCreatePicture (dpy, img2->pm, img2->format, 0, 0); Picture mask = create_xrender_mask (dpy, img->pm, False);