--- rxvt-unicode/src/rxvtfont.C 2007/08/20 20:13:35 1.112 +++ rxvt-unicode/src/rxvtfont.C 2007/10/28 11:25:04 1.121 @@ -239,7 +239,22 @@ else if (color >= 0) { #if XFT - XftDrawRect (d, &term->pix_colors[color].c, x, y, w, h); + bool done = false; +#ifdef HAVE_BG_PIXMAP + if (term->bgPixmap.pixmap && color >= 0 && term->pix_colors[color].c.color.alpha < 0x0ff00) + { + Picture dst = XftDrawPicture (d); + if (dst != 0) + { + XClearArea (disp, d, x, y, w, h, false); + Picture solid_color_pict = XftDrawSrcPicture (d, &term->pix_colors[color].c); + XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, x, y, w, h); + done = true; + } + } +#endif + if (!done) + XftDrawRect (d, &term->pix_colors[color].c, x, y, w, h); #else XSetForeground (disp, gc, term->pix_colors[color]); XFillRectangle (disp, d, gc, x, y, w, h); @@ -499,7 +514,7 @@ if (XGetFontProperty (f, property, &value)) return XGetAtomName (term->dpy, value); else - return rxvt_strdup (repl); + return repl ? strdup (repl) : 0; } rxvt_fontprop @@ -1045,7 +1060,7 @@ const text_t *text, int len, int fg, int bg); - bool has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &carefull) const; + bool has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const; protected: XftFont *f; @@ -1318,26 +1333,34 @@ if (buffered) { + bool back_rendered = false; if (ep != enc) { rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); - bool back_rendered = false; #ifdef HAVE_BG_PIXMAP if (term->bgPixmap.pixmap) { Picture dst = 0; + if (bg >= 0 && term->pix_colors[bg].c.color.alpha < 0x0ff00) - dst = XftDrawPicture(d2); + dst = XftDrawPicture (d2); if (bg < 0 || dst != 0) { - if (term->bgPixmap.pmap_width >= x + term->window_vt_x+w - && term->bgPixmap.pmap_height >= y + term->window_vt_y+h) + int src_x = x, src_y = y ; + + if (term->bgPixmap.is_parentOrigin ()) + { + src_x += term->window_vt_x; + src_y += term->window_vt_y; + } + + if (term->bgPixmap.pmap_width >= src_x+w + && term->bgPixmap.pmap_height >= src_y+h) { XCopyArea (disp, term->bgPixmap.pixmap, d2, gc, - x + term->window_vt_x, y + term->window_vt_y, - w, h, 0, 0); + src_x, src_y, w, h, 0, 0); } else { @@ -1345,36 +1368,31 @@ gcv.fill_style = FillTiled; gcv.tile = term->bgPixmap.pixmap; - gcv.ts_x_origin = -x; - gcv.ts_y_origin = -y; + gcv.ts_x_origin = -src_x; + gcv.ts_y_origin = -src_y; - #if 0 - GC gc2 = XCreateGC (disp, d2, - GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, - &gcv); - #endif XChangeGC (disp, gc, GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, &gcv); - XFillRectangle (disp, d2, gc/*gc2*/, 0, 0, w, h); + XFillRectangle (disp, d2, gc, 0, 0, w, h); gcv.fill_style = FillSolid; XChangeGC (disp, gc, GCFillStyle, &gcv); - /* XFreeGC (disp, gc2); */ - } + if (bg >= 0) { Picture solid_color_pict = XftDrawSrcPicture (d2, &term->pix_colors[bg].c); XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, 0, 0, w, h); } + back_rendered = true; } } #endif - if(bg >= 0 && !back_rendered) + if (bg >= 0 && !back_rendered) XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h); XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc);