… | |
… | |
104 | #ifdef BG_IMAGE_FROM_FILE |
104 | #ifdef BG_IMAGE_FROM_FILE |
105 | have_image = false; |
105 | have_image = false; |
106 | h_scale = v_scale = 0; |
106 | h_scale = v_scale = 0; |
107 | h_align = v_align = 0; |
107 | h_align = v_align = 0; |
108 | #endif |
108 | #endif |
|
|
109 | #ifdef ENABLE_TRANSPARENCY |
|
|
110 | shade = 100; |
|
|
111 | #endif |
109 | flags = 0; |
112 | flags = 0; |
110 | pixmap = None; |
113 | pixmap = None; |
111 | valid_since = invalid_since = 0; |
114 | valid_since = invalid_since = 0; |
112 | target = 0; |
115 | target = 0; |
113 | } |
116 | } |
… | |
… | |
226 | make_align_position (int align, int window_size, int image_size) |
229 | make_align_position (int align, int window_size, int image_size) |
227 | { |
230 | { |
228 | int diff = window_size - image_size; |
231 | int diff = window_size - image_size; |
229 | int smaller = min (image_size, window_size); |
232 | int smaller = min (image_size, window_size); |
230 | |
233 | |
231 | if (align >= 0 && align <= 50) |
234 | if (align >= 0 && align <= 100) |
232 | return diff * align / 100; |
235 | return diff * align / 100; |
233 | else if (align > 50 && align <= 100) |
|
|
234 | return window_size - image_size - diff * (100 - align) / 100; |
|
|
235 | else if (align > 100 && align <= 200 ) |
236 | else if (align > 100 && align <= 200 ) |
236 | return ((align - 100) * smaller / 100) + window_size - smaller; |
237 | return ((align - 100) * smaller / 100) + window_size - smaller; |
237 | else if (align >= -100 && align < 0) |
238 | else if (align >= -100 && align < 0) |
238 | return ((align + 100) * smaller / 100) - image_size; |
239 | return ((align + 100) * smaller / 100) - image_size; |
239 | return 0; |
240 | return 0; |
… | |
… | |
241 | |
242 | |
242 | static inline int |
243 | static inline int |
243 | make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) |
244 | make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) |
244 | { |
245 | { |
245 | int src_pos = 0; |
246 | int src_pos = 0; |
246 | dst_pos = 0; |
247 | dst_pos = pos; |
247 | dst_size = size; |
248 | dst_size = size; |
248 | if (pos < 0) |
249 | if (pos < 0) |
249 | { |
250 | { |
250 | src_pos = -pos; |
251 | src_pos = -pos; |
|
|
252 | dst_pos = 0; |
251 | dst_size += pos; |
253 | dst_size += pos; |
252 | } |
254 | } |
253 | else if (pos > 0) |
|
|
254 | dst_pos = pos; |
|
|
255 | |
255 | |
256 | if (dst_pos + dst_size > target_size) |
256 | if (dst_pos + dst_size > target_size) |
257 | dst_size = target_size - dst_pos; |
257 | dst_size = target_size - dst_pos; |
258 | return src_pos; |
258 | return src_pos; |
259 | } |
259 | } |
… | |
… | |
461 | { |
461 | { |
462 | w = h_scale * target_width / 100; |
462 | w = h_scale * target_width / 100; |
463 | h = v_scale * target_height / 100; |
463 | h = v_scale * target_height / 100; |
464 | } |
464 | } |
465 | |
465 | |
|
|
466 | if (!w) w = image_width; |
|
|
467 | if (!h) h = image_height; |
|
|
468 | |
466 | if (flags & rootAlign) |
469 | if (flags & rootAlign) |
467 | { |
470 | { |
468 | target->get_window_origin (x, y); |
471 | target->get_window_origin (x, y); |
469 | x = -x; |
472 | x = -x; |
470 | y = -y; |
473 | y = -y; |
471 | } |
474 | } |
472 | else |
475 | else |
473 | { |
476 | { |
474 | x = make_align_position (h_align, target_width, w > 0 ? w : image_width); |
477 | x = make_align_position (h_align, target_width, w); |
475 | y = make_align_position (v_align, target_height, h > 0 ? h : image_height); |
478 | y = make_align_position (v_align, target_height, h); |
476 | } |
479 | } |
477 | |
480 | |
478 | flags &= ~sizeSensitive; |
481 | flags &= ~sizeSensitive; |
479 | if (h_scale != 0 || v_scale != 0 |
482 | if (h_scale != 0 || v_scale != 0 |
480 | || h_align != 0 || v_align != 0 |
483 | || h_align != 0 || v_align != 0 |
481 | || image_width > target_width || image_height > target_height) |
484 | || w > target_width || h > target_height) |
482 | flags |= sizeSensitive; |
485 | flags |= sizeSensitive; |
483 | } |
486 | } |
484 | |
487 | |
485 | # ifdef HAVE_AFTERIMAGE |
488 | # ifdef HAVE_AFTERIMAGE |
486 | bool |
489 | bool |
… | |
… | |
499 | background = pixmap2ximage (target->asv, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, 100); |
502 | background = pixmap2ximage (target->asv, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, 100); |
500 | |
503 | |
501 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
504 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
502 | { |
505 | { |
503 | ShadingInfo as_shade; |
506 | ShadingInfo as_shade; |
504 | as_shade.shading = (shade == 0) ? 100 : shade; |
507 | as_shade.shading = shade; |
505 | |
508 | |
506 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
509 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
507 | if (flags & tintSet) |
510 | if (flags & tintSet) |
508 | tint.get (c); |
511 | tint.get (c); |
509 | as_shade.tintColor.red = c.r; |
512 | as_shade.tintColor.red = c.r; |
… | |
… | |
511 | as_shade.tintColor.blue = c.b; |
514 | as_shade.tintColor.blue = c.b; |
512 | |
515 | |
513 | background_tint = shading2tint32 (&as_shade); |
516 | background_tint = shading2tint32 (&as_shade); |
514 | } |
517 | } |
515 | |
518 | |
516 | if (!(background_flags & transpPmapBlured) && (flags & blurNeeded) && background != NULL) |
519 | if (!(background_flags & transpPmapBlurred) && (flags & blurNeeded) && background != NULL) |
517 | { |
520 | { |
518 | ASImage *tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, |
521 | ASImage *tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, |
519 | (original_asim == NULL || tint == TINT_LEAVE_SAME) ? ASA_XImage : ASA_ASImage, |
522 | (original_asim == NULL || tint == TINT_LEAVE_SAME) ? ASA_XImage : ASA_ASImage, |
520 | 100, ASIMAGE_QUALITY_DEFAULT); |
523 | 100, ASIMAGE_QUALITY_DEFAULT); |
521 | if (tmp) |
524 | if (tmp) |
… | |
… | |
542 | |
545 | |
543 | if (original_asim) |
546 | if (original_asim) |
544 | get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); |
547 | get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); |
545 | |
548 | |
546 | if (!original_asim |
549 | if (!original_asim |
|
|
550 | || (!(flags & rootAlign) |
547 | || x >= target_width |
551 | && (x >= target_width |
548 | || y >= target_height |
552 | || y >= target_height |
549 | || (w > 0 && x + w <= 0) |
553 | || (x + w <= 0) |
550 | || (h > 0 && y + h <= 0)) |
554 | || (y + h <= 0)))) |
551 | { |
555 | { |
552 | if (background) |
556 | if (background) |
553 | { |
557 | { |
554 | new_pmap_width = background->width; |
558 | new_pmap_width = background->width; |
555 | new_pmap_height = background->height; |
559 | new_pmap_height = background->height; |
… | |
… | |
569 | } |
573 | } |
570 | else |
574 | else |
571 | { |
575 | { |
572 | result = original_asim; |
576 | result = original_asim; |
573 | |
577 | |
574 | if ((w > 0 && w != original_asim->width) |
578 | if ((w != original_asim->width) |
575 | || (h > 0 && h != original_asim->height)) |
579 | || (h != original_asim->height)) |
576 | { |
580 | { |
577 | result = scale_asimage (target->asv, original_asim, |
581 | result = scale_asimage (target->asv, original_asim, |
578 | w > 0 ? w : original_asim->width, |
582 | w, h, |
579 | h > 0 ? h : original_asim->height, |
|
|
580 | background ? ASA_ASImage : ASA_XImage, |
583 | background ? ASA_ASImage : ASA_XImage, |
581 | 100, ASIMAGE_QUALITY_DEFAULT); |
584 | 100, ASIMAGE_QUALITY_DEFAULT); |
582 | } |
585 | } |
583 | |
586 | |
584 | if (background == NULL) |
587 | if (background == NULL) |
… | |
… | |
616 | layers[0].clip_width = target_width; |
619 | layers[0].clip_width = target_width; |
617 | layers[0].clip_height = target_height; |
620 | layers[0].clip_height = target_height; |
618 | layers[0].tint = background_tint; |
621 | layers[0].tint = background_tint; |
619 | layers[1].im = result; |
622 | layers[1].im = result; |
620 | |
623 | |
621 | if (w <= 0) |
624 | if (h_scale == 0 || v_scale == 0) |
622 | { |
625 | { |
623 | /* tile horizontally */ |
626 | /* tile horizontally */ |
624 | while (x > 0) x -= (int)result->width; |
627 | while (x > 0) x -= (int)result->width; |
625 | layers[1].dst_x = x; |
628 | layers[1].dst_x = x; |
626 | layers[1].clip_width = result->width+target_width; |
629 | layers[1].clip_width = result->width+target_width; |
… | |
… | |
630 | /* clip horizontally */ |
633 | /* clip horizontally */ |
631 | layers[1].dst_x = x; |
634 | layers[1].dst_x = x; |
632 | layers[1].clip_width = result->width; |
635 | layers[1].clip_width = result->width; |
633 | } |
636 | } |
634 | |
637 | |
635 | if (h <= 0) |
638 | if (h_scale == 0 || v_scale == 0) |
636 | { |
639 | { |
637 | while (y > 0) y -= (int)result->height; |
640 | while (y > 0) y -= (int)result->height; |
638 | layers[1].dst_y = y; |
641 | layers[1].dst_y = y; |
639 | layers[1].clip_height = result->height + target_height; |
642 | layers[1].clip_height = result->height + target_height; |
640 | } |
643 | } |
… | |
… | |
762 | int w = 0; |
765 | int w = 0; |
763 | int h = 0; |
766 | int h = 0; |
764 | |
767 | |
765 | get_image_geometry (image_width, image_height, w, h, x, y); |
768 | get_image_geometry (image_width, image_height, w, h, x, y); |
766 | |
769 | |
|
|
770 | if (!(flags & rootAlign) |
767 | if (x >= target_width |
771 | && (x >= target_width |
768 | || y >= target_height |
772 | || y >= target_height |
769 | || (w > 0 && x + w <= 0) |
773 | || (x + w <= 0) |
770 | || (h > 0 && y + h <= 0)) |
774 | || (y + h <= 0))) |
771 | return false; |
775 | return false; |
772 | |
776 | |
773 | result = pixbuf; |
777 | result = pixbuf; |
774 | |
778 | |
775 | if ((w > 0 && w != image_width) |
779 | if ((w != image_width) |
776 | || (h > 0 && h != image_height)) |
780 | || (h != image_height)) |
777 | { |
781 | { |
778 | result = gdk_pixbuf_scale_simple (pixbuf, |
782 | result = gdk_pixbuf_scale_simple (pixbuf, |
779 | w > 0 ? w : image_width, |
783 | w, h, |
780 | h > 0 ? h : image_height, |
|
|
781 | GDK_INTERP_BILINEAR); |
784 | GDK_INTERP_BILINEAR); |
782 | } |
785 | } |
783 | |
786 | |
784 | bool ret = false; |
787 | bool ret = false; |
785 | |
788 | |
… | |
… | |
959 | static inline unsigned long |
962 | static inline unsigned long |
960 | compute_tint_shade_flags (rxvt_color *tint, int shade) |
963 | compute_tint_shade_flags (rxvt_color *tint, int shade) |
961 | { |
964 | { |
962 | unsigned long flags = 0; |
965 | unsigned long flags = 0; |
963 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
966 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
964 | bool has_shade = (shade > 0 && shade < 100) || (shade > 100 && shade < 200); |
967 | bool has_shade = shade != 100; |
965 | |
968 | |
966 | if (tint) |
969 | if (tint) |
967 | { |
970 | { |
968 | tint->get (c); |
971 | tint->get (c); |
969 | # define IS_COMPONENT_WHOLESOME(cmp) ((cmp) <= 0x000700 || (cmp) >= 0x00f700) |
972 | # define IS_COMPONENT_WHOLESOME(cmp) ((cmp) <= 0x000700 || (cmp) >= 0x00f700) |
… | |
… | |
1001 | } |
1004 | } |
1002 | |
1005 | |
1003 | bool |
1006 | bool |
1004 | bgPixmap_t::set_tint (rxvt_color &new_tint) |
1007 | bgPixmap_t::set_tint (rxvt_color &new_tint) |
1005 | { |
1008 | { |
1006 | if (tint != new_tint) |
1009 | if (!(flags & tintSet) || tint != new_tint) |
1007 | { |
1010 | { |
1008 | unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade); |
1011 | unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade); |
1009 | tint = new_tint; |
1012 | tint = new_tint; |
1010 | flags = (flags & ~tintFlags) | new_flags | tintSet; |
1013 | flags = (flags & ~tintFlags) | new_flags | tintSet; |
1011 | return true; |
1014 | return true; |
… | |
… | |
1029 | } |
1032 | } |
1030 | |
1033 | |
1031 | bool |
1034 | bool |
1032 | bgPixmap_t::set_shade (const char *shade_str) |
1035 | bgPixmap_t::set_shade (const char *shade_str) |
1033 | { |
1036 | { |
1034 | int new_shade = (shade_str) ? atoi (shade_str) : 0; |
1037 | int new_shade = (shade_str) ? atoi (shade_str) : 100; |
1035 | |
1038 | |
1036 | if (new_shade < 0 && new_shade > -100) |
1039 | clamp_it (new_shade, -100, 200); |
|
|
1040 | if (new_shade < 0) |
1037 | new_shade = 200 - (100 + new_shade); |
1041 | new_shade = 200 - (100 + new_shade); |
1038 | else if (new_shade == 100) |
|
|
1039 | new_shade = 0; |
|
|
1040 | |
1042 | |
1041 | if (new_shade != shade) |
1043 | if (new_shade != shade) |
1042 | { |
1044 | { |
1043 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
1045 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
1044 | shade = new_shade; |
1046 | shade = new_shade; |
… | |
… | |
1048 | |
1050 | |
1049 | return false; |
1051 | return false; |
1050 | } |
1052 | } |
1051 | |
1053 | |
1052 | bool |
1054 | bool |
1053 | bgPixmap_t::tint_pixmap (Pixmap pixmap) |
1055 | bgPixmap_t::tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height) |
1054 | { |
1056 | { |
1055 | Window root = target->display->root; |
|
|
1056 | Display *dpy = target->dpy; |
1057 | Display *dpy = target->dpy; |
1057 | int window_width = target->szHint.width; |
|
|
1058 | int window_height = target->szHint.height; |
|
|
1059 | bool ret = false; |
1058 | bool ret = false; |
1060 | |
1059 | |
1061 | if (flags & tintWholesome) |
1060 | if (flags & tintWholesome) |
1062 | { |
1061 | { |
1063 | XGCValues gcv; |
1062 | XGCValues gcv; |
… | |
… | |
1067 | * performance improvements, as we eliminate XImage transfer |
1066 | * performance improvements, as we eliminate XImage transfer |
1068 | */ |
1067 | */ |
1069 | gcv.foreground = Pixel (tint); |
1068 | gcv.foreground = Pixel (tint); |
1070 | gcv.function = GXand; |
1069 | gcv.function = GXand; |
1071 | gcv.fill_style = FillSolid; |
1070 | gcv.fill_style = FillSolid; |
1072 | gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); |
1071 | gc = XCreateGC (dpy, pixmap, GCFillStyle | GCForeground | GCFunction, &gcv); |
1073 | if (gc) |
1072 | if (gc) |
1074 | { |
1073 | { |
1075 | XFillRectangle (dpy, pixmap, gc, 0, 0, window_width, window_height); |
1074 | XFillRectangle (dpy, pixmap, gc, 0, 0, width, height); |
1076 | ret = true; |
1075 | ret = true; |
1077 | XFreeGC (dpy, gc); |
1076 | XFreeGC (dpy, gc); |
1078 | } |
1077 | } |
1079 | } |
1078 | } |
1080 | else |
1079 | else |
… | |
… | |
1083 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1082 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1084 | |
1083 | |
1085 | if (flags & tintSet) |
1084 | if (flags & tintSet) |
1086 | tint.get (c); |
1085 | tint.get (c); |
1087 | |
1086 | |
1088 | if (shade > 0 && shade < 100) |
1087 | if (shade <= 100) |
1089 | { |
1088 | { |
1090 | c.r = (c.r * shade) / 100; |
1089 | c.r = (c.r * shade) / 100; |
1091 | c.g = (c.g * shade) / 100; |
1090 | c.g = (c.g * shade) / 100; |
1092 | c.b = (c.b * shade) / 100; |
1091 | c.b = (c.b * shade) / 100; |
1093 | } |
1092 | } |
1094 | else if (shade > 100 && shade < 200) |
1093 | else |
1095 | { |
|
|
1096 | c.r = (c.r * (200 - shade)) / 100; |
|
|
1097 | c.g = (c.g * (200 - shade)) / 100; |
|
|
1098 | c.b = (c.b * (200 - shade)) / 100; |
|
|
1099 | } |
1094 | { |
|
|
1095 | c.r = ((0xffff - c.r) * (200 - shade)) / 100; |
|
|
1096 | c.g = ((0xffff - c.g) * (200 - shade)) / 100; |
|
|
1097 | c.b = ((0xffff - c.b) * (200 - shade)) / 100; |
|
|
1098 | } |
1100 | |
1099 | |
1101 | XRenderPictFormat pf; |
1100 | XRenderPictFormat *solid_format = XRenderFindStandardFormat (dpy, PictStandardARGB32); |
1102 | pf.type = PictTypeDirect; |
|
|
1103 | pf.depth = 32; |
|
|
1104 | pf.direct.redMask = 0xff; |
|
|
1105 | pf.direct.greenMask = 0xff; |
|
|
1106 | pf.direct.blueMask = 0xff; |
|
|
1107 | pf.direct.alphaMask = 0xff; |
|
|
1108 | |
|
|
1109 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
1101 | XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); |
1110 | (PictFormatType| |
|
|
1111 | PictFormatDepth| |
|
|
1112 | PictFormatRedMask| |
|
|
1113 | PictFormatGreenMask| |
|
|
1114 | PictFormatBlueMask| |
|
|
1115 | PictFormatAlphaMask), |
|
|
1116 | &pf, |
|
|
1117 | 0); |
|
|
1118 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
|
|
1119 | XRenderPictureAttributes pa; |
1102 | XRenderPictureAttributes pa; |
1120 | |
1103 | |
1121 | Picture back_pic = XRenderCreatePicture (dpy, pixmap, root_format, 0, &pa); |
1104 | Picture back_pic = XRenderCreatePicture (dpy, pixmap, format, 0, &pa); |
1122 | |
1105 | |
1123 | pa.repeat = True; |
1106 | pa.repeat = True; |
1124 | |
1107 | |
1125 | Pixmap overlay_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
1108 | Pixmap overlay_pmap = XCreatePixmap (dpy, pixmap, 1, 1, 32); |
1126 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
1109 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
1127 | XFreePixmap (dpy, overlay_pmap); |
1110 | XFreePixmap (dpy, overlay_pmap); |
1128 | |
1111 | |
1129 | pa.component_alpha = True; |
1112 | pa.component_alpha = True; |
1130 | Pixmap mask_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
1113 | Pixmap mask_pmap = XCreatePixmap (dpy, pixmap, 1, 1, 32); |
1131 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat|CPComponentAlpha, &pa); |
1114 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat|CPComponentAlpha, &pa); |
1132 | XFreePixmap (dpy, mask_pmap); |
1115 | XFreePixmap (dpy, mask_pmap); |
1133 | |
1116 | |
1134 | if (mask_pic && overlay_pic && back_pic) |
1117 | if (mask_pic && overlay_pic && back_pic) |
1135 | { |
1118 | { |
… | |
… | |
1142 | mask_c.alpha = 0; |
1125 | mask_c.alpha = 0; |
1143 | mask_c.red = 0xffff - c.r; |
1126 | mask_c.red = 0xffff - c.r; |
1144 | mask_c.green = 0xffff - c.g; |
1127 | mask_c.green = 0xffff - c.g; |
1145 | mask_c.blue = 0xffff - c.b; |
1128 | mask_c.blue = 0xffff - c.b; |
1146 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
1129 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
1147 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); |
1130 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, width, height); |
1148 | ret = true; |
1131 | ret = true; |
1149 | } |
1132 | } |
1150 | |
1133 | |
1151 | XRenderFreePicture (dpy, mask_pic); |
1134 | XRenderFreePicture (dpy, mask_pic); |
1152 | XRenderFreePicture (dpy, overlay_pic); |
1135 | XRenderFreePicture (dpy, overlay_pic); |
… | |
… | |
1195 | || sx >= root_width || sy >= root_height) |
1178 | || sx >= root_width || sy >= root_height) |
1196 | return 0; |
1179 | return 0; |
1197 | |
1180 | |
1198 | if (root_pixmap != None) |
1181 | if (root_pixmap != None) |
1199 | { |
1182 | { |
1200 | /* we want to validate the pixmap and get it's size at the same time : */ |
1183 | /* we want to validate the pixmap and get its size at the same time : */ |
1201 | int junk; |
1184 | int junk; |
1202 | unsigned int ujunk; |
1185 | unsigned int ujunk; |
1203 | /* root pixmap may be bad - allow a error */ |
1186 | /* root pixmap may be bad - allow a error */ |
1204 | target->allowedxerror = -1; |
1187 | target->allowedxerror = -1; |
1205 | |
1188 | |
… | |
… | |
1295 | { |
1278 | { |
1296 | if (!need_client_side_rendering ()) |
1279 | if (!need_client_side_rendering ()) |
1297 | { |
1280 | { |
1298 | if ((flags & tintNeeded)) |
1281 | if ((flags & tintNeeded)) |
1299 | { |
1282 | { |
1300 | if (tint_pixmap (tiled_root_pmap)) |
1283 | if (tint_pixmap (tiled_root_pmap, DefaultVisual (dpy, target->display->screen), window_width, window_height)) |
1301 | result |= transpPmapTinted; |
1284 | result |= transpPmapTinted; |
1302 | } |
1285 | } |
1303 | } /* server side rendering completed */ |
1286 | } /* server side rendering completed */ |
1304 | |
1287 | |
1305 | if (pixmap) |
1288 | if (pixmap) |
… | |
… | |
1546 | int i; |
1529 | int i; |
1547 | |
1530 | |
1548 | Visual *visual = term->visual; |
1531 | Visual *visual = term->visual; |
1549 | |
1532 | |
1550 | if (visual->c_class != TrueColor || srcImage->format != ZPixmap) return ; |
1533 | if (visual->c_class != TrueColor || srcImage->format != ZPixmap) return ; |
1551 | |
|
|
1552 | if (shade == 0) |
|
|
1553 | shade = 100; |
|
|
1554 | |
1534 | |
1555 | /* for convenience */ |
1535 | /* for convenience */ |
1556 | mask_r = visual->red_mask; |
1536 | mask_r = visual->red_mask; |
1557 | mask_g = visual->green_mask; |
1537 | mask_g = visual->green_mask; |
1558 | mask_b = visual->blue_mask; |
1538 | mask_b = visual->blue_mask; |
… | |
… | |
1614 | default: |
1594 | default: |
1615 | return; /* we do not support this color depth */ |
1595 | return; /* we do not support this color depth */ |
1616 | } |
1596 | } |
1617 | |
1597 | |
1618 | /* prepare limits for color transformation (each channel is handled separately) */ |
1598 | /* prepare limits for color transformation (each channel is handled separately) */ |
1619 | if (shade < 0) { |
1599 | if (shade > 100) { |
1620 | shade = -shade; |
1600 | shade = 200 - shade; |
1621 | if (shade < 0) shade = 0; |
|
|
1622 | if (shade > 100) shade = 100; |
|
|
1623 | |
1601 | |
1624 | lower_lim_r = 65535-rm; |
1602 | lower_lim_r = 65535-rm; |
1625 | lower_lim_g = 65535-gm; |
1603 | lower_lim_g = 65535-gm; |
1626 | lower_lim_b = 65535-bm; |
1604 | lower_lim_b = 65535-bm; |
1627 | |
1605 | |
… | |
… | |
1629 | lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); |
1607 | lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); |
1630 | lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); |
1608 | lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); |
1631 | |
1609 | |
1632 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
1610 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
1633 | } else { |
1611 | } else { |
1634 | if (shade < 0) shade = 0; |
|
|
1635 | if (shade > 100) shade = 100; |
|
|
1636 | |
1612 | |
1637 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
1613 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
1638 | |
1614 | |
1639 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
1615 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
1640 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |
1616 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |