… | |
… | |
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) \ |
… | |
… | |
86 | */ |
87 | */ |
87 | |
88 | |
88 | #ifdef HAVE_BG_PIXMAP |
89 | #ifdef HAVE_BG_PIXMAP |
89 | bgPixmap_t::bgPixmap_t () |
90 | bgPixmap_t::bgPixmap_t () |
90 | { |
91 | { |
|
|
92 | // this is basically redundant as bgPixmap_t is only used in |
|
|
93 | // zero_initialised-derived structs |
91 | #ifdef HAVE_AFTERIMAGE |
94 | #ifdef HAVE_AFTERIMAGE |
92 | original_asim = NULL; |
95 | original_asim = NULL; |
93 | #endif |
96 | #endif |
94 | #ifdef BG_IMAGE_FROM_FILE |
97 | #ifdef BG_IMAGE_FROM_FILE |
95 | h_scale = v_scale = 0; |
98 | h_scale = v_scale = 0; |
96 | h_align = v_align = 0; |
99 | h_align = v_align = 0; |
97 | #endif |
100 | #endif |
98 | flags = 0; |
101 | flags = 0; |
99 | pixmap = None; |
102 | pixmap = None; |
|
|
103 | valid_since = invalid_since = 0; |
|
|
104 | target = 0; |
100 | } |
105 | } |
101 | |
106 | |
102 | void |
107 | void |
103 | bgPixmap_t::destroy () |
108 | bgPixmap_t::destroy () |
104 | { |
109 | { |
… | |
… | |
119 | return true; |
124 | return true; |
120 | # endif |
125 | # endif |
121 | |
126 | |
122 | # ifdef BG_IMAGE_FROM_FILE |
127 | # ifdef BG_IMAGE_FROM_FILE |
123 | # ifdef HAVE_AFTERIMAGE |
128 | # ifdef HAVE_AFTERIMAGE |
124 | if (original_asim != NULL) |
129 | if (original_asim) |
125 | # endif |
130 | # endif |
126 | { |
131 | { |
127 | if (h_scale != 0 || v_scale != 0 |
132 | if (h_scale != 0 || v_scale != 0 |
128 | || h_align != 0 || v_align != 0) |
133 | || h_align != 0 || v_align != 0) |
129 | return true; |
134 | return true; |
… | |
… | |
141 | return true; |
146 | return true; |
142 | # endif |
147 | # endif |
143 | |
148 | |
144 | # ifdef BG_IMAGE_FROM_FILE |
149 | # ifdef BG_IMAGE_FROM_FILE |
145 | # ifdef HAVE_AFTERIMAGE |
150 | # ifdef HAVE_AFTERIMAGE |
146 | if (original_asim != NULL) |
151 | if (original_asim) |
147 | # endif |
152 | # endif |
148 | { |
153 | { |
149 | if (h_align == rootAlign || v_align == rootAlign) |
154 | if (h_align == rootAlign || v_align == rootAlign) |
150 | return true; |
155 | return true; |
151 | } |
156 | } |
… | |
… | |
155 | }; |
160 | }; |
156 | |
161 | |
157 | bool bgPixmap_t::need_client_side_rendering () |
162 | bool bgPixmap_t::need_client_side_rendering () |
158 | { |
163 | { |
159 | # ifdef HAVE_AFTERIMAGE |
164 | # ifdef HAVE_AFTERIMAGE |
160 | if (original_asim != NULL) |
165 | if (original_asim) |
161 | return true; |
166 | return true; |
162 | # endif |
167 | # endif |
163 | # ifdef ENABLE_TRANSPARENCY |
168 | # ifdef ENABLE_TRANSPARENCY |
164 | if (flags & isTransparent) |
169 | if (flags & isTransparent) |
165 | { |
170 | { |
… | |
… | |
255 | int x = 0, y = 0; |
260 | int x = 0, y = 0; |
256 | unsigned int w = 0, h = 0; |
261 | unsigned int w = 0, h = 0; |
257 | unsigned int n; |
262 | unsigned int n; |
258 | unsigned long new_flags = (flags & (~geometryFlags)); |
263 | unsigned long new_flags = (flags & (~geometryFlags)); |
259 | char *p; |
264 | char *p; |
260 | # define MAXLEN_GEOM 256 /* could be longer then regular geometry string */ |
265 | # define MAXLEN_GEOM 256 /* could be longer than regular geometry string */ |
261 | |
266 | |
262 | if (geom == NULL) |
267 | if (geom == NULL) |
263 | return false; |
268 | return false; |
264 | |
269 | |
265 | char str[MAXLEN_GEOM]; |
270 | char str[MAXLEN_GEOM]; |
… | |
… | |
272 | if (n < MAXLEN_GEOM) |
277 | if (n < MAXLEN_GEOM) |
273 | { |
278 | { |
274 | char *ops; |
279 | char *ops; |
275 | new_flags |= geometrySet; |
280 | new_flags |= geometrySet; |
276 | |
281 | |
277 | strncpy (str, geom, n); |
282 | memcpy (str, geom, n); |
278 | str[n] = '\0'; |
283 | str[n] = '\0'; |
279 | if (str[0] == ':') |
284 | if (str[0] == ':') |
280 | ops = &str[0]; |
285 | ops = &str[0]; |
281 | else if (str[0] != 'x' && str[0] != 'X' && isalpha(str[0])) |
286 | else if (str[0] != 'x' && str[0] != 'X' && isalpha(str[0])) |
282 | ops = &str[0]; |
287 | ops = &str[0]; |
… | |
… | |
434 | if (new_flags != flags) |
439 | if (new_flags != flags) |
435 | { |
440 | { |
436 | flags = new_flags; |
441 | flags = new_flags; |
437 | changed++; |
442 | changed++; |
438 | } |
443 | } |
439 | //fprintf( stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", |
444 | //fprintf (stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", |
440 | // flags, h_scale, v_scale, h_align, v_align); |
445 | // flags, h_scale, v_scale, h_align, v_align); |
441 | return (changed > 0); |
446 | return (changed > 0); |
442 | } |
447 | } |
443 | |
448 | |
444 | # ifdef HAVE_AFTERIMAGE |
449 | # ifdef HAVE_AFTERIMAGE |
… | |
… | |
466 | { |
471 | { |
467 | target->get_window_origin(x, y); |
472 | target->get_window_origin(x, y); |
468 | x = -x; |
473 | x = -x; |
469 | y = -y; |
474 | y = -y; |
470 | } |
475 | } |
|
|
476 | |
471 | if (h_align != rootAlign) |
477 | if (h_align != rootAlign) |
472 | x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); |
478 | x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); |
|
|
479 | |
473 | if (v_align != rootAlign) |
480 | if (v_align != rootAlign) |
474 | y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); |
481 | y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); |
475 | } |
482 | } |
476 | |
483 | |
477 | if (original_asim == NULL |
484 | if (!original_asim |
478 | || x >= target_width |
485 | || x >= target_width |
479 | || y >= target_height |
486 | || y >= target_height |
480 | || (w > 0 && x + w <= 0) |
487 | || (w > 0 && x + w <= 0) |
481 | || (h > 0 && y + h <= 0)) |
488 | || (h > 0 && y + h <= 0)) |
482 | { |
489 | { |
483 | if (background) |
490 | if (background) |
484 | { |
491 | { |
485 | new_pmap_width = background->width; |
492 | new_pmap_width = background->width; |
486 | new_pmap_height = background->height; |
493 | new_pmap_height = background->height; |
487 | result = background; |
494 | result = background; |
|
|
495 | |
488 | if (background_tint != TINT_LEAVE_SAME) |
496 | if (background_tint != TINT_LEAVE_SAME) |
489 | { |
497 | { |
490 | ASImage* tmp = tile_asimage (target->asv, background, 0, 0, |
498 | ASImage* tmp = tile_asimage (target->asv, background, 0, 0, |
491 | target_width, target_height, background_tint, |
499 | target_width, target_height, background_tint, |
492 | ASA_XImage, 100, ASIMAGE_QUALITY_DEFAULT); |
500 | ASA_XImage, 100, ASIMAGE_QUALITY_DEFAULT); |
… | |
… | |
498 | new_pmap_width = new_pmap_height = 0; |
506 | new_pmap_width = new_pmap_height = 0; |
499 | } |
507 | } |
500 | else |
508 | else |
501 | { |
509 | { |
502 | result = original_asim; |
510 | result = original_asim; |
|
|
511 | |
503 | if ((w > 0 && w != original_asim->width) |
512 | if ((w > 0 && w != original_asim->width) |
504 | || (h > 0 && h != original_asim->height)) |
513 | || (h > 0 && h != original_asim->height)) |
505 | { |
514 | { |
506 | result = scale_asimage (target->asv, original_asim, |
515 | result = scale_asimage (target->asv, original_asim, |
507 | w > 0 ? w : original_asim->width, |
516 | w > 0 ? w : original_asim->width, |
508 | h > 0 ? h : original_asim->height, |
517 | h > 0 ? h : original_asim->height, |
509 | background ? ASA_ASImage : ASA_XImage, |
518 | background ? ASA_ASImage : ASA_XImage, |
510 | 100, ASIMAGE_QUALITY_DEFAULT); |
519 | 100, ASIMAGE_QUALITY_DEFAULT); |
511 | } |
520 | } |
|
|
521 | |
512 | if (background == NULL) |
522 | if (background == NULL) |
513 | { |
523 | { |
514 | /* if tiling - pixmap has to be sized exactly as the image, |
524 | /* if tiling - pixmap has to be sized exactly as the image, |
515 | but there is no need to make it bigger then the window! */ |
525 | but there is no need to make it bigger than the window! */ |
516 | if (h_scale == 0) |
526 | if (h_scale == 0) |
517 | new_pmap_width = min (result->width, target_width); |
527 | new_pmap_width = min (result->width, target_width); |
518 | if (v_scale == 0) |
528 | if (v_scale == 0) |
519 | new_pmap_height = min (result->height, target_height); |
529 | new_pmap_height = min (result->height, target_height); |
520 | /* we also need to tile our image in one or both directions */ |
530 | /* we also need to tile our image in one or both directions */ |
521 | if (h_scale == 0 || v_scale == 0) |
531 | if (h_scale == 0 || v_scale == 0) |
522 | { |
532 | { |
523 | ASImage *tmp = tile_asimage (target->asv, result, |
533 | ASImage *tmp = tile_asimage (target->asv, result, |
524 | (h_scale > 0) ? 0 : (int)result->width - x, |
534 | (h_scale > 0) ? 0 : (int)result->width - x, |
525 | (v_scale > 0) ? 0 : (int)result->height - y, |
535 | (v_scale > 0) ? 0 : (int)result->height - y, |
526 | new_pmap_width, |
536 | new_pmap_width, |
527 | new_pmap_height, |
537 | new_pmap_height, |
528 | TINT_LEAVE_SAME, ASA_XImage, |
538 | TINT_LEAVE_SAME, ASA_XImage, |
529 | 100, ASIMAGE_QUALITY_DEFAULT); |
539 | 100, ASIMAGE_QUALITY_DEFAULT); |
530 | if (tmp) |
540 | if (tmp) |
531 | { |
541 | { |
532 | if (result != original_asim) |
542 | if (result != original_asim) |
533 | destroy_asimage (&result); |
543 | destroy_asimage (&result); |
|
|
544 | |
534 | result = tmp; |
545 | result = tmp; |
535 | } |
546 | } |
536 | } |
547 | } |
537 | } |
548 | } |
538 | else |
549 | else |
… | |
… | |
544 | layers[0].im = background; |
555 | layers[0].im = background; |
545 | layers[0].clip_width = target_width; |
556 | layers[0].clip_width = target_width; |
546 | layers[0].clip_height = target_height; |
557 | layers[0].clip_height = target_height; |
547 | layers[0].tint = background_tint; |
558 | layers[0].tint = background_tint; |
548 | layers[1].im = result; |
559 | layers[1].im = result; |
|
|
560 | |
549 | if (w <= 0) |
561 | if (w <= 0) |
550 | { |
562 | { |
551 | /* tile horizontally */ |
563 | /* tile horizontally */ |
552 | while (x > 0) x -= (int)result->width; |
564 | while (x > 0) x -= (int)result->width; |
553 | layers[1].dst_x = x; |
565 | layers[1].dst_x = x; |
… | |
… | |
557 | { |
569 | { |
558 | /* clip horizontally */ |
570 | /* clip horizontally */ |
559 | layers[1].dst_x = x; |
571 | layers[1].dst_x = x; |
560 | layers[1].clip_width = result->width; |
572 | layers[1].clip_width = result->width; |
561 | } |
573 | } |
|
|
574 | |
562 | if (h <= 0) |
575 | if (h <= 0) |
563 | { |
576 | { |
564 | while (y > 0) y -= (int)result->height; |
577 | while (y > 0) y -= (int)result->height; |
565 | layers[1].dst_y = y; |
578 | layers[1].dst_y = y; |
566 | layers[1].clip_height = result->height + target_height; |
579 | layers[1].clip_height = result->height + target_height; |
… | |
… | |
568 | else |
581 | else |
569 | { |
582 | { |
570 | layers[1].dst_y = y; |
583 | layers[1].dst_y = y; |
571 | layers[1].clip_height = result->height; |
584 | layers[1].clip_height = result->height; |
572 | } |
585 | } |
|
|
586 | |
573 | if (target->rs[Rs_blendtype]) |
587 | if (target->rs[Rs_blendtype]) |
574 | { |
588 | { |
575 | layers[1].merge_scanlines = blend_scanlines_name2func (target->rs[Rs_blendtype]); |
589 | layers[1].merge_scanlines = blend_scanlines_name2func (target->rs[Rs_blendtype]); |
576 | if (layers[1].merge_scanlines == NULL) |
590 | if (layers[1].merge_scanlines == NULL) |
577 | layers[1].merge_scanlines = alphablend_scanlines; |
591 | layers[1].merge_scanlines = alphablend_scanlines; |
578 | } |
592 | } |
|
|
593 | |
579 | ASImage *tmp = merge_layers (target->asv, layers, 2, target_width, target_height, |
594 | ASImage *tmp = merge_layers (target->asv, layers, 2, target_width, target_height, |
580 | ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT); |
595 | ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT); |
|
|
596 | |
581 | if (tmp) |
597 | if (tmp) |
582 | { |
598 | { |
583 | if (result != original_asim) |
599 | if (result != original_asim) |
584 | destroy_asimage (&result); |
600 | destroy_asimage (&result); |
|
|
601 | |
585 | result = tmp; |
602 | result = tmp; |
586 | } |
603 | } |
|
|
604 | |
587 | free (layers); |
605 | free (layers); |
588 | } |
606 | } |
589 | } |
607 | } |
590 | TIMING_TEST_PRINT_RESULT (asim); |
608 | TIMING_TEST_PRINT_RESULT (asim); |
591 | |
609 | |
… | |
… | |
653 | bool |
671 | bool |
654 | bgPixmap_t::set_file (const char *file) |
672 | bgPixmap_t::set_file (const char *file) |
655 | { |
673 | { |
656 | char *f; |
674 | char *f; |
657 | |
675 | |
658 | assert (file != NULL); |
676 | assert (file); |
659 | |
677 | |
660 | if (*file != '\0') |
678 | if (*file) |
661 | { |
679 | { |
662 | # ifdef HAVE_AFTERIMAGE |
680 | # ifdef HAVE_AFTERIMAGE |
663 | if (target->asimman == NULL) |
681 | if (target->asimman == NULL) |
664 | target->asimman = create_generic_imageman (target->rs[Rs_path]); |
682 | target->asimman = create_generic_imageman (target->rs[Rs_path]); |
|
|
683 | |
665 | if ((f = strchr (file, ';')) == NULL) |
684 | if ((f = strchr (file, ';')) == NULL) |
666 | original_asim = get_asimage (target->asimman, file, 0xFFFFFFFF, 100); |
685 | original_asim = get_asimage (target->asimman, file, 0xFFFFFFFF, 100); |
667 | else |
686 | else |
668 | { |
687 | { |
669 | size_t len = f - file; |
688 | size_t len = f - file; |
670 | f = (char *)malloc (len + 1); |
689 | f = (char *)malloc (len + 1); |
671 | strncpy (f, file, len); |
690 | memcpy (f, file, len); |
672 | f[len] = '\0'; |
691 | f[len] = '\0'; |
673 | original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); |
692 | original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); |
674 | free (f); |
693 | free (f); |
675 | } |
694 | } |
|
|
695 | |
676 | return (original_asim != NULL); |
696 | return original_asim; |
677 | # endif |
697 | # endif |
678 | } |
698 | } |
|
|
699 | |
679 | return false; |
700 | return false; |
680 | } |
701 | } |
681 | |
702 | |
682 | # endif /* BG_IMAGE_FROM_FILE */ |
703 | # endif /* BG_IMAGE_FROM_FILE */ |
683 | |
704 | |
… | |
… | |
688 | if (!(flags & isTransparent)) |
709 | if (!(flags & isTransparent)) |
689 | { |
710 | { |
690 | flags |= isTransparent; |
711 | flags |= isTransparent; |
691 | return true; |
712 | return true; |
692 | } |
713 | } |
|
|
714 | |
693 | return false; |
715 | return false; |
694 | } |
716 | } |
695 | |
717 | |
696 | bool |
718 | bool |
697 | bgPixmap_t::set_blur_radius (const char *geom) |
719 | bgPixmap_t::set_blur_radius (const char *geom) |
… | |
… | |
778 | unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade); |
800 | unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade); |
779 | tint = new_tint; |
801 | tint = new_tint; |
780 | flags = (flags & ~tintFlags) | new_flags | tintSet; |
802 | flags = (flags & ~tintFlags) | new_flags | tintSet; |
781 | return true; |
803 | return true; |
782 | } |
804 | } |
|
|
805 | |
783 | return false; |
806 | return false; |
784 | } |
807 | } |
785 | |
808 | |
786 | bool |
809 | bool |
787 | bgPixmap_t::unset_tint () |
810 | bgPixmap_t::unset_tint () |
… | |
… | |
791 | if (new_flags != (flags & tintFlags)) |
814 | if (new_flags != (flags & tintFlags)) |
792 | { |
815 | { |
793 | flags = (flags&~tintFlags)|new_flags; |
816 | flags = (flags&~tintFlags)|new_flags; |
794 | return true; |
817 | return true; |
795 | } |
818 | } |
|
|
819 | |
796 | return false; |
820 | return false; |
797 | } |
821 | } |
798 | |
822 | |
799 | bool |
823 | bool |
800 | bgPixmap_t::set_shade (const char *shade_str) |
824 | bgPixmap_t::set_shade (const char *shade_str) |
801 | { |
825 | { |
802 | int new_shade = (shade_str) ? atoi (shade_str) : 0; |
826 | int new_shade = (shade_str) ? atoi (shade_str) : 0; |
803 | |
827 | |
804 | if (new_shade < 0 && new_shade > -100) |
828 | if (new_shade < 0 && new_shade > -100) |
805 | new_shade = 200 - (100 + new_shade); |
829 | new_shade = 200 - (100 + new_shade); |
806 | else if (new_shade == 100) |
830 | else if (new_shade == 100) |
807 | new_shade = 0; |
831 | new_shade = 0; |
808 | |
832 | |
809 | if (new_shade != shade) |
833 | if (new_shade != shade) |
810 | { |
834 | { |
811 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
835 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
812 | shade = new_shade; |
836 | shade = new_shade; |
813 | flags = (flags & (~tintFlags | tintSet)) | new_flags; |
837 | flags = (flags & (~tintFlags | tintSet)) | new_flags; |
814 | return true; |
838 | return true; |
815 | } |
839 | } |
|
|
840 | |
816 | return false; |
841 | return false; |
817 | } |
842 | } |
818 | |
843 | |
819 | /* make_transparency_pixmap() |
844 | /* make_transparency_pixmap() |
820 | * Builds a pixmap sized the same as terminal window, with depth same as the root window |
845 | * Builds a pixmap sized the same as terminal window, with depth same as the root window |
… | |
… | |
896 | XGrabServer (dpy); |
921 | XGrabServer (dpy); |
897 | XMapRaised (dpy, src); |
922 | XMapRaised (dpy, src); |
898 | XSync (dpy, False); |
923 | XSync (dpy, False); |
899 | |
924 | |
900 | /* XSync should get window where it's properly exposed, |
925 | /* XSync should get window where it's properly exposed, |
901 | * but to be on the safe side - let's check for the actuall event to arrive : */ |
926 | * but to be on the safe side - let's check for the actual event to arrive : */ |
902 | while (XCheckWindowEvent (dpy, src, ExposureMask, &event)) |
927 | while (XCheckWindowEvent (dpy, src, ExposureMask, &event)) |
903 | ++ev_count; |
928 | ++ev_count; |
904 | |
929 | |
905 | if (ev_count > 0); |
930 | if (ev_count > 0); |
906 | { |
931 | { |
… | |
… | |
910 | { |
935 | { |
911 | XCopyArea (dpy, src, tiled_root_pmap, gc, 0, 0, window_width, window_height, 0, 0); |
936 | XCopyArea (dpy, src, tiled_root_pmap, gc, 0, 0, window_width, window_height, 0, 0); |
912 | success = true; |
937 | success = true; |
913 | } |
938 | } |
914 | } |
939 | } |
|
|
940 | |
915 | XDestroyWindow (dpy, src); |
941 | XDestroyWindow (dpy, src); |
916 | XUngrabServer (dpy); |
942 | XUngrabServer (dpy); |
917 | //fprintf (stderr, "%s:%d: ev_count = %d\n", __FUNCTION__, __LINE__, ev_count); |
943 | //fprintf (stderr, "%s:%d: ev_count = %d\n", __FUNCTION__, __LINE__, ev_count); |
918 | } |
944 | } |
919 | |
945 | |
… | |
… | |
983 | { |
1009 | { |
984 | c.r = (c.r * shade) / 100; |
1010 | c.r = (c.r * shade) / 100; |
985 | c.g = (c.g * shade) / 100; |
1011 | c.g = (c.g * shade) / 100; |
986 | c.b = (c.b * shade) / 100; |
1012 | c.b = (c.b * shade) / 100; |
987 | } |
1013 | } |
988 | else if( shade > 100 && shade < 200) |
1014 | else if (shade > 100 && shade < 200) |
989 | { |
1015 | { |
990 | c.r = (c.r * (200 - shade)) / 100; |
1016 | c.r = (c.r * (200 - shade)) / 100; |
991 | c.g = (c.g * (200 - shade)) / 100; |
1017 | c.g = (c.g * (200 - shade)) / 100; |
992 | c.b = (c.b * (200 - shade)) / 100; |
1018 | c.b = (c.b * (200 - shade)) / 100; |
993 | } |
1019 | } |
… | |
… | |
1039 | mask_c.blue = 0xffff - c.b; |
1065 | mask_c.blue = 0xffff - c.b; |
1040 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
1066 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
1041 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); |
1067 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); |
1042 | result |= transpPmapTinted; |
1068 | result |= transpPmapTinted; |
1043 | } |
1069 | } |
|
|
1070 | |
1044 | XRenderFreePicture (dpy, mask_pic); |
1071 | XRenderFreePicture (dpy, mask_pic); |
1045 | XRenderFreePicture (dpy, overlay_pic); |
1072 | XRenderFreePicture (dpy, overlay_pic); |
1046 | XRenderFreePicture (dpy, back_pic); |
1073 | XRenderFreePicture (dpy, back_pic); |
1047 | # if DO_TIMING_TEST |
1074 | # if DO_TIMING_TEST |
1048 | XSync (dpy, False); |
1075 | XSync (dpy, False); |
… | |
… | |
1070 | } |
1097 | } |
1071 | |
1098 | |
1072 | bool |
1099 | bool |
1073 | bgPixmap_t::set_root_pixmap () |
1100 | bgPixmap_t::set_root_pixmap () |
1074 | { |
1101 | { |
1075 | Pixmap new_root_pixmap = None; |
|
|
1076 | |
|
|
1077 | new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); |
1102 | Pixmap new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); |
1078 | if (new_root_pixmap == None) |
1103 | if (new_root_pixmap == None) |
1079 | new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); |
1104 | new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); |
1080 | |
1105 | |
1081 | if (new_root_pixmap != root_pixmap) |
1106 | if (new_root_pixmap != root_pixmap) |
1082 | { |
1107 | { |
1083 | root_pixmap = new_root_pixmap; |
1108 | root_pixmap = new_root_pixmap; |
1084 | return true; |
1109 | return true; |
1085 | } |
1110 | } |
|
|
1111 | |
1086 | return false; |
1112 | return false; |
1087 | } |
1113 | } |
1088 | # endif /* ENABLE_TRANSPARENCY */ |
1114 | # endif /* ENABLE_TRANSPARENCY */ |
1089 | |
1115 | |
1090 | # ifndef HAVE_AFTERIMAGE |
1116 | # ifndef HAVE_AFTERIMAGE |
1091 | static void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm); |
1117 | static void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm); |
1092 | # endif |
1118 | # endif |
1093 | |
|
|
1094 | |
1119 | |
1095 | bool |
1120 | bool |
1096 | bgPixmap_t::render () |
1121 | bgPixmap_t::render () |
1097 | { |
1122 | { |
1098 | unsigned long background_flags = 0; |
1123 | unsigned long background_flags = 0; |
… | |
… | |
1180 | ShadeXImage (target, result, shade, c.r, c.g, c.b); |
1205 | ShadeXImage (target, result, shade, c.r, c.g, c.b); |
1181 | } |
1206 | } |
1182 | } |
1207 | } |
1183 | # endif /* HAVE_AFTERIMAGE */ |
1208 | # endif /* HAVE_AFTERIMAGE */ |
1184 | |
1209 | |
1185 | if (result != NULL) |
1210 | if (result) |
1186 | { |
1211 | { |
1187 | GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); |
1212 | GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); |
|
|
1213 | |
1188 | if (gc) |
1214 | if (gc) |
1189 | { |
1215 | { |
1190 | if (/*pmap_depth != target->depth &&*/ pixmap != None) |
1216 | if (/*pmap_depth != target->depth &&*/ pixmap != None) |
1191 | { |
1217 | { |
1192 | XFreePixmap (target->dpy, pixmap); |
1218 | XFreePixmap (target->dpy, pixmap); |
1193 | pixmap = None; |
1219 | pixmap = None; |
1194 | } |
1220 | } |
|
|
1221 | |
1195 | if (pixmap == None) |
1222 | if (pixmap == None) |
1196 | { |
1223 | { |
1197 | pixmap = XCreatePixmap (target->dpy, target->vt, result->width, result->height, target->depth); |
1224 | pixmap = XCreatePixmap (target->dpy, target->vt, result->width, result->height, target->depth); |
1198 | pmap_width = result->width; |
1225 | pmap_width = result->width; |
1199 | pmap_height = result->height; |
1226 | pmap_height = result->height; |
1200 | pmap_depth = target->depth; |
1227 | pmap_depth = target->depth; |
1201 | } |
1228 | } |
|
|
1229 | |
1202 | if (pmap_depth != result->depth) |
1230 | if (pmap_depth != result->depth) |
1203 | { |
1231 | { |
1204 | /* Bad Match error will ensue ! stupid X !!!! */ |
1232 | /* Bad Match error will ensue ! stupid X !!!! */ |
1205 | if( result->depth == 24 && pmap_depth == 32) |
1233 | if (result->depth == 24 && pmap_depth == 32) |
1206 | result->depth = 32; |
1234 | result->depth = 32; |
1207 | else if( result->depth == 32 && pmap_depth == 24) |
1235 | else if (result->depth == 32 && pmap_depth == 24) |
1208 | result->depth = 24; |
1236 | result->depth = 24; |
1209 | else |
1237 | else |
1210 | { |
1238 | { |
1211 | /* TODO: implement image recoding */ |
1239 | /* TODO: implement image recoding */ |
1212 | } |
1240 | } |
1213 | } |
1241 | } |
|
|
1242 | |
1214 | if (pmap_depth == result->depth) |
1243 | if (pmap_depth == result->depth) |
1215 | XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
1244 | XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
|
|
1245 | |
1216 | XFreeGC (target->dpy, gc); |
1246 | XFreeGC (target->dpy, gc); |
1217 | flags = flags & ~isInvalid; |
1247 | flags = flags & ~isInvalid; |
1218 | } |
1248 | } |
|
|
1249 | |
1219 | XDestroyImage (result); |
1250 | XDestroyImage (result); |
1220 | } |
1251 | } |
1221 | |
1252 | |
1222 | if (flags & isInvalid) |
1253 | if (flags & isInvalid) |
1223 | { |
1254 | { |
… | |
… | |
1227 | pixmap = None; |
1258 | pixmap = None; |
1228 | } |
1259 | } |
1229 | } |
1260 | } |
1230 | |
1261 | |
1231 | apply (); |
1262 | apply (); |
|
|
1263 | |
|
|
1264 | XSync (target->dpy, False); |
|
|
1265 | valid_since = ev::now (); |
1232 | |
1266 | |
1233 | TIMING_TEST_PRINT_RESULT (tp); |
1267 | TIMING_TEST_PRINT_RESULT (tp); |
1234 | |
1268 | |
1235 | return true; |
1269 | return true; |
1236 | } |
1270 | } |
… | |
… | |
1249 | } |
1283 | } |
1250 | return false; |
1284 | return false; |
1251 | } |
1285 | } |
1252 | |
1286 | |
1253 | void |
1287 | void |
1254 | bgPixmap_t::apply() |
1288 | bgPixmap_t::apply () |
1255 | { |
1289 | { |
1256 | if (target) |
1290 | if (target) |
1257 | { |
1291 | { |
1258 | flags &= ~isVtOrigin; |
1292 | flags &= ~isVtOrigin; |
1259 | if (pixmap != None) |
1293 | if (pixmap != None) |