… | |
… | |
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 | # include <sys/time.h> |
31 | #define TIMING_TEST_START(id) \ |
31 | #define TIMING_TEST_START(id) \ |
32 | struct timeval timing_test_##id##_stv;\ |
32 | struct timeval timing_test_##id##_stv; \ |
33 | gettimeofday (&timing_test_##id##_stv, NULL); |
33 | gettimeofday (&timing_test_##id##_stv, NULL); |
34 | |
34 | |
35 | #define TIMING_TEST_PRINT_RESULT(id) \ |
35 | #define TIMING_TEST_PRINT_RESULT(id) \ |
36 | do{ struct timeval tv;gettimeofday (&tv, NULL); tv.tv_sec -= (timing_test_##id##_stv).tv_sec;\ |
36 | do { \ |
|
|
37 | struct timeval tv; \ |
|
|
38 | gettimeofday (&tv, NULL); \ |
|
|
39 | tv.tv_sec -= (timing_test_##id##_stv).tv_sec; \ |
37 | fprintf (stderr, "%s: %s: %d: elapsed %ld usec\n", #id, __FILE__, __LINE__,\ |
40 | fprintf (stderr, "%s: %s: %d: elapsed %ld usec\n", #id, __FILE__, __LINE__, \ |
38 | tv.tv_sec * 1000000 + tv.tv_usec - (timing_test_##id##_stv).tv_usec);}while (0) |
41 | tv.tv_sec * 1000000 + tv.tv_usec - (timing_test_##id##_stv).tv_usec); \ |
|
|
42 | } while (0) |
39 | |
43 | |
40 | #else |
44 | #else |
41 | #define TIMING_TEST_START(id) do{}while (0) |
45 | #define TIMING_TEST_START(id) do {} while (0) |
42 | #define TIMING_TEST_PRINT_RESULT(id) do{}while (0) |
46 | #define TIMING_TEST_PRINT_RESULT(id) do {} while (0) |
43 | #endif |
47 | #endif |
44 | |
48 | |
45 | /* |
49 | /* |
46 | * Pixmap geometry string interpretation : |
50 | * Pixmap geometry string interpretation : |
47 | * Each geometry string contains zero or one scale/position |
51 | * Each geometry string contains zero or one scale/position |
48 | * adjustment and may optionally be followed by a colon and one or more |
52 | * adjustment and may optionally be followed by a colon and one or more |
49 | * colon-delimited pixmap operations. |
53 | * colon-delimited pixmap operations. |
50 | * The following table shows the valid geometry strings and their |
54 | * The following table shows the valid geometry strings and their |
51 | * affects on the background image : |
55 | * effects on the background image : |
52 | * |
56 | * |
53 | * WxH+X+Y Set scaling to W% by H%, and position to X% by Y%. |
57 | * WxH+X+Y Set scaling to W% by H%, and position to X% by Y%. |
54 | * W and H are percentages of the terminal window size. |
58 | * W and H are percentages of the terminal window size. |
55 | * X and Y are also percentages; e.g., +50+50 centers |
59 | * X and Y are also percentages; e.g., +50+50 centers |
56 | * the image in the window. |
60 | * the image in the window. |
… | |
… | |
550 | } |
554 | } |
551 | else |
555 | else |
552 | { |
556 | { |
553 | /* if blending background and image - pixmap has to be sized same as target window */ |
557 | /* if blending background and image - pixmap has to be sized same as target window */ |
554 | ASImageLayer *layers = create_image_layers (2); |
558 | ASImageLayer *layers = create_image_layers (2); |
555 | ASImage *merged_im = NULL; |
|
|
556 | |
559 | |
557 | layers[0].im = background; |
560 | layers[0].im = background; |
558 | layers[0].clip_width = target_width; |
561 | layers[0].clip_width = target_width; |
559 | layers[0].clip_height = target_height; |
562 | layers[0].clip_height = target_height; |
560 | layers[0].tint = background_tint; |
563 | layers[0].tint = background_tint; |
… | |
… | |
678 | target->asimman = create_generic_imageman (target->rs[Rs_path]); |
681 | target->asimman = create_generic_imageman (target->rs[Rs_path]); |
679 | |
682 | |
680 | if (const char *p = strchr (file, ';')) |
683 | if (const char *p = strchr (file, ';')) |
681 | { |
684 | { |
682 | size_t len = p - file; |
685 | size_t len = p - file; |
683 | char *f = (char *)malloc (len + 1); |
686 | char *f = rxvt_temp_buf<char> (len + 1); |
684 | memcpy (f, file, len); |
687 | memcpy (f, file, len); |
685 | f[len] = '\0'; |
688 | f[len] = '\0'; |
686 | original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); |
689 | original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); |
687 | free (f); |
|
|
688 | } |
690 | } |
689 | else |
691 | else |
690 | original_asim = get_asimage (target->asimman, file, 0xFFFFFFFF, 100); |
692 | original_asim = get_asimage (target->asimman, file, 0xFFFFFFFF, 100); |
691 | |
693 | |
692 | return original_asim; |
694 | return original_asim; |
… | |
… | |
848 | unsigned long result = 0; |
850 | unsigned long result = 0; |
849 | |
851 | |
850 | if (target == NULL) |
852 | if (target == NULL) |
851 | return 0; |
853 | return 0; |
852 | |
854 | |
853 | /* root dimentions may change from call to call - but Display structure should |
855 | /* root dimensions may change from call to call - but Display structure should |
854 | * be always up-to-date, so let's use it : |
856 | * be always up-to-date, so let's use it : |
855 | */ |
857 | */ |
856 | Window root = target->display->root; |
858 | Window root = target->display->root; |
857 | int screen = target->display->screen; |
859 | int screen = target->display->screen; |
858 | Display *dpy = target->dpy; |
860 | Display *dpy = target->dpy; |
… | |
… | |
947 | else |
949 | else |
948 | result |= transpPmapTiled; |
950 | result |= transpPmapTiled; |
949 | } |
951 | } |
950 | else |
952 | else |
951 | { |
953 | { |
952 | /* strightforward pixmap copy */ |
954 | /* straightforward pixmap copy */ |
953 | gcv.tile = root_pixmap; |
955 | gcv.tile = root_pixmap; |
954 | gcv.fill_style = FillTiled; |
956 | gcv.fill_style = FillTiled; |
955 | |
957 | |
956 | while (sx < 0) sx += (int)root_width; |
958 | while (sx < 0) sx += (int)root_width; |
957 | while (sy < 0) sy += (int)root_height; |
959 | while (sy < 0) sy += (int)root_height; |
… | |
… | |
1186 | else if (background_flags && pmap_depth != target->depth) |
1188 | else if (background_flags && pmap_depth != target->depth) |
1187 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1189 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1188 | |
1190 | |
1189 | # elif !XFT /* our own client-side tinting */ |
1191 | # elif !XFT /* our own client-side tinting */ |
1190 | |
1192 | |
1191 | /* ATTENTION: We ASSUME that XFT will let us do all the tinting neccessary server-side. |
1193 | /* ATTENTION: We ASSUME that XFT will let us do all the tinting necessary server-side. |
1192 | This may need to be changed in need_client_side_rendering() logic is altered !!! */ |
1194 | This may need to be changed in need_client_side_rendering() logic is altered !!! */ |
1193 | |
1195 | |
1194 | if (background_flags && (flags & isInvalid)) |
1196 | if (background_flags && (flags & isInvalid)) |
1195 | { |
1197 | { |
1196 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1198 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |