--- rxvt-unicode/src/rxvtfont.C 2006/10/03 10:28:25 1.104 +++ rxvt-unicode/src/rxvtfont.C 2007/09/20 15:32:34 1.119 @@ -234,12 +234,27 @@ dTermDisplay; dTermGC; - if (color < 0 || color == Color_bg) + if (color == Color_bg || color == Color_transparent) XClearArea (disp, d, x, y, w, h, false); - else + 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); @@ -443,7 +458,7 @@ ? f1 : (*fs)[fs->find_font (cc->c2)]; - f2->draw (d, x, y, chrs, width, fg, -1); + f2->draw (d, x, y, chrs, width, fg, Color_none); } } #endif @@ -1274,15 +1289,15 @@ int w = term->fwidth * len; int h = term->fheight; - bool buffered = bg >= 0 // we don't use a transparent bg -#ifndef FORCE_UNBUFFERED_XFT -# if defined(XPM_BACKGROUND) || defined(TRANSPARENT) - || !term->am_transparent // we aren't transparent - || term->am_pixmap_trans // we have a pixmap -# endif + /* TODO: this logic needs some more thinking, since we no longer do pseudo-transparency. + * Maybe make buffering into a resource flag? Compile time option doesn't seems like a + * good idea from the perspective of packaging for wide variety of user configs. + */ + bool buffered = true +#ifdef FORCE_UNBUFFERED_XFT + && bg >= 0 #endif ; - // cut trailing spaces while (len && text [len - 1] == ' ') len--; @@ -1318,38 +1333,66 @@ if (buffered) { + bool back_rendered = false; if (ep != enc) { rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); - if (0) - ; -#ifdef TRANSPARENT - else if (bg < 0 && term->am_pixmap_trans) - XCopyArea (disp, term->pixmap, d2, gc, - x + term->window_vt_x, y + term->window_vt_y, - w, h, 0, 0); -#endif -#ifdef XPM_BACKGROUND - else if (bg < 0 && term->bgPixmap.pixmap) +#ifdef HAVE_BG_PIXMAP + if (term->bgPixmap.pixmap) { - XGCValues gcv; + Picture dst = 0; - gcv.fill_style = FillTiled; - gcv.tile = term->pixmap; - gcv.ts_x_origin = -x; - gcv.ts_y_origin = -y; - - GC gc2 = XCreateGC (disp, d2, - GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, - &gcv); - - XFillRectangle (disp, d2, gc2, 0, 0, w, h); + if (bg >= 0 && term->pix_colors[bg].c.color.alpha < 0x0ff00) + dst = XftDrawPicture (d2); + + if (bg < 0 || dst != 0) + { + 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, + src_x, src_y, w, h, 0, 0); + } + else + { + XGCValues gcv; + + gcv.fill_style = FillTiled; + gcv.tile = term->bgPixmap.pixmap; + gcv.ts_x_origin = -src_x; + gcv.ts_y_origin = -src_y; + + XChangeGC (disp, gc, + GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, + &gcv); + + XFillRectangle (disp, d2, gc, 0, 0, w, h); + + gcv.fill_style = FillSolid; + XChangeGC (disp, gc, GCFillStyle, &gcv); + } + + 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); + } - XFreeGC (disp, gc2); + back_rendered = true; + } } #endif - else + + 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);