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.16 by ayin, Mon Nov 26 11:20:13 2007 UTC vs.
Revision 1.18 by ayin, Tue Dec 11 17:42:04 2007 UTC

25#include "rxvt.h" /* NECESSARY */ 25#include "rxvt.h" /* NECESSARY */
26 26
27#define DO_TIMING_TEST 0 27#define DO_TIMING_TEST 0
28 28
29#if DO_TIMING_TEST 29#if DO_TIMING_TEST
30# include <sys/time.h>
30#define TIMING_TEST_START(id) \ 31#define TIMING_TEST_START(id) \
31 struct timeval timing_test_##id##_stv;\ 32 struct timeval timing_test_##id##_stv;\
32 gettimeofday (&timing_test_##id##_stv, NULL); 33 gettimeofday (&timing_test_##id##_stv, NULL);
33 34
34#define TIMING_TEST_PRINT_RESULT(id) \ 35#define TIMING_TEST_PRINT_RESULT(id) \
302 y = x; 303 y = x;
303 geom_flags |= YValue; 304 geom_flags |= YValue;
304 } 305 }
305 306
306 if (flags & geometrySet) 307 if (flags & geometrySet)
308 {
307 {/* new geometry is an adjustment to the old one ! */ 309 /* new geometry is an adjustment to the old one ! */
308 if ((geom_flags & WidthValue) && (geom_flags & HeightValue)) 310 if ((geom_flags & WidthValue) && (geom_flags & HeightValue))
309 { 311 {
310 if (w == 0 && h != 0) 312 if (w == 0 && h != 0)
311 { 313 {
312 w = h_scale; 314 w = h_scale;
328 } 330 }
329 } 331 }
330 else /* setting up geometry from scratch */ 332 else /* setting up geometry from scratch */
331 { 333 {
332 if (!(geom_flags & XValue)) 334 if (!(geom_flags & XValue))
335 {
333 {/* use default geometry - centered */ 336 /* use default geometry - centered */
334 x = y = defaultAlign; 337 x = y = defaultAlign;
335 } 338 }
336 else if (!(geom_flags & YValue)) 339 else if (!(geom_flags & YValue))
337 y = x; 340 y = x;
338 341
339 if ((geom_flags & (WidthValue|HeightValue)) == 0) 342 if ((geom_flags & (WidthValue|HeightValue)) == 0)
343 {
340 {/* use default geometry - scaled */ 344 /* use default geometry - scaled */
341 w = h = defaultScale; 345 w = h = defaultScale;
342 } 346 }
343 else if (geom_flags & WidthValue) 347 else if (geom_flags & WidthValue)
344 { 348 {
345 if (!(geom_flags & HeightValue)) 349 if (!(geom_flags & HeightValue))
505 h > 0 ? h : original_asim->height, 509 h > 0 ? h : original_asim->height,
506 background ? ASA_ASImage : ASA_XImage, 510 background ? ASA_ASImage : ASA_XImage,
507 100, ASIMAGE_QUALITY_DEFAULT); 511 100, ASIMAGE_QUALITY_DEFAULT);
508 } 512 }
509 if (background == NULL) 513 if (background == NULL)
514 {
510 {/* if tiling - pixmap has to be sized exactly as the image, 515 /* if tiling - pixmap has to be sized exactly as the image,
511 but there is no need to make it bigger then the window! */ 516 but there is no need to make it bigger then the window! */
512 if (h_scale == 0) 517 if (h_scale == 0)
513 new_pmap_width = min (result->width, target_width); 518 new_pmap_width = min (result->width, target_width);
514 if (v_scale == 0) 519 if (v_scale == 0)
515 new_pmap_height = min (result->height, target_height); 520 new_pmap_height = min (result->height, target_height);
516 /* we also need to tile our image in one or both directions */ 521 /* we also need to tile our image in one or both directions */
530 result = tmp; 535 result = tmp;
531 } 536 }
532 } 537 }
533 } 538 }
534 else 539 else
540 {
535 {/* if blending background and image - pixmap has to be sized same as target window */ 541 /* if blending background and image - pixmap has to be sized same as target window */
536 ASImageLayer *layers = create_image_layers (2); 542 ASImageLayer *layers = create_image_layers (2);
537 ASImage *merged_im = NULL; 543 ASImage *merged_im = NULL;
538 544
539 layers[0].im = background; 545 layers[0].im = background;
540 layers[0].clip_width = target_width; 546 layers[0].clip_width = target_width;
541 layers[0].clip_height = target_height; 547 layers[0].clip_height = target_height;
542 layers[0].tint = background_tint; 548 layers[0].tint = background_tint;
543 layers[1].im = result; 549 layers[1].im = result;
544 if (w <= 0) 550 if (w <= 0)
551 {
545 {/* tile horizontally */ 552 /* tile horizontally */
546 while (x > 0) x -= (int)result->width; 553 while (x > 0) x -= (int)result->width;
547 layers[1].dst_x = x; 554 layers[1].dst_x = x;
548 layers[1].clip_width = result->width+target_width; 555 layers[1].clip_width = result->width+target_width;
549 } 556 }
550 else 557 else
558 {
551 {/* clip horizontally */ 559 /* clip horizontally */
552 layers[1].dst_x = x; 560 layers[1].dst_x = x;
553 layers[1].clip_width = result->width; 561 layers[1].clip_width = result->width;
554 } 562 }
555 if (h <= 0) 563 if (h <= 0)
556 { 564 {
843 if (sx + window_width <= 0 || sy + window_height <= 0 851 if (sx + window_width <= 0 || sy + window_height <= 0
844 || sx >= root_width || sy >= root_height) 852 || sx >= root_width || sy >= root_height)
845 return 0; 853 return 0;
846 854
847 if (root_pixmap != None) 855 if (root_pixmap != None)
856 {
848 {/* we want to validate the pixmap and get it's size at the same time : */ 857 /* we want to validate the pixmap and get it's size at the same time : */
849 int junk; 858 int junk;
850 unsigned int ujunk; 859 unsigned int ujunk;
851 /* root pixmap may be bad - allow a error */ 860 /* root pixmap may be bad - allow a error */
852 target->allowedxerror = -1; 861 target->allowedxerror = -1;
853 862
916 } 925 }
917 else 926 else
918 result |= transpPmapTiled; 927 result |= transpPmapTiled;
919 } 928 }
920 else 929 else
930 {
921 {/* strightforward pixmap copy */ 931 /* strightforward pixmap copy */
922 gcv.tile = root_pixmap; 932 gcv.tile = root_pixmap;
923 gcv.fill_style = FillTiled; 933 gcv.fill_style = FillTiled;
924 934
925 while (sx < 0) sx += (int)root_width; 935 while (sx < 0) sx += (int)root_width;
926 while (sy < 0) sy += (int)root_height; 936 while (sy < 0) sy += (int)root_height;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines