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

Comparing rxvt-unicode/src/background.C (file contents):
Revision 1.133 by sf-exg, Tue Jan 11 09:21:14 2011 UTC vs.
Revision 1.136 by sf-exg, Fri Jan 14 17:06:04 2011 UTC

30# include <X11/extensions/Xrender.h> 30# include <X11/extensions/Xrender.h>
31#endif 31#endif
32 32
33#ifndef FilterConvolution 33#ifndef FilterConvolution
34#define FilterConvolution "convolution" 34#define FilterConvolution "convolution"
35#endif
36
37#define DO_TIMING_TEST 0
38
39#if DO_TIMING_TEST
40# include <sys/time.h>
41#define TIMING_TEST_START(id) \
42 struct timeval timing_test_##id##_stv; \
43 gettimeofday (&timing_test_##id##_stv, NULL);
44
45#define TIMING_TEST_PRINT_RESULT(id) \
46 do { \
47 struct timeval tv; \
48 gettimeofday (&tv, NULL); \
49 tv.tv_sec -= (timing_test_##id##_stv).tv_sec; \
50 fprintf (stderr, "%s: %s: %d: elapsed %ld usec\n", #id, __FILE__, __LINE__, \
51 tv.tv_sec * 1000000 + tv.tv_usec - (timing_test_##id##_stv).tv_usec); \
52 } while (0)
53
54#else
55#define TIMING_TEST_START(id) do {} while (0)
56#define TIMING_TEST_PRINT_RESULT(id) do {} while (0)
57#endif 35#endif
58 36
59/* 37/*
60 * Pixmap geometry string interpretation : 38 * Pixmap geometry string interpretation :
61 * Each geometry string contains zero or one scale/position 39 * Each geometry string contains zero or one scale/position
594 GC gc; 572 GC gc;
595 573
596 /* create Pixmap */ 574 /* create Pixmap */
597 if (pixmap == None 575 if (pixmap == None
598 || pmap_width != new_pmap_width 576 || pmap_width != new_pmap_width
599 || pmap_height != new_pmap_height 577 || pmap_height != new_pmap_height)
600 || pmap_depth != target->depth)
601 { 578 {
602 if (pixmap) 579 if (pixmap)
603 XFreePixmap (target->dpy, pixmap); 580 XFreePixmap (target->dpy, pixmap);
604 pixmap = XCreatePixmap (target->dpy, target->vt, new_pmap_width, new_pmap_height, target->depth); 581 pixmap = XCreatePixmap (target->dpy, target->vt, new_pmap_width, new_pmap_height, target->depth);
605 pmap_width = new_pmap_width; 582 pmap_width = new_pmap_width;
606 pmap_height = new_pmap_height; 583 pmap_height = new_pmap_height;
607 pmap_depth = target->depth;
608 } 584 }
609 /* fill with background color (if result's not completely overlapping it) */ 585 /* fill with background color (if result's not completely overlapping it) */
610 gcv.foreground = target->pix_colors[Color_bg]; 586 gcv.foreground = target->pix_colors[Color_bg];
611 gc = XCreateGC (target->dpy, target->vt, GCForeground, &gcv); 587 gc = XCreateGC (target->dpy, target->vt, GCForeground, &gcv);
612 588
803 } 779 }
804 } 780 }
805 781
806 if (pixmap == None 782 if (pixmap == None
807 || pmap_width != new_pmap_width 783 || pmap_width != new_pmap_width
808 || pmap_height != new_pmap_height 784 || pmap_height != new_pmap_height)
809 || pmap_depth != target->depth)
810 { 785 {
811 if (pixmap) 786 if (pixmap)
812 XFreePixmap (target->dpy, pixmap); 787 XFreePixmap (target->dpy, pixmap);
813 pixmap = XCreatePixmap (target->dpy, target->vt, new_pmap_width, new_pmap_height, target->depth); 788 pixmap = XCreatePixmap (target->dpy, target->vt, new_pmap_width, new_pmap_height, target->depth);
814 pmap_width = new_pmap_width; 789 pmap_width = new_pmap_width;
815 pmap_height = new_pmap_height; 790 pmap_height = new_pmap_height;
816 pmap_depth = target->depth;
817 } 791 }
818 792
819 gcv.foreground = target->pix_colors[Color_bg]; 793 gcv.foreground = target->pix_colors[Color_bg];
820 gc = XCreateGC (target->dpy, target->vt, GCForeground, &gcv); 794 gc = XCreateGC (target->dpy, target->vt, GCForeground, &gcv);
821 795
1329 } 1303 }
1330 1304
1331 if (root_pixmap == None) 1305 if (root_pixmap == None)
1332 return 0; 1306 return 0;
1333 1307
1308 if (pixmap == None
1309 || pmap_width != window_width
1310 || pmap_height != window_height)
1311 {
1312 if (pixmap)
1313 XFreePixmap (target->dpy, pixmap);
1334 Pixmap tiled_root_pmap = XCreatePixmap (dpy, target->vt, window_width, window_height, target->depth); 1314 pixmap = XCreatePixmap (target->dpy, target->vt, window_width, window_height, target->depth);
1315 pmap_width = window_width;
1316 pmap_height = window_height;
1317 }
1335 1318
1336 if (tiled_root_pmap == None) /* something really bad happened - abort */ 1319 if (pixmap == None)
1337 return 0; 1320 return 0;
1338 1321
1339 /* straightforward pixmap copy */ 1322 /* straightforward pixmap copy */
1340 while (sx < 0) sx += (int)root_width; 1323 while (sx < 0) sx += (int)root_width;
1341 while (sy < 0) sy += (int)root_height; 1324 while (sy < 0) sy += (int)root_height;
1346 gcv.ts_y_origin = -sy; 1329 gcv.ts_y_origin = -sy;
1347 gc = XCreateGC (dpy, target->vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); 1330 gc = XCreateGC (dpy, target->vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv);
1348 1331
1349 if (gc) 1332 if (gc)
1350 { 1333 {
1351 XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); 1334 XFillRectangle (dpy, pixmap, gc, 0, 0, window_width, window_height);
1352 result |= transpPmapTiled; 1335 result |= transpPmapTiled;
1353 XFreeGC (dpy, gc); 1336 XFreeGC (dpy, gc);
1354 1337
1355 if (!(flags & CLIENT_RENDER)) 1338 if (!(flags & CLIENT_RENDER))
1356 { 1339 {
1357 if ((flags & blurNeeded) 1340 if ((flags & blurNeeded)
1358 && (flags & HAS_RENDER_CONV)) 1341 && (flags & HAS_RENDER_CONV))
1359 { 1342 {
1360 if (blur_pixmap (tiled_root_pmap, target->visual, window_width, window_height)) 1343 if (blur_pixmap (pixmap, target->visual, window_width, window_height))
1361 result |= transpPmapBlurred; 1344 result |= transpPmapBlurred;
1362 } 1345 }
1363 if ((flags & tintNeeded) 1346 if ((flags & tintNeeded)
1364 && (flags & (tintWholesome | HAS_RENDER))) 1347 && (flags & (tintWholesome | HAS_RENDER)))
1365 { 1348 {
1366 if (tint_pixmap (tiled_root_pmap, target->visual, window_width, window_height)) 1349 if (tint_pixmap (pixmap, target->visual, window_width, window_height))
1367 result |= transpPmapTinted; 1350 result |= transpPmapTinted;
1368 } 1351 }
1369 } /* server side rendering completed */ 1352 } /* server side rendering completed */
1370
1371 if (pixmap)
1372 XFreePixmap (dpy, pixmap);
1373
1374 pixmap = tiled_root_pmap;
1375 pmap_width = window_width;
1376 pmap_height = window_height;
1377 pmap_depth = target->depth;
1378 } 1353 }
1379 else
1380 XFreePixmap (dpy, tiled_root_pmap);
1381 1354
1382 if (recoded_root_pmap != root_pixmap) 1355 if (recoded_root_pmap != root_pixmap)
1383 XFreePixmap (dpy, recoded_root_pmap); 1356 XFreePixmap (dpy, recoded_root_pmap);
1384 1357
1385 return result; 1358 return result;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines