--- rxvt-unicode/src/rxvtfont.C 2008/01/23 05:59:29 1.130 +++ rxvt-unicode/src/rxvtfont.C 2008/01/23 09:42:02 1.134 @@ -239,10 +239,12 @@ { #if XFT bool done = false; -#ifdef HAVE_BG_PIXMAP - if (term->bgPixmap.pixmap && color >= 0 && term->pix_colors[color].c.color.alpha < 0x0ff00) + +# ifdef HAVE_BG_PIXMAP + if (term->bgPixmap.pixmap && color >= 0 && !term->pix_colors[color].is_opaque ()) { Picture dst = XftDrawPicture (d); + if (dst != 0) { XClearArea (disp, d, x, y, w, h, false); @@ -251,9 +253,10 @@ done = true; } } -#endif +# 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); @@ -1348,61 +1351,57 @@ rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); #ifdef HAVE_BG_PIXMAP - if (term->bgPixmap.pixmap) + + if (term->bgPixmap.pixmap + && !(bg >= 0 && term->pix_colors[bg].is_opaque ())) { - Picture dst = 0; + Picture dst = XftDrawPicture (d2); - if (bg >= 0 && term->pix_colors[bg].is_opaque ()) - dst = XftDrawPicture (d2); + int src_x = x, src_y = y; - if (dst) + if (term->bgPixmap.is_parentOrigin ()) { - int src_x = x, src_y = y; + src_x += term->window_vt_x; + src_y += term->window_vt_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); - } + 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); - back_rendered = true; + gcv.fill_style = FillSolid; + XChangeGC (disp, gc, GCFillStyle, &gcv); } + + if (bg >= 0 && dst) // colour must be (and is) non-opaque here + { + 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) - XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h); + if (!back_rendered) + XftDrawRect (d2, &term->pix_colors[bg < 0 ? Color_bg : bg].c, 0, 0, w, h); XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc); XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y);