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