… | |
… | |
55 | * background not covered by the image is filled with the |
55 | * background not covered by the image is filled with the |
56 | * current background color. |
56 | * current background color. |
57 | * hscale Scale horizontally, tile vertically ? |
57 | * hscale Scale horizontally, tile vertically ? |
58 | * vscale Tile horizontally, scale vertically ? |
58 | * vscale Tile horizontally, scale vertically ? |
59 | * scale Scale both up and down |
59 | * scale Scale both up and down |
60 | * auto Same as 100x100+50+50 |
|
|
61 | */ |
60 | */ |
62 | |
61 | |
63 | #ifdef HAVE_BG_PIXMAP |
62 | #ifdef HAVE_BG_PIXMAP |
64 | void |
63 | void |
65 | rxvt_term::bg_destroy () |
64 | rxvt_term::bg_destroy () |
… | |
… | |
260 | |
259 | |
261 | for (int i = 0; arr[i]; i++) |
260 | for (int i = 0; arr[i]; i++) |
262 | { |
261 | { |
263 | if (!strcasecmp (arr[i], "tile")) |
262 | if (!strcasecmp (arr[i], "tile")) |
264 | { |
263 | { |
|
|
264 | new_flags |= BG_TILE; |
265 | w = h = noScale; |
265 | w = h = noScale; |
266 | geom_flags |= WidthValue|HeightValue; |
266 | geom_flags |= WidthValue|HeightValue; |
267 | } |
267 | } |
268 | else if (!strcasecmp (arr[i], "propscale")) |
268 | else if (!strcasecmp (arr[i], "propscale")) |
269 | { |
269 | { |
… | |
… | |
288 | if (h == 0) h = windowScale; |
288 | if (h == 0) h = windowScale; |
289 | if (w == 0) w = windowScale; |
289 | if (w == 0) w = windowScale; |
290 | |
290 | |
291 | geom_flags |= WidthValue|HeightValue; |
291 | geom_flags |= WidthValue|HeightValue; |
292 | } |
292 | } |
293 | else if (!strcasecmp (arr[i], "auto")) |
|
|
294 | { |
|
|
295 | w = h = windowScale; |
|
|
296 | x = y = centerAlign; |
|
|
297 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
|
|
298 | } |
|
|
299 | else if (!strcasecmp (arr[i], "root")) |
293 | else if (!strcasecmp (arr[i], "root")) |
300 | { |
294 | { |
301 | new_flags |= BG_ROOT_ALIGN; |
295 | new_flags |= BG_TILE|BG_ROOT_ALIGN; |
302 | w = h = noScale; |
296 | w = h = noScale; |
303 | geom_flags |= WidthValue|HeightValue; |
297 | geom_flags |= WidthValue|HeightValue; |
304 | } |
298 | } |
305 | } /* done parsing ops */ |
299 | } /* done parsing ops */ |
306 | |
300 | |
… | |
… | |
353 | x = make_align_position (h_align, target_width, w); |
347 | x = make_align_position (h_align, target_width, w); |
354 | y = make_align_position (v_align, target_height, h); |
348 | y = make_align_position (v_align, target_height, h); |
355 | } |
349 | } |
356 | |
350 | |
357 | bg_flags &= ~BG_IS_SIZE_SENSITIVE; |
351 | bg_flags &= ~BG_IS_SIZE_SENSITIVE; |
|
|
352 | if (!(bg_flags & BG_TILE) |
358 | if ((bg_flags & BG_PROP_SCALE) || h_scale || v_scale |
353 | || (bg_flags & BG_PROP_SCALE) || h_scale || v_scale |
359 | || (!(bg_flags & BG_ROOT_ALIGN) && (h_align || v_align)) |
354 | || (!(bg_flags & BG_ROOT_ALIGN) && (h_align || v_align)) |
360 | || w > target_width || h > target_height) |
355 | || w > target_width || h > target_height) |
361 | bg_flags |= BG_IS_SIZE_SENSITIVE; |
356 | bg_flags |= BG_IS_SIZE_SENSITIVE; |
362 | } |
357 | } |
363 | |
358 | |
… | |
… | |
455 | 100, ASIMAGE_QUALITY_DEFAULT); |
450 | 100, ASIMAGE_QUALITY_DEFAULT); |
456 | } |
451 | } |
457 | |
452 | |
458 | if (background == NULL) |
453 | if (background == NULL) |
459 | { |
454 | { |
460 | if (h_scale == 0 || v_scale == 0) |
455 | if (bg_flags & BG_TILE) |
461 | { |
456 | { |
462 | /* if tiling - pixmap has to be sized exactly as the image, |
457 | /* if tiling - pixmap has to be sized exactly as the image, |
463 | but there is no need to make it bigger than the window! */ |
458 | but there is no need to make it bigger than the window! */ |
464 | new_pmap_width = min (result->width, target_width); |
459 | new_pmap_width = min (result->width, target_width); |
465 | new_pmap_height = min (result->height, target_height); |
460 | new_pmap_height = min (result->height, target_height); |
… | |
… | |
490 | layers[0].clip_width = target_width; |
485 | layers[0].clip_width = target_width; |
491 | layers[0].clip_height = target_height; |
486 | layers[0].clip_height = target_height; |
492 | layers[0].tint = background_tint; |
487 | layers[0].tint = background_tint; |
493 | layers[1].im = result; |
488 | layers[1].im = result; |
494 | |
489 | |
495 | if (h_scale == 0 || v_scale == 0) |
490 | if (bg_flags & BG_TILE) |
496 | { |
491 | { |
497 | /* tile horizontally */ |
492 | /* tile horizontally */ |
498 | while (x > 0) x -= (int)result->width; |
493 | while (x > 0) x -= (int)result->width; |
499 | layers[1].dst_x = x; |
494 | layers[1].dst_x = x; |
500 | layers[1].clip_width = result->width+target_width; |
495 | layers[1].clip_width = result->width+target_width; |
… | |
… | |
504 | /* clip horizontally */ |
499 | /* clip horizontally */ |
505 | layers[1].dst_x = x; |
500 | layers[1].dst_x = x; |
506 | layers[1].clip_width = result->width; |
501 | layers[1].clip_width = result->width; |
507 | } |
502 | } |
508 | |
503 | |
509 | if (h_scale == 0 || v_scale == 0) |
504 | if (bg_flags & BG_TILE) |
510 | { |
505 | { |
511 | while (y > 0) y -= (int)result->height; |
506 | while (y > 0) y -= (int)result->height; |
512 | layers[1].dst_y = y; |
507 | layers[1].dst_y = y; |
513 | layers[1].clip_height = result->height + target_height; |
508 | layers[1].clip_height = result->height + target_height; |
514 | } |
509 | } |
… | |
… | |
564 | |
559 | |
565 | int src_x = 0, src_y = 0, dst_x = 0, dst_y = 0; |
560 | int src_x = 0, src_y = 0, dst_x = 0, dst_y = 0; |
566 | int dst_width = result->width, dst_height = result->height; |
561 | int dst_width = result->width, dst_height = result->height; |
567 | if (background == NULL) |
562 | if (background == NULL) |
568 | { |
563 | { |
569 | if (!(h_scale == 0 || v_scale == 0)) |
564 | if (!(bg_flags & BG_TILE)) |
570 | { |
565 | { |
571 | src_x = make_clip_rectangle (x, result->width , new_pmap_width , dst_x, dst_width ); |
566 | src_x = make_clip_rectangle (x, result->width , new_pmap_width , dst_x, dst_width ); |
572 | src_y = make_clip_rectangle (y, result->height, new_pmap_height, dst_y, dst_height); |
567 | src_y = make_clip_rectangle (y, result->height, new_pmap_height, dst_y, dst_height); |
573 | } |
568 | } |
574 | |
569 | |
… | |
… | |
620 | else if (depth == 15 || depth == 16) |
615 | else if (depth == 15 || depth == 16) |
621 | bytes_per_pixel = 2; |
616 | bytes_per_pixel = 2; |
622 | else |
617 | else |
623 | return false; |
618 | return false; |
624 | |
619 | |
625 | width_r = rxvt_popcount (visual->red_mask); |
620 | width_r = ecb_popcount32 (visual->red_mask); |
626 | width_g = rxvt_popcount (visual->green_mask); |
621 | width_g = ecb_popcount32 (visual->green_mask); |
627 | width_b = rxvt_popcount (visual->blue_mask); |
622 | width_b = ecb_popcount32 (visual->blue_mask); |
628 | |
623 | |
629 | if (width_r > 8 || width_g > 8 || width_b > 8) |
624 | if (width_r > 8 || width_g > 8 || width_b > 8) |
630 | return false; |
625 | return false; |
631 | |
626 | |
632 | sh_r = rxvt_ctz (visual->red_mask); |
627 | sh_r = ecb_ctz32 (visual->red_mask); |
633 | sh_g = rxvt_ctz (visual->green_mask); |
628 | sh_g = ecb_ctz32 (visual->green_mask); |
634 | sh_b = rxvt_ctz (visual->blue_mask); |
629 | sh_b = ecb_ctz32 (visual->blue_mask); |
635 | |
630 | |
636 | if (width > INT_MAX / height / bytes_per_pixel) |
631 | if (width > INT_MAX / height / bytes_per_pixel) |
637 | return false; |
632 | return false; |
638 | |
633 | |
639 | data = (char *)malloc (width * height * bytes_per_pixel); |
634 | data = (char *)malloc (width * height * bytes_per_pixel); |
… | |
… | |
646 | { |
641 | { |
647 | free (data); |
642 | free (data); |
648 | return false; |
643 | return false; |
649 | } |
644 | } |
650 | |
645 | |
651 | ximage->byte_order = byteorder::big_endian () ? MSBFirst : LSBFirst; |
646 | ximage->byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; |
652 | |
647 | |
653 | rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
648 | rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
654 | channels = gdk_pixbuf_get_n_channels (pixbuf); |
649 | channels = gdk_pixbuf_get_n_channels (pixbuf); |
655 | row = gdk_pixbuf_get_pixels (pixbuf) + src_y * rowstride + src_x * channels; |
650 | row = gdk_pixbuf_get_pixels (pixbuf) + src_y * rowstride + src_x * channels; |
656 | line = data; |
651 | line = data; |
… | |
… | |
728 | if (!result) |
723 | if (!result) |
729 | return false; |
724 | return false; |
730 | |
725 | |
731 | bool ret = false; |
726 | bool ret = false; |
732 | |
727 | |
733 | XGCValues gcv; |
728 | XGCValues gcv; |
734 | GC gc; |
729 | GC gc; |
735 | Pixmap root_pmap; |
730 | Pixmap root_pmap; |
736 | |
731 | |
737 | image_width = gdk_pixbuf_get_width (result); |
732 | image_width = gdk_pixbuf_get_width (result); |
738 | image_height = gdk_pixbuf_get_height (result); |
733 | image_height = gdk_pixbuf_get_height (result); |
739 | |
734 | |
740 | if (tr_flags) |
735 | if (tr_flags) |
741 | { |
736 | { |
742 | root_pmap = bg_pixmap; |
737 | root_pmap = bg_pixmap; |
743 | bg_pixmap = None; |
738 | bg_pixmap = None; |
|
|
739 | } |
|
|
740 | else |
|
|
741 | { |
|
|
742 | if (bg_flags & BG_TILE) |
744 | } |
743 | { |
745 | else |
|
|
746 | { |
|
|
747 | if (h_scale == 0 || v_scale == 0) |
|
|
748 | { |
|
|
749 | new_pmap_width = min (image_width, target_width); |
744 | new_pmap_width = min (image_width, target_width); |
750 | new_pmap_height = min (image_height, target_height); |
745 | new_pmap_height = min (image_height, target_height); |
751 | } |
746 | } |
752 | } |
747 | } |
753 | |
748 | |
754 | if (bg_pixmap == None |
749 | if (bg_pixmap == None |
755 | || bg_pmap_width != new_pmap_width |
750 | || bg_pmap_width != new_pmap_width |
756 | || bg_pmap_height != new_pmap_height) |
751 | || bg_pmap_height != new_pmap_height) |
757 | { |
752 | { |
758 | if (bg_pixmap) |
753 | if (bg_pixmap) |
759 | XFreePixmap (dpy, bg_pixmap); |
754 | XFreePixmap (dpy, bg_pixmap); |
760 | bg_pixmap = XCreatePixmap (dpy, vt, new_pmap_width, new_pmap_height, depth); |
755 | bg_pixmap = XCreatePixmap (dpy, vt, new_pmap_width, new_pmap_height, depth); |
761 | bg_pmap_width = new_pmap_width; |
756 | bg_pmap_width = new_pmap_width; |
762 | bg_pmap_height = new_pmap_height; |
757 | bg_pmap_height = new_pmap_height; |
763 | } |
758 | } |
764 | |
759 | |
765 | gcv.foreground = pix_colors[Color_bg]; |
760 | gcv.foreground = pix_colors[Color_bg]; |
766 | gc = XCreateGC (dpy, vt, GCForeground, &gcv); |
761 | gc = XCreateGC (dpy, vt, GCForeground, &gcv); |
767 | |
762 | |
768 | if (h_scale == 0 || v_scale == 0) |
763 | if (gc) |
|
|
764 | { |
|
|
765 | if (bg_flags & BG_TILE) |
769 | { |
766 | { |
770 | Pixmap tile = XCreatePixmap (dpy, vt, image_width, image_height, depth); |
767 | Pixmap tile = XCreatePixmap (dpy, vt, image_width, image_height, depth); |
771 | pixbuf_to_pixmap (result, tile, gc, |
768 | pixbuf_to_pixmap (result, tile, gc, |
772 | 0, 0, |
769 | 0, 0, |
773 | 0, 0, |
770 | 0, 0, |
… | |
… | |
817 | Pixmap mask_pmap = XCreatePixmap (dpy, vt, 1, 1, 8); |
814 | Pixmap mask_pmap = XCreatePixmap (dpy, vt, 1, 1, 8); |
818 | XRenderPictFormat *mask_format = XRenderFindStandardFormat (dpy, PictStandardA8); |
815 | XRenderPictFormat *mask_format = XRenderFindStandardFormat (dpy, PictStandardA8); |
819 | Picture mask = XRenderCreatePicture (dpy, mask_pmap, mask_format, CPRepeat, &pa); |
816 | Picture mask = XRenderCreatePicture (dpy, mask_pmap, mask_format, CPRepeat, &pa); |
820 | XFreePixmap (dpy, mask_pmap); |
817 | XFreePixmap (dpy, mask_pmap); |
821 | |
818 | |
822 | if (src && dst && mask) |
|
|
823 | { |
|
|
824 | XRenderColor mask_c; |
819 | XRenderColor mask_c; |
825 | |
820 | |
826 | mask_c.alpha = 0x8000; |
821 | mask_c.alpha = 0x8000; |
827 | mask_c.red = 0; |
822 | mask_c.red = 0; |
828 | mask_c.green = 0; |
823 | mask_c.green = 0; |
829 | mask_c.blue = 0; |
824 | mask_c.blue = 0; |
830 | XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1); |
825 | XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1); |
831 | XRenderComposite (dpy, PictOpOver, src, mask, dst, 0, 0, 0, 0, 0, 0, target_width, target_height); |
826 | XRenderComposite (dpy, PictOpOver, src, mask, dst, 0, 0, 0, 0, 0, 0, target_width, target_height); |
832 | } |
|
|
833 | |
827 | |
834 | XRenderFreePicture (dpy, src); |
828 | XRenderFreePicture (dpy, src); |
835 | XRenderFreePicture (dpy, dst); |
829 | XRenderFreePicture (dpy, dst); |
836 | XRenderFreePicture (dpy, mask); |
830 | XRenderFreePicture (dpy, mask); |
837 | |
|
|
838 | XFreePixmap (dpy, root_pmap); |
|
|
839 | } |
831 | } |
840 | #endif |
832 | #endif |
841 | |
833 | |
842 | if (result != pixbuf) |
|
|
843 | g_object_unref (result); |
|
|
844 | |
|
|
845 | XFreeGC (dpy, gc); |
834 | XFreeGC (dpy, gc); |
846 | |
835 | |
847 | ret = true; |
836 | ret = true; |
|
|
837 | } |
|
|
838 | |
|
|
839 | if (result != pixbuf) |
|
|
840 | g_object_unref (result); |
|
|
841 | |
|
|
842 | if (tr_flags) |
|
|
843 | XFreePixmap (dpy, root_pmap); |
848 | |
844 | |
849 | return ret; |
845 | return ret; |
850 | } |
846 | } |
851 | # endif /* HAVE_PIXBUF */ |
847 | # endif /* HAVE_PIXBUF */ |
852 | |
848 | |
… | |
… | |
1036 | XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); |
1032 | XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); |
1037 | |
1033 | |
1038 | Picture src = XRenderCreatePicture (dpy, pixmap, format, 0, &pa); |
1034 | Picture src = XRenderCreatePicture (dpy, pixmap, format, 0, &pa); |
1039 | Picture dst = XRenderCreatePicture (dpy, pixmap, format, 0, &pa); |
1035 | Picture dst = XRenderCreatePicture (dpy, pixmap, format, 0, &pa); |
1040 | |
1036 | |
1041 | if (kernel && params && src && dst) |
1037 | if (kernel && params) |
1042 | { |
1038 | { |
1043 | if (h_blurRadius) |
1039 | if (h_blurRadius) |
1044 | { |
1040 | { |
1045 | size = h_blurRadius * 2 + 1; |
1041 | size = h_blurRadius * 2 + 1; |
1046 | get_gaussian_kernel (h_blurRadius, size, kernel, params); |
1042 | get_gaussian_kernel (h_blurRadius, size, kernel, params); |
… | |
… | |
1146 | pa.component_alpha = True; |
1142 | pa.component_alpha = True; |
1147 | Pixmap mask_pmap = XCreatePixmap (dpy, pixmap, 1, 1, 32); |
1143 | Pixmap mask_pmap = XCreatePixmap (dpy, pixmap, 1, 1, 32); |
1148 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat | CPComponentAlpha, &pa); |
1144 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat | CPComponentAlpha, &pa); |
1149 | XFreePixmap (dpy, mask_pmap); |
1145 | XFreePixmap (dpy, mask_pmap); |
1150 | |
1146 | |
1151 | if (mask_pic && overlay_pic && back_pic) |
|
|
1152 | { |
|
|
1153 | XRenderColor mask_c; |
1147 | XRenderColor mask_c; |
1154 | |
1148 | |
1155 | mask_c.alpha = 0xffff; |
1149 | mask_c.alpha = 0xffff; |
1156 | mask_c.red = |
1150 | mask_c.red = |
1157 | mask_c.green = |
1151 | mask_c.green = |
1158 | mask_c.blue = 0; |
1152 | mask_c.blue = 0; |
|
|
1153 | XRenderFillRectangle (dpy, PictOpSrc, overlay_pic, &mask_c, 0, 0, 1, 1); |
|
|
1154 | |
|
|
1155 | mask_c.alpha = 0; |
|
|
1156 | mask_c.red = 0xffff - c.r; |
|
|
1157 | mask_c.green = 0xffff - c.g; |
|
|
1158 | mask_c.blue = 0xffff - c.b; |
|
|
1159 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
|
|
1160 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, width, height); |
|
|
1161 | |
|
|
1162 | if (shade > 100) |
|
|
1163 | { |
|
|
1164 | mask_c.red = mask_c.green = mask_c.blue = 0xffff * (shade - 100) / 100; |
|
|
1165 | mask_c.alpha = 0; |
1159 | XRenderFillRectangle (dpy, PictOpSrc, overlay_pic, &mask_c, 0, 0, 1, 1); |
1166 | XRenderFillRectangle (dpy, PictOpSrc, overlay_pic, &mask_c, 0, 0, 1, 1); |
1160 | |
1167 | |
1161 | mask_c.alpha = 0; |
|
|
1162 | mask_c.red = 0xffff - c.r; |
|
|
1163 | mask_c.green = 0xffff - c.g; |
|
|
1164 | mask_c.blue = 0xffff - c.b; |
|
|
1165 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
|
|
1166 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, width, height); |
|
|
1167 | |
|
|
1168 | if (shade > 100) |
|
|
1169 | { |
|
|
1170 | mask_c.red = mask_c.green = mask_c.blue = 0xffff * (shade - 100) / 100; |
|
|
1171 | mask_c.alpha = 0; |
|
|
1172 | XRenderFillRectangle (dpy, PictOpSrc, overlay_pic, &mask_c, 0, 0, 1, 1); |
|
|
1173 | |
|
|
1174 | XRenderComposite (dpy, PictOpOver, overlay_pic, None, back_pic, 0, 0, 0, 0, 0, 0, width, height); |
1168 | XRenderComposite (dpy, PictOpOver, overlay_pic, None, back_pic, 0, 0, 0, 0, 0, 0, width, height); |
1175 | } |
1169 | } |
1176 | |
1170 | |
1177 | ret = true; |
1171 | ret = true; |
1178 | } |
|
|
1179 | |
1172 | |
1180 | XRenderFreePicture (dpy, mask_pic); |
1173 | XRenderFreePicture (dpy, mask_pic); |
1181 | XRenderFreePicture (dpy, overlay_pic); |
1174 | XRenderFreePicture (dpy, overlay_pic); |
1182 | XRenderFreePicture (dpy, back_pic); |
1175 | XRenderFreePicture (dpy, back_pic); |
1183 | # endif |
1176 | # endif |
… | |
… | |
1238 | if (root_pixmap != None && root_depth != depth) |
1231 | if (root_pixmap != None && root_depth != depth) |
1239 | { |
1232 | { |
1240 | #if XRENDER |
1233 | #if XRENDER |
1241 | if (bg_flags & BG_HAS_RENDER) |
1234 | if (bg_flags & BG_HAS_RENDER) |
1242 | { |
1235 | { |
|
|
1236 | recoded_root_pmap = XCreatePixmap (dpy, vt, root_pmap_width, root_pmap_height, depth); |
|
|
1237 | |
1243 | XRenderPictureAttributes pa; |
1238 | XRenderPictureAttributes pa; |
1244 | |
1239 | |
1245 | XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen)); |
1240 | XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen)); |
1246 | Picture src = XRenderCreatePicture (dpy, root_pixmap, src_format, 0, &pa); |
1241 | Picture src = XRenderCreatePicture (dpy, root_pixmap, src_format, 0, &pa); |
1247 | |
1242 | |
1248 | recoded_root_pmap = XCreatePixmap (dpy, vt, root_pmap_width, root_pmap_height, depth); |
|
|
1249 | XRenderPictFormat *dst_format = XRenderFindVisualFormat (dpy, visual); |
1243 | XRenderPictFormat *dst_format = XRenderFindVisualFormat (dpy, visual); |
1250 | Picture dst = XRenderCreatePicture (dpy, recoded_root_pmap, dst_format, 0, &pa); |
1244 | Picture dst = XRenderCreatePicture (dpy, recoded_root_pmap, dst_format, 0, &pa); |
1251 | |
1245 | |
1252 | if (src && dst) |
|
|
1253 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, root_pmap_width, root_pmap_height); |
1246 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, root_pmap_width, root_pmap_height); |
1254 | else |
|
|
1255 | { |
|
|
1256 | XFreePixmap (dpy, recoded_root_pmap); |
|
|
1257 | recoded_root_pmap = None; |
|
|
1258 | } |
|
|
1259 | |
1247 | |
1260 | XRenderFreePicture (dpy, src); |
1248 | XRenderFreePicture (dpy, src); |
1261 | XRenderFreePicture (dpy, dst); |
1249 | XRenderFreePicture (dpy, dst); |
1262 | } |
1250 | } |
1263 | else |
1251 | else |
… | |
… | |
1277 | bg_pixmap = XCreatePixmap (dpy, vt, window_width, window_height, depth); |
1265 | bg_pixmap = XCreatePixmap (dpy, vt, window_width, window_height, depth); |
1278 | bg_pmap_width = window_width; |
1266 | bg_pmap_width = window_width; |
1279 | bg_pmap_height = window_height; |
1267 | bg_pmap_height = window_height; |
1280 | } |
1268 | } |
1281 | |
1269 | |
1282 | if (bg_pixmap != None) |
|
|
1283 | { |
|
|
1284 | /* straightforward pixmap copy */ |
1270 | /* straightforward pixmap copy */ |
1285 | while (sx < 0) sx += (int)root_width; |
1271 | while (sx < 0) sx += root_width; |
1286 | while (sy < 0) sy += (int)root_height; |
1272 | while (sy < 0) sy += root_height; |
1287 | |
1273 | |
1288 | gcv.tile = recoded_root_pmap; |
1274 | gcv.tile = recoded_root_pmap; |
1289 | gcv.fill_style = FillTiled; |
1275 | gcv.fill_style = FillTiled; |
1290 | gcv.ts_x_origin = -sx; |
1276 | gcv.ts_x_origin = -sx; |
1291 | gcv.ts_y_origin = -sy; |
1277 | gcv.ts_y_origin = -sy; |
1292 | gc = XCreateGC (dpy, vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
1278 | gc = XCreateGC (dpy, vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
1293 | |
1279 | |
1294 | if (gc) |
1280 | if (gc) |
1295 | { |
1281 | { |
1296 | XFillRectangle (dpy, bg_pixmap, gc, 0, 0, window_width, window_height); |
1282 | XFillRectangle (dpy, bg_pixmap, gc, 0, 0, window_width, window_height); |
1297 | result |= BG_IS_VALID | (bg_flags & BG_EFFECTS_FLAGS); |
1283 | result |= BG_IS_VALID | (bg_flags & BG_EFFECTS_FLAGS); |
1298 | XFreeGC (dpy, gc); |
1284 | XFreeGC (dpy, gc); |
1299 | |
1285 | |
1300 | if (!(bg_flags & BG_CLIENT_RENDER)) |
1286 | if (!(bg_flags & BG_CLIENT_RENDER)) |
1301 | { |
1287 | { |
1302 | if ((bg_flags & BG_NEEDS_BLUR) |
1288 | if ((bg_flags & BG_NEEDS_BLUR) |
1303 | && (bg_flags & BG_HAS_RENDER_CONV)) |
1289 | && (bg_flags & BG_HAS_RENDER_CONV)) |
1304 | { |
1290 | { |
1305 | if (blur_pixmap (bg_pixmap, visual, window_width, window_height)) |
1291 | if (blur_pixmap (bg_pixmap, visual, window_width, window_height)) |
1306 | result &= ~BG_NEEDS_BLUR; |
1292 | result &= ~BG_NEEDS_BLUR; |
1307 | } |
1293 | } |
1308 | if ((bg_flags & BG_NEEDS_TINT) |
1294 | if ((bg_flags & BG_NEEDS_TINT) |
1309 | && (bg_flags & (BG_TINT_BITAND | BG_HAS_RENDER))) |
1295 | && (bg_flags & (BG_TINT_BITAND | BG_HAS_RENDER))) |
1310 | { |
1296 | { |
1311 | if (tint_pixmap (bg_pixmap, visual, window_width, window_height)) |
1297 | if (tint_pixmap (bg_pixmap, visual, window_width, window_height)) |
1312 | result &= ~BG_NEEDS_TINT; |
1298 | result &= ~BG_NEEDS_TINT; |
1313 | } |
1299 | } |
1314 | } /* server side rendering completed */ |
1300 | } /* server side rendering completed */ |
1315 | } |
|
|
1316 | } |
1301 | } |
1317 | |
1302 | |
1318 | if (recoded_root_pmap != root_pixmap) |
1303 | if (recoded_root_pmap != root_pixmap) |
1319 | XFreePixmap (dpy, recoded_root_pmap); |
1304 | XFreePixmap (dpy, recoded_root_pmap); |
1320 | |
1305 | |
… | |
… | |
1449 | uint32_t mask_r, mask_g, mask_b; |
1434 | uint32_t mask_r, mask_g, mask_b; |
1450 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1435 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1451 | rgba low; |
1436 | rgba low; |
1452 | rgba high; |
1437 | rgba high; |
1453 | int i; |
1438 | int i; |
1454 | int host_byte_order = byteorder::big_endian () ? MSBFirst : LSBFirst; |
1439 | int host_byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; |
1455 | |
1440 | |
1456 | if (visual->c_class != TrueColor || ximage->format != ZPixmap) return; |
1441 | if (visual->c_class != TrueColor || ximage->format != ZPixmap) return; |
1457 | |
1442 | |
1458 | /* for convenience */ |
1443 | /* for convenience */ |
1459 | mask_r = visual->red_mask; |
1444 | mask_r = visual->red_mask; |