… | |
… | |
157 | # endif |
157 | # endif |
158 | |
158 | |
159 | # ifdef BG_IMAGE_FROM_FILE |
159 | # ifdef BG_IMAGE_FROM_FILE |
160 | if (have_image) |
160 | if (have_image) |
161 | { |
161 | { |
162 | if (h_align == rootAlign || v_align == rootAlign) |
162 | if (flags & rootAlign) |
163 | return true; |
163 | return true; |
164 | } |
164 | } |
165 | # endif |
165 | # endif |
166 | |
166 | |
167 | return false; |
167 | return false; |
… | |
… | |
207 | static inline bool |
207 | static inline bool |
208 | check_set_align_value (int geom_flags, int flag, int &align, int new_value) |
208 | check_set_align_value (int geom_flags, int flag, int &align, int new_value) |
209 | { |
209 | { |
210 | if (geom_flags & flag) |
210 | if (geom_flags & flag) |
211 | { |
211 | { |
212 | if (new_value != bgPixmap_t::rootAlign) |
|
|
213 | { |
|
|
214 | if (new_value < -100) |
212 | if (new_value < -100) |
215 | new_value = -100; |
213 | new_value = -100; |
216 | else if (new_value > 200) |
214 | else if (new_value > 200) |
217 | new_value = 200; |
215 | new_value = 200; |
218 | } |
|
|
219 | if (new_value != align) |
216 | if (new_value != align) |
220 | { |
217 | { |
221 | align = new_value; |
218 | align = new_value; |
222 | return true; |
219 | return true; |
223 | } |
220 | } |
… | |
… | |
229 | make_align_position (int align, int window_size, int image_size) |
226 | make_align_position (int align, int window_size, int image_size) |
230 | { |
227 | { |
231 | int diff = window_size - image_size; |
228 | int diff = window_size - image_size; |
232 | int smaller = min (image_size, window_size); |
229 | int smaller = min (image_size, window_size); |
233 | |
230 | |
234 | if (align >= 0 && align <= 50) |
231 | if (align >= 0 && align <= 100) |
235 | return diff * align / 100; |
232 | return diff * align / 100; |
236 | else if (align > 50 && align <= 100) |
|
|
237 | return window_size - image_size - diff * (100 - align) / 100; |
|
|
238 | else if (align > 100 && align <= 200 ) |
233 | else if (align > 100 && align <= 200 ) |
239 | return ((align - 100) * smaller / 100) + window_size - smaller; |
234 | return ((align - 100) * smaller / 100) + window_size - smaller; |
240 | else if (align > -100 && align < 0) |
235 | else if (align >= -100 && align < 0) |
241 | return ((align + 100) * smaller / 100) - image_size; |
236 | return ((align + 100) * smaller / 100) - image_size; |
242 | return 0; |
237 | return 0; |
243 | } |
238 | } |
244 | |
239 | |
245 | static inline int |
240 | static inline int |
246 | make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) |
241 | make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) |
247 | { |
242 | { |
248 | int src_pos = 0; |
243 | int src_pos = 0; |
249 | dst_pos = 0; |
244 | dst_pos = pos; |
250 | dst_size = size; |
245 | dst_size = size; |
251 | if (pos < 0) |
246 | if (pos < 0) |
252 | { |
247 | { |
253 | src_pos = -pos; |
248 | src_pos = -pos; |
|
|
249 | dst_pos = 0; |
254 | dst_size += pos; |
250 | dst_size += pos; |
255 | } |
251 | } |
256 | else if (pos > 0) |
|
|
257 | dst_pos = pos; |
|
|
258 | |
252 | |
259 | if (dst_pos + dst_size > target_size) |
253 | if (dst_pos + dst_size > target_size) |
260 | dst_size = target_size - dst_pos; |
254 | dst_size = target_size - dst_pos; |
261 | return src_pos; |
255 | return src_pos; |
262 | } |
256 | } |
… | |
… | |
387 | w = h = noScale; |
381 | w = h = noScale; |
388 | geom_flags |= WidthValue|HeightValue; |
382 | geom_flags |= WidthValue|HeightValue; |
389 | } |
383 | } |
390 | else if (CHECK_GEOM_OPS ("propscale")) |
384 | else if (CHECK_GEOM_OPS ("propscale")) |
391 | { |
385 | { |
392 | if (w == 0 && h == 0) |
|
|
393 | { |
|
|
394 | w = windowScale; |
|
|
395 | geom_flags |= WidthValue; |
|
|
396 | } |
|
|
397 | new_flags |= propScale; |
386 | new_flags |= propScale; |
398 | } |
387 | } |
399 | else if (CHECK_GEOM_OPS ("hscale")) |
388 | else if (CHECK_GEOM_OPS ("hscale")) |
400 | { |
389 | { |
401 | if (w == 0) w = windowScale; |
390 | if (w == 0) w = windowScale; |
… | |
… | |
423 | x = y = centerAlign; |
412 | x = y = centerAlign; |
424 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
413 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
425 | } |
414 | } |
426 | else if (CHECK_GEOM_OPS ("root")) |
415 | else if (CHECK_GEOM_OPS ("root")) |
427 | { |
416 | { |
|
|
417 | new_flags |= rootAlign; |
428 | w = h = noScale; |
418 | w = h = noScale; |
429 | x = y = rootAlign; |
|
|
430 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
419 | geom_flags |= WidthValue|HeightValue; |
431 | } |
420 | } |
432 | # undef CHECK_GEOM_OPS |
421 | # undef CHECK_GEOM_OPS |
433 | |
422 | |
434 | while (*ops != ':' && *ops != '\0') ++ops; |
423 | while (*ops != ':' && *ops != '\0') ++ops; |
435 | } /* done parsing ops */ |
424 | } /* done parsing ops */ |
… | |
… | |
456 | bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
445 | bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
457 | { |
446 | { |
458 | int target_width = target->szHint.width; |
447 | int target_width = target->szHint.width; |
459 | int target_height = target->szHint.height; |
448 | int target_height = target->szHint.height; |
460 | |
449 | |
|
|
450 | if (flags & propScale) |
|
|
451 | { |
|
|
452 | float scale = (float)target_width / image_width; |
|
|
453 | min_it (scale, (float)target_height / image_height); |
|
|
454 | w = image_width * scale + 0.5; |
|
|
455 | h = image_height * scale + 0.5; |
|
|
456 | } |
|
|
457 | else |
|
|
458 | { |
461 | w = h_scale * target_width / 100; |
459 | w = h_scale * target_width / 100; |
462 | h = v_scale * target_height / 100; |
460 | h = v_scale * target_height / 100; |
|
|
461 | } |
463 | |
462 | |
464 | if (h_align == rootAlign || v_align == rootAlign) |
463 | if (!w) w = image_width; |
|
|
464 | if (!h) h = image_height; |
|
|
465 | |
|
|
466 | if (flags & rootAlign) |
465 | { |
467 | { |
466 | target->get_window_origin (x, y); |
468 | target->get_window_origin (x, y); |
467 | x = -x; |
469 | x = -x; |
468 | y = -y; |
470 | y = -y; |
469 | } |
471 | } |
470 | |
472 | else |
471 | if (h_align != rootAlign) |
473 | { |
472 | x = make_align_position (h_align, target_width, w > 0 ? w : image_width); |
474 | x = make_align_position (h_align, target_width, w); |
473 | |
|
|
474 | if (v_align != rootAlign) |
|
|
475 | y = make_align_position (v_align, target_height, h > 0 ? h : image_height); |
475 | y = make_align_position (v_align, target_height, h); |
|
|
476 | } |
476 | |
477 | |
477 | flags &= ~sizeSensitive; |
478 | flags &= ~sizeSensitive; |
478 | if (h_scale != 0 || v_scale != 0 |
479 | if (h_scale != 0 || v_scale != 0 |
479 | || h_align != 0 || v_align != 0 |
480 | || h_align != 0 || v_align != 0 |
480 | || image_width > target_width || image_height > target_height) |
481 | || w > target_width || h > target_height) |
481 | flags |= sizeSensitive; |
482 | flags |= sizeSensitive; |
482 | } |
483 | } |
483 | |
484 | |
484 | # ifdef HAVE_AFTERIMAGE |
485 | # ifdef HAVE_AFTERIMAGE |
485 | bool |
486 | bool |
… | |
… | |
541 | |
542 | |
542 | if (original_asim) |
543 | if (original_asim) |
543 | get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); |
544 | get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); |
544 | |
545 | |
545 | if (!original_asim |
546 | if (!original_asim |
|
|
547 | || (!(flags & rootAlign) |
546 | || x >= target_width |
548 | && (x >= target_width |
547 | || y >= target_height |
549 | || y >= target_height |
548 | || (w > 0 && x + w <= 0) |
550 | || (x + w <= 0) |
549 | || (h > 0 && y + h <= 0)) |
551 | || (y + h <= 0)))) |
550 | { |
552 | { |
551 | if (background) |
553 | if (background) |
552 | { |
554 | { |
553 | new_pmap_width = background->width; |
555 | new_pmap_width = background->width; |
554 | new_pmap_height = background->height; |
556 | new_pmap_height = background->height; |
… | |
… | |
568 | } |
570 | } |
569 | else |
571 | else |
570 | { |
572 | { |
571 | result = original_asim; |
573 | result = original_asim; |
572 | |
574 | |
573 | if ((w > 0 && w != original_asim->width) |
575 | if ((w != original_asim->width) |
574 | || (h > 0 && h != original_asim->height)) |
576 | || (h != original_asim->height)) |
575 | { |
577 | { |
576 | result = scale_asimage (target->asv, original_asim, |
578 | result = scale_asimage (target->asv, original_asim, |
577 | w > 0 ? w : original_asim->width, |
579 | w, h, |
578 | h > 0 ? h : original_asim->height, |
|
|
579 | background ? ASA_ASImage : ASA_XImage, |
580 | background ? ASA_ASImage : ASA_XImage, |
580 | 100, ASIMAGE_QUALITY_DEFAULT); |
581 | 100, ASIMAGE_QUALITY_DEFAULT); |
581 | } |
582 | } |
582 | |
583 | |
583 | if (background == NULL) |
584 | if (background == NULL) |
… | |
… | |
615 | layers[0].clip_width = target_width; |
616 | layers[0].clip_width = target_width; |
616 | layers[0].clip_height = target_height; |
617 | layers[0].clip_height = target_height; |
617 | layers[0].tint = background_tint; |
618 | layers[0].tint = background_tint; |
618 | layers[1].im = result; |
619 | layers[1].im = result; |
619 | |
620 | |
620 | if (w <= 0) |
621 | if (h_scale == 0 || v_scale == 0) |
621 | { |
622 | { |
622 | /* tile horizontally */ |
623 | /* tile horizontally */ |
623 | while (x > 0) x -= (int)result->width; |
624 | while (x > 0) x -= (int)result->width; |
624 | layers[1].dst_x = x; |
625 | layers[1].dst_x = x; |
625 | layers[1].clip_width = result->width+target_width; |
626 | layers[1].clip_width = result->width+target_width; |
… | |
… | |
629 | /* clip horizontally */ |
630 | /* clip horizontally */ |
630 | layers[1].dst_x = x; |
631 | layers[1].dst_x = x; |
631 | layers[1].clip_width = result->width; |
632 | layers[1].clip_width = result->width; |
632 | } |
633 | } |
633 | |
634 | |
634 | if (h <= 0) |
635 | if (h_scale == 0 || v_scale == 0) |
635 | { |
636 | { |
636 | while (y > 0) y -= (int)result->height; |
637 | while (y > 0) y -= (int)result->height; |
637 | layers[1].dst_y = y; |
638 | layers[1].dst_y = y; |
638 | layers[1].clip_height = result->height + target_height; |
639 | layers[1].clip_height = result->height + target_height; |
639 | } |
640 | } |
… | |
… | |
761 | int w = 0; |
762 | int w = 0; |
762 | int h = 0; |
763 | int h = 0; |
763 | |
764 | |
764 | get_image_geometry (image_width, image_height, w, h, x, y); |
765 | get_image_geometry (image_width, image_height, w, h, x, y); |
765 | |
766 | |
|
|
767 | if (!(flags & rootAlign) |
766 | if (x >= target_width |
768 | && (x >= target_width |
767 | || y >= target_height |
769 | || y >= target_height |
768 | || (w > 0 && x + w <= 0) |
770 | || (x + w <= 0) |
769 | || (h > 0 && y + h <= 0)) |
771 | || (y + h <= 0))) |
770 | return false; |
772 | return false; |
771 | |
773 | |
772 | result = pixbuf; |
774 | result = pixbuf; |
773 | |
775 | |
774 | if ((w > 0 && w != image_width) |
776 | if ((w != image_width) |
775 | || (h > 0 && h != image_height)) |
777 | || (h != image_height)) |
776 | { |
778 | { |
777 | result = gdk_pixbuf_scale_simple (pixbuf, |
779 | result = gdk_pixbuf_scale_simple (pixbuf, |
778 | w > 0 ? w : image_width, |
780 | w, h, |
779 | h > 0 ? h : image_height, |
|
|
780 | GDK_INTERP_BILINEAR); |
781 | GDK_INTERP_BILINEAR); |
781 | } |
782 | } |
782 | |
783 | |
783 | bool ret = false; |
784 | bool ret = false; |
784 | |
785 | |
… | |
… | |
1044 | flags = (flags & (~tintFlags | tintSet)) | new_flags; |
1045 | flags = (flags & (~tintFlags | tintSet)) | new_flags; |
1045 | return true; |
1046 | return true; |
1046 | } |
1047 | } |
1047 | |
1048 | |
1048 | return false; |
1049 | return false; |
|
|
1050 | } |
|
|
1051 | |
|
|
1052 | bool |
|
|
1053 | bgPixmap_t::tint_pixmap (Pixmap pixmap, Window root, int width, int height) |
|
|
1054 | { |
|
|
1055 | Display *dpy = target->dpy; |
|
|
1056 | bool ret = false; |
|
|
1057 | |
|
|
1058 | if (flags & tintWholesome) |
|
|
1059 | { |
|
|
1060 | XGCValues gcv; |
|
|
1061 | GC gc; |
|
|
1062 | |
|
|
1063 | /* In this case we can tint image server-side getting significant |
|
|
1064 | * performance improvements, as we eliminate XImage transfer |
|
|
1065 | */ |
|
|
1066 | gcv.foreground = Pixel (tint); |
|
|
1067 | gcv.function = GXand; |
|
|
1068 | gcv.fill_style = FillSolid; |
|
|
1069 | gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); |
|
|
1070 | if (gc) |
|
|
1071 | { |
|
|
1072 | XFillRectangle (dpy, pixmap, gc, 0, 0, width, height); |
|
|
1073 | ret = true; |
|
|
1074 | XFreeGC (dpy, gc); |
|
|
1075 | } |
|
|
1076 | } |
|
|
1077 | else |
|
|
1078 | { |
|
|
1079 | # if XFT |
|
|
1080 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
|
|
1081 | |
|
|
1082 | if (flags & tintSet) |
|
|
1083 | tint.get (c); |
|
|
1084 | |
|
|
1085 | if (shade > 0 && shade < 100) |
|
|
1086 | { |
|
|
1087 | c.r = (c.r * shade) / 100; |
|
|
1088 | c.g = (c.g * shade) / 100; |
|
|
1089 | c.b = (c.b * shade) / 100; |
|
|
1090 | } |
|
|
1091 | else if (shade > 100 && shade < 200) |
|
|
1092 | { |
|
|
1093 | c.r = ((0xffff - c.r) * (200 - shade)) / 100; |
|
|
1094 | c.g = ((0xffff - c.g) * (200 - shade)) / 100; |
|
|
1095 | c.b = ((0xffff - c.b) * (200 - shade)) / 100; |
|
|
1096 | } |
|
|
1097 | |
|
|
1098 | XRenderPictFormat pf; |
|
|
1099 | pf.type = PictTypeDirect; |
|
|
1100 | pf.depth = 32; |
|
|
1101 | pf.direct.redMask = 0xff; |
|
|
1102 | pf.direct.greenMask = 0xff; |
|
|
1103 | pf.direct.blueMask = 0xff; |
|
|
1104 | pf.direct.alphaMask = 0xff; |
|
|
1105 | |
|
|
1106 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
|
|
1107 | (PictFormatType| |
|
|
1108 | PictFormatDepth| |
|
|
1109 | PictFormatRedMask| |
|
|
1110 | PictFormatGreenMask| |
|
|
1111 | PictFormatBlueMask| |
|
|
1112 | PictFormatAlphaMask), |
|
|
1113 | &pf, |
|
|
1114 | 0); |
|
|
1115 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
|
|
1116 | XRenderPictureAttributes pa; |
|
|
1117 | |
|
|
1118 | Picture back_pic = XRenderCreatePicture (dpy, pixmap, root_format, 0, &pa); |
|
|
1119 | |
|
|
1120 | pa.repeat = True; |
|
|
1121 | |
|
|
1122 | Pixmap overlay_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
|
|
1123 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
|
|
1124 | XFreePixmap (dpy, overlay_pmap); |
|
|
1125 | |
|
|
1126 | pa.component_alpha = True; |
|
|
1127 | Pixmap mask_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
|
|
1128 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat|CPComponentAlpha, &pa); |
|
|
1129 | XFreePixmap (dpy, mask_pmap); |
|
|
1130 | |
|
|
1131 | if (mask_pic && overlay_pic && back_pic) |
|
|
1132 | { |
|
|
1133 | XRenderColor mask_c; |
|
|
1134 | |
|
|
1135 | memset (&mask_c, (shade > 100) ? 0xFF : 0x0, sizeof (mask_c)); |
|
|
1136 | mask_c.alpha = 0xffff; |
|
|
1137 | XRenderFillRectangle (dpy, PictOpSrc, overlay_pic, &mask_c, 0, 0, 1, 1); |
|
|
1138 | |
|
|
1139 | mask_c.alpha = 0; |
|
|
1140 | mask_c.red = 0xffff - c.r; |
|
|
1141 | mask_c.green = 0xffff - c.g; |
|
|
1142 | mask_c.blue = 0xffff - c.b; |
|
|
1143 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
|
|
1144 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, width, height); |
|
|
1145 | ret = true; |
|
|
1146 | } |
|
|
1147 | |
|
|
1148 | XRenderFreePicture (dpy, mask_pic); |
|
|
1149 | XRenderFreePicture (dpy, overlay_pic); |
|
|
1150 | XRenderFreePicture (dpy, back_pic); |
|
|
1151 | # if DO_TIMING_TEST |
|
|
1152 | XSync (dpy, False); |
|
|
1153 | # endif |
|
|
1154 | # endif |
|
|
1155 | } |
|
|
1156 | |
|
|
1157 | return ret; |
1049 | } |
1158 | } |
1050 | |
1159 | |
1051 | /* make_transparency_pixmap() |
1160 | /* make_transparency_pixmap() |
1052 | * Builds a pixmap sized the same as terminal window, with depth same as the root window |
1161 | * Builds a pixmap sized the same as terminal window, with depth same as the root window |
1053 | * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by |
1162 | * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by |
… | |
… | |
1183 | { |
1292 | { |
1184 | if (!need_client_side_rendering ()) |
1293 | if (!need_client_side_rendering ()) |
1185 | { |
1294 | { |
1186 | if ((flags & tintNeeded)) |
1295 | if ((flags & tintNeeded)) |
1187 | { |
1296 | { |
1188 | if (flags & tintWholesome) |
1297 | if (tint_pixmap (tiled_root_pmap, root, window_width, window_height)) |
1189 | { |
|
|
1190 | /* In this case we can tint image server-side getting significant |
|
|
1191 | * performance improvements, as we eliminate XImage transfer |
|
|
1192 | */ |
|
|
1193 | gcv.foreground = Pixel (tint); |
|
|
1194 | gcv.function = GXand; |
|
|
1195 | gcv.fill_style = FillSolid; |
|
|
1196 | if (gc) |
|
|
1197 | XChangeGC (dpy, gc, GCFillStyle | GCForeground | GCFunction, &gcv); |
|
|
1198 | else |
|
|
1199 | gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); |
|
|
1200 | if (gc) |
|
|
1201 | { |
|
|
1202 | XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); |
|
|
1203 | result |= transpPmapTinted; |
1298 | result |= transpPmapTinted; |
1204 | } |
|
|
1205 | } |
|
|
1206 | else |
|
|
1207 | { |
|
|
1208 | # if XFT |
|
|
1209 | Picture back_pic = 0; |
|
|
1210 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
|
|
1211 | |
|
|
1212 | if (flags & tintSet) |
|
|
1213 | tint.get (c); |
|
|
1214 | |
|
|
1215 | if (shade > 0 && shade < 100) |
|
|
1216 | { |
|
|
1217 | c.r = (c.r * shade) / 100; |
|
|
1218 | c.g = (c.g * shade) / 100; |
|
|
1219 | c.b = (c.b * shade) / 100; |
|
|
1220 | } |
|
|
1221 | else if (shade > 100 && shade < 200) |
|
|
1222 | { |
|
|
1223 | c.r = (c.r * (200 - shade)) / 100; |
|
|
1224 | c.g = (c.g * (200 - shade)) / 100; |
|
|
1225 | c.b = (c.b * (200 - shade)) / 100; |
|
|
1226 | } |
|
|
1227 | |
|
|
1228 | XRenderPictFormat pf; |
|
|
1229 | pf.type = PictTypeDirect; |
|
|
1230 | pf.depth = 32; |
|
|
1231 | pf.direct.redMask = 0xff; |
|
|
1232 | pf.direct.greenMask = 0xff; |
|
|
1233 | pf.direct.blueMask = 0xff; |
|
|
1234 | pf.direct.alphaMask = 0xff; |
|
|
1235 | |
|
|
1236 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
|
|
1237 | (PictFormatType| |
|
|
1238 | PictFormatDepth| |
|
|
1239 | PictFormatRedMask| |
|
|
1240 | PictFormatGreenMask| |
|
|
1241 | PictFormatBlueMask| |
|
|
1242 | PictFormatAlphaMask), |
|
|
1243 | &pf, |
|
|
1244 | 0); |
|
|
1245 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
|
|
1246 | XRenderPictureAttributes pa ; |
|
|
1247 | |
|
|
1248 | back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa); |
|
|
1249 | |
|
|
1250 | pa.repeat = True; |
|
|
1251 | |
|
|
1252 | Pixmap overlay_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
|
|
1253 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
|
|
1254 | XFreePixmap (dpy, overlay_pmap); |
|
|
1255 | |
|
|
1256 | pa.component_alpha = True; |
|
|
1257 | Pixmap mask_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
|
|
1258 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat|CPComponentAlpha, &pa); |
|
|
1259 | XFreePixmap (dpy, mask_pmap); |
|
|
1260 | |
|
|
1261 | if (mask_pic && overlay_pic && back_pic) |
|
|
1262 | { |
|
|
1263 | XRenderColor mask_c; |
|
|
1264 | |
|
|
1265 | memset (&mask_c, (shade > 100) ? 0xFF : 0x0, sizeof (mask_c)); |
|
|
1266 | mask_c.alpha = 0xffff; |
|
|
1267 | XRenderFillRectangle (dpy, PictOpSrc, overlay_pic, &mask_c, 0, 0, 1, 1); |
|
|
1268 | |
|
|
1269 | mask_c.alpha = 0; |
|
|
1270 | mask_c.red = 0xffff - c.r; |
|
|
1271 | mask_c.green = 0xffff - c.g; |
|
|
1272 | mask_c.blue = 0xffff - c.b; |
|
|
1273 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
|
|
1274 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); |
|
|
1275 | result |= transpPmapTinted; |
|
|
1276 | } |
|
|
1277 | |
|
|
1278 | XRenderFreePicture (dpy, mask_pic); |
|
|
1279 | XRenderFreePicture (dpy, overlay_pic); |
|
|
1280 | XRenderFreePicture (dpy, back_pic); |
|
|
1281 | # if DO_TIMING_TEST |
|
|
1282 | XSync (dpy, False); |
|
|
1283 | # endif |
|
|
1284 | # endif |
|
|
1285 | } |
|
|
1286 | } |
1299 | } |
1287 | } /* server side rendering completed */ |
1300 | } /* server side rendering completed */ |
1288 | |
1301 | |
1289 | if (pixmap) |
1302 | if (pixmap) |
1290 | XFreePixmap (dpy, pixmap); |
1303 | XFreePixmap (dpy, pixmap); |