… | |
… | |
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{ struct timeval tv;gettimeofday (&tv, NULL); tv.tv_sec -= (timing_test_##id##_stv).tv_sec;\ |
37 | fprintf (stderr, "%s: %s: %d: elapsed %ld usec\n", #id, __FILE__, __LINE__,\ |
37 | fprintf (stderr, "%s: %s: %d: elapsed %ld usec\n", #id, __FILE__, __LINE__,\ |
… | |
… | |
136 | # endif |
136 | # endif |
137 | |
137 | |
138 | return false; |
138 | return false; |
139 | } |
139 | } |
140 | |
140 | |
141 | bool |
141 | bool |
142 | bgPixmap_t::window_position_sensitive () |
142 | bgPixmap_t::window_position_sensitive () |
143 | { |
143 | { |
144 | # ifdef ENABLE_TRANSPARENCY |
144 | # ifdef ENABLE_TRANSPARENCY |
145 | if (flags & isTransparent) |
145 | if (flags & isTransparent) |
146 | return true; |
146 | return true; |
147 | # endif |
147 | # endif |
… | |
… | |
495 | new_pmap_height = background->height; |
495 | new_pmap_height = background->height; |
496 | result = background; |
496 | result = background; |
497 | |
497 | |
498 | if (background_tint != TINT_LEAVE_SAME) |
498 | if (background_tint != TINT_LEAVE_SAME) |
499 | { |
499 | { |
500 | ASImage* tmp = tile_asimage (target->asv, background, 0, 0, |
500 | ASImage *tmp = tile_asimage (target->asv, background, 0, 0, |
501 | target_width, target_height, background_tint, |
501 | target_width, target_height, background_tint, |
502 | ASA_XImage, 100, ASIMAGE_QUALITY_DEFAULT); |
502 | ASA_XImage, 100, ASIMAGE_QUALITY_DEFAULT); |
503 | if (tmp) |
503 | if (tmp) |
504 | result = tmp; |
504 | result = tmp; |
505 | } |
505 | } |
… | |
… | |
533 | if (h_scale == 0 || v_scale == 0) |
533 | if (h_scale == 0 || v_scale == 0) |
534 | { |
534 | { |
535 | ASImage *tmp = tile_asimage (target->asv, result, |
535 | ASImage *tmp = tile_asimage (target->asv, result, |
536 | (h_scale > 0) ? 0 : (int)result->width - x, |
536 | (h_scale > 0) ? 0 : (int)result->width - x, |
537 | (v_scale > 0) ? 0 : (int)result->height - y, |
537 | (v_scale > 0) ? 0 : (int)result->height - y, |
538 | new_pmap_width, |
538 | new_pmap_width, |
539 | new_pmap_height, |
539 | new_pmap_height, |
540 | TINT_LEAVE_SAME, ASA_XImage, |
540 | TINT_LEAVE_SAME, ASA_XImage, |
541 | 100, ASIMAGE_QUALITY_DEFAULT); |
541 | 100, ASIMAGE_QUALITY_DEFAULT); |
542 | if (tmp) |
542 | if (tmp) |
543 | { |
543 | { |
… | |
… | |
848 | unsigned long result = 0; |
848 | unsigned long result = 0; |
849 | |
849 | |
850 | if (target == NULL) |
850 | if (target == NULL) |
851 | return 0; |
851 | return 0; |
852 | |
852 | |
853 | /* root dimentions may change from call to call - but Display structure should |
853 | /* root dimensions may change from call to call - but Display structure should |
854 | * be always up-to-date, so let's use it : |
854 | * be always up-to-date, so let's use it : |
855 | */ |
855 | */ |
856 | Window root = target->display->root; |
856 | Window root = target->display->root; |
857 | int screen = target->display->screen; |
857 | int screen = target->display->screen; |
858 | Display *dpy = target->dpy; |
858 | Display *dpy = target->dpy; |
… | |
… | |
947 | else |
947 | else |
948 | result |= transpPmapTiled; |
948 | result |= transpPmapTiled; |
949 | } |
949 | } |
950 | else |
950 | else |
951 | { |
951 | { |
952 | /* strightforward pixmap copy */ |
952 | /* straightforward pixmap copy */ |
953 | gcv.tile = root_pixmap; |
953 | gcv.tile = root_pixmap; |
954 | gcv.fill_style = FillTiled; |
954 | gcv.fill_style = FillTiled; |
955 | |
955 | |
956 | while (sx < 0) sx += (int)root_width; |
956 | while (sx < 0) sx += (int)root_width; |
957 | while (sy < 0) sy += (int)root_height; |
957 | while (sy < 0) sy += (int)root_height; |
… | |
… | |
1108 | return false; |
1108 | return false; |
1109 | } |
1109 | } |
1110 | # endif /* ENABLE_TRANSPARENCY */ |
1110 | # endif /* ENABLE_TRANSPARENCY */ |
1111 | |
1111 | |
1112 | # ifndef HAVE_AFTERIMAGE |
1112 | # ifndef HAVE_AFTERIMAGE |
1113 | static void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm); |
1113 | static void ShadeXImage(rxvt_term *term, XImage *srcImage, int shade, int rm, int gm, int bm); |
1114 | # endif |
1114 | # endif |
1115 | |
1115 | |
1116 | bool |
1116 | bool |
1117 | bgPixmap_t::render () |
1117 | bgPixmap_t::render () |
1118 | { |
1118 | { |
… | |
… | |
1165 | as_tint = shading2tint32 (&as_shade); |
1165 | as_tint = shading2tint32 (&as_shade); |
1166 | } |
1166 | } |
1167 | |
1167 | |
1168 | if (!(background_flags & transpPmapBlured) && (flags & blurNeeded) && background != NULL) |
1168 | if (!(background_flags & transpPmapBlured) && (flags & blurNeeded) && background != NULL) |
1169 | { |
1169 | { |
1170 | ASImage* tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, |
1170 | ASImage *tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, |
1171 | (original_asim == NULL || tint == TINT_LEAVE_SAME)?ASA_XImage:ASA_ASImage, |
1171 | (original_asim == NULL || tint == TINT_LEAVE_SAME)?ASA_XImage:ASA_ASImage, |
1172 | 100, ASIMAGE_QUALITY_DEFAULT); |
1172 | 100, ASIMAGE_QUALITY_DEFAULT); |
1173 | if (tmp) |
1173 | if (tmp) |
1174 | { |
1174 | { |
1175 | destroy_asimage (&background); |
1175 | destroy_asimage (&background); |
… | |
… | |
1186 | else if (background_flags && pmap_depth != target->depth) |
1186 | else if (background_flags && pmap_depth != target->depth) |
1187 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1187 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1188 | |
1188 | |
1189 | # elif !XFT /* our own client-side tinting */ |
1189 | # elif !XFT /* our own client-side tinting */ |
1190 | |
1190 | |
1191 | /* ATTENTION: We ASSUME that XFT will let us do all the tinting neccessary server-side. |
1191 | /* 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 !!! */ |
1192 | This may need to be changed in need_client_side_rendering() logic is altered !!! */ |
1193 | |
1193 | |
1194 | if (background_flags && (flags & isInvalid)) |
1194 | if (background_flags && (flags & isInvalid)) |
1195 | { |
1195 | { |
1196 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1196 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
… | |
… | |
1327 | |
1327 | |
1328 | /* don't want Expose on the parent or vt. It is better to use |
1328 | /* don't want Expose on the parent or vt. It is better to use |
1329 | scr_touch or we get a great deal of flicker otherwise: */ |
1329 | scr_touch or we get a great deal of flicker otherwise: */ |
1330 | XClearWindow (target->dpy, target->parent[0]); |
1330 | XClearWindow (target->dpy, target->parent[0]); |
1331 | |
1331 | |
1332 | if (target->scrollBar.win) |
1332 | if (target->scrollBar.state && target->scrollBar.win) |
1333 | { |
1333 | { |
1334 | target->scrollBar.state = STATE_IDLE; |
1334 | target->scrollBar.state = STATE_IDLE; |
1335 | target->scrollBar.show (0); |
1335 | target->scrollBar.show (0); |
1336 | } |
1336 | } |
1337 | |
1337 | |
… | |
… | |
1346 | /* taken from aterm-0.4.2 */ |
1346 | /* taken from aterm-0.4.2 */ |
1347 | |
1347 | |
1348 | typedef uint32_t RUINT32T; |
1348 | typedef uint32_t RUINT32T; |
1349 | |
1349 | |
1350 | static void |
1350 | static void |
1351 | ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
1351 | ShadeXImage(rxvt_term *term, XImage *srcImage, int shade, int rm, int gm, int bm) |
1352 | { |
1352 | { |
1353 | int sh_r, sh_g, sh_b; |
1353 | int sh_r, sh_g, sh_b; |
1354 | RUINT32T mask_r, mask_g, mask_b; |
1354 | RUINT32T mask_r, mask_g, mask_b; |
1355 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
1355 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
1356 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
1356 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |