ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtfont.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtfont.C (file contents):
Revision 1.103 by root, Sun Aug 27 10:10:25 2006 UTC vs.
Revision 1.119 by sasha, Thu Sep 20 15:32:34 2007 UTC

232rxvt_font::clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color) const 232rxvt_font::clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color) const
233{ 233{
234 dTermDisplay; 234 dTermDisplay;
235 dTermGC; 235 dTermGC;
236 236
237 if (color < 0 || color == Color_bg) 237 if (color == Color_bg || color == Color_transparent)
238 XClearArea (disp, d, x, y, w, h, false); 238 XClearArea (disp, d, x, y, w, h, false);
239 else 239 else if (color >= 0)
240 { 240 {
241#if XFT 241#if XFT
242 bool done = false;
243#ifdef HAVE_BG_PIXMAP
244 if (term->bgPixmap.pixmap && color >= 0 && term->pix_colors[color].c.color.alpha < 0x0ff00)
245 {
246 Picture dst = XftDrawPicture (d);
247 if (dst != 0)
248 {
249 XClearArea (disp, d, x, y, w, h, false);
250 Picture solid_color_pict = XftDrawSrcPicture (d, &term->pix_colors[color].c);
251 XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, x, y, w, h);
252 done = true;
253 }
254 }
255#endif
256 if (!done)
242 XftDrawRect (d, &term->pix_colors[color].c, x, y, w, h); 257 XftDrawRect (d, &term->pix_colors[color].c, x, y, w, h);
243#else 258#else
244 XSetForeground (disp, gc, term->pix_colors[color]); 259 XSetForeground (disp, gc, term->pix_colors[color]);
245 XFillRectangle (disp, d, gc, x, y, w, h); 260 XFillRectangle (disp, d, gc, x, y, w, h);
246#endif 261#endif
247 } 262 }
441 *chrs = cc->c2; 456 *chrs = cc->c2;
442 rxvt_font *f2 = (f1->has_char (cc->c2, 0, careful) && !careful) 457 rxvt_font *f2 = (f1->has_char (cc->c2, 0, careful) && !careful)
443 ? f1 458 ? f1
444 : (*fs)[fs->find_font (cc->c2)]; 459 : (*fs)[fs->find_font (cc->c2)];
445 460
446 f2->draw (d, x, y, chrs, width, fg, -1); 461 f2->draw (d, x, y, chrs, width, fg, Color_none);
447 } 462 }
448 } 463 }
449#endif 464#endif
450 else 465 else
451 switch (t) 466 switch (t)
481 const text_t *text, int len, 496 const text_t *text, int len,
482 int fg, int bg); 497 int fg, int bg);
483 498
484 bool slow; // wether this is a proportional font or has other funny characteristics 499 bool slow; // wether this is a proportional font or has other funny characteristics
485 XFontStruct *f; 500 XFontStruct *f;
486 codeset cs;
487 bool enc2b, encm; 501 bool enc2b, encm;
488 502
489 char *get_property (XFontStruct *f, Atom property, const char *repl) const; 503 char *get_property (XFontStruct *f, Atom property, const char *repl) const;
490 bool set_properties (rxvt_fontprop &p, int height, const char *weight, const char *slant, int avgwidth); 504 bool set_properties (rxvt_fontprop &p, int height, const char *weight, const char *slant, int avgwidth);
491 bool set_properties (rxvt_fontprop &p, XFontStruct *f); 505 bool set_properties (rxvt_fontprop &p, XFontStruct *f);
1273 dTermGC; 1287 dTermGC;
1274 1288
1275 int w = term->fwidth * len; 1289 int w = term->fwidth * len;
1276 int h = term->fheight; 1290 int h = term->fheight;
1277 1291
1278 bool buffered = bg >= 0 // we don't use a transparent bg 1292 /* TODO: this logic needs some more thinking, since we no longer do pseudo-transparency.
1293 * Maybe make buffering into a resource flag? Compile time option doesn't seems like a
1294 * good idea from the perspective of packaging for wide variety of user configs.
1295 */
1296 bool buffered = true
1279#ifndef FORCE_UNBUFFERED_XFT 1297#ifdef FORCE_UNBUFFERED_XFT
1280# if defined(XPM_BACKGROUND) || defined(TRANSPARENT) 1298 && bg >= 0
1281 || !term->am_transparent // we aren't transparent
1282 || term->am_pixmap_trans // we have a pixmap
1283# endif
1284#endif 1299#endif
1285 ; 1300 ;
1286
1287 // cut trailing spaces 1301 // cut trailing spaces
1288 while (len && text [len - 1] == ' ') 1302 while (len && text [len - 1] == ' ')
1289 len--; 1303 len--;
1290 1304
1291 int x_ = buffered ? 0 : x; 1305 int x_ = buffered ? 0 : x;
1317 x_ += cwidth; 1331 x_ += cwidth;
1318 } 1332 }
1319 1333
1320 if (buffered) 1334 if (buffered)
1321 { 1335 {
1336 bool back_rendered = false;
1322 if (ep != enc) 1337 if (ep != enc)
1323 { 1338 {
1324 rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); 1339 rxvt_drawable &d2 = d.screen->scratch_drawable (w, h);
1325 1340
1326 if (0) 1341#ifdef HAVE_BG_PIXMAP
1327 ;
1328#ifdef TRANSPARENT
1329 else if (bg < 0 && term->am_pixmap_trans)
1330 XCopyArea (disp, term->pixmap, d2, gc,
1331 x + term->window_vt_x, y + term->window_vt_y,
1332 w, h, 0, 0);
1333#endif
1334#ifdef XPM_BACKGROUND
1335 else if (bg < 0 && term->bgPixmap.pixmap) 1342 if (term->bgPixmap.pixmap)
1336 { 1343 {
1344 Picture dst = 0;
1345
1346 if (bg >= 0 && term->pix_colors[bg].c.color.alpha < 0x0ff00)
1347 dst = XftDrawPicture (d2);
1348
1349 if (bg < 0 || dst != 0)
1350 {
1351 int src_x = x, src_y = y ;
1352
1353 if (term->bgPixmap.is_parentOrigin ())
1354 {
1355 src_x += term->window_vt_x;
1356 src_y += term->window_vt_y;
1357 }
1358
1359 if (term->bgPixmap.pmap_width >= src_x+w
1360 && term->bgPixmap.pmap_height >= src_y+h)
1361 {
1362 XCopyArea (disp, term->bgPixmap.pixmap, d2, gc,
1363 src_x, src_y, w, h, 0, 0);
1364 }
1365 else
1366 {
1337 XGCValues gcv; 1367 XGCValues gcv;
1338 1368
1339 gcv.fill_style = FillTiled; 1369 gcv.fill_style = FillTiled;
1340 gcv.tile = term->pixmap; 1370 gcv.tile = term->bgPixmap.pixmap;
1341 gcv.ts_x_origin = -x; 1371 gcv.ts_x_origin = -src_x;
1342 gcv.ts_y_origin = -y; 1372 gcv.ts_y_origin = -src_y;
1343 1373
1344 GC gc2 = XCreateGC (disp, d2, 1374 XChangeGC (disp, gc,
1345 GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, 1375 GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle,
1346 &gcv); 1376 &gcv);
1347 1377
1348 XFillRectangle (disp, d2, gc2, 0, 0, w, h); 1378 XFillRectangle (disp, d2, gc, 0, 0, w, h);
1349 1379
1350 XFreeGC (disp, gc2); 1380 gcv.fill_style = FillSolid;
1381 XChangeGC (disp, gc, GCFillStyle, &gcv);
1382 }
1383
1384 if (bg >= 0)
1385 {
1386 Picture solid_color_pict = XftDrawSrcPicture (d2, &term->pix_colors[bg].c);
1387 XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, 0, 0, w, h);
1388 }
1389
1390 back_rendered = true;
1391 }
1351 } 1392 }
1352#endif 1393#endif
1353 else 1394
1395 if (bg >= 0 && !back_rendered)
1354 XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h); 1396 XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h);
1355 1397
1356 XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc); 1398 XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc);
1357 XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y); 1399 XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y);
1358 } 1400 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines