1 | /*----------------------------------------------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: rxvtfont.C |
2 | * File: rxvtfont.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com> |
4 | * Copyright (c) 2003-2008 Marc Lehmann <pcg@goof.com> |
5 | * - original version. |
5 | * - original version. |
6 | * |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
9 | * the Free Software Foundation; either version 2 of the License, or |
… | |
… | |
1296 | dTermGC; |
1296 | dTermGC; |
1297 | |
1297 | |
1298 | int w = term->fwidth * len; |
1298 | int w = term->fwidth * len; |
1299 | int h = term->fheight; |
1299 | int h = term->fheight; |
1300 | |
1300 | |
1301 | /* |
|
|
1302 | * Maybe make buffering into a resource flag? Compile time option doesn't seems like a |
|
|
1303 | * good idea from the perspective of packaging for wide variety of user configs. |
|
|
1304 | */ |
|
|
1305 | bool buffered = bg >= Color_transparent; |
1301 | bool buffered = bg >= Color_transparent |
1306 | #ifdef FORCE_UNBUFFERED_XFT |
1302 | && term->option (Opt_buffered); |
1307 | buffered = false; |
|
|
1308 | #endif |
|
|
1309 | |
1303 | |
1310 | // cut trailing spaces |
1304 | // cut trailing spaces |
1311 | while (len && text [len - 1] == ' ') |
1305 | while (len && text [len - 1] == ' ') |
1312 | len--; |
1306 | len--; |
1313 | |
1307 | |
… | |
… | |
1345 | if (ep != enc) |
1339 | if (ep != enc) |
1346 | { |
1340 | { |
1347 | rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); |
1341 | rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); |
1348 | |
1342 | |
1349 | #ifdef HAVE_BG_PIXMAP |
1343 | #ifdef HAVE_BG_PIXMAP |
1350 | Picture dst = 0; |
1344 | Picture dst = 0; // the only assignment is done conditionally in the following if condition |
1351 | |
1345 | |
1352 | if (term->bgPixmap.pixmap |
1346 | if (term->bgPixmap.pixmap |
1353 | && (bg == Color_transparent || bg == Color_bg |
1347 | && (bg == Color_transparent || bg == Color_bg |
1354 | || (bg >= 0 && !term->pix_colors[bg].is_opaque () && ((dst = XftDrawPicture (d2)))))) |
1348 | || (bg >= 0 && !term->pix_colors[bg].is_opaque () && ((dst = XftDrawPicture (d2)))))) |
1355 | { |
1349 | { |
… | |
… | |
1388 | |
1382 | |
1389 | if (dst) |
1383 | if (dst) |
1390 | { |
1384 | { |
1391 | Picture solid_color_pict = XftDrawSrcPicture (d2, &term->pix_colors[bg].c); |
1385 | Picture solid_color_pict = XftDrawSrcPicture (d2, &term->pix_colors[bg].c); |
1392 | |
1386 | |
|
|
1387 | // dst can only be set when bg >= 0 |
1393 | XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
1388 | XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
1394 | } |
1389 | } |
1395 | } |
1390 | } |
1396 | else |
1391 | else |
1397 | #endif |
1392 | #endif |
1398 | XftDrawRect (d2, &term->pix_colors[bg < 0 ? Color_bg : bg].c, 0, 0, w, h); |
1393 | XftDrawRect (d2, &term->pix_colors[bg >= 0 ? bg : Color_bg].c, 0, 0, w, h); |
1399 | |
1394 | |
1400 | XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc); |
1395 | XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc); |
1401 | XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y); |
1396 | XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y); |
1402 | } |
1397 | } |
1403 | else |
1398 | else |