… | |
… | |
1050 | |
1050 | |
1051 | return false; |
1051 | return false; |
1052 | } |
1052 | } |
1053 | |
1053 | |
1054 | bool |
1054 | bool |
1055 | bgPixmap_t::tint_pixmap (Pixmap pixmap, Window root, int width, int height) |
1055 | bgPixmap_t::tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height) |
1056 | { |
1056 | { |
1057 | Display *dpy = target->dpy; |
1057 | Display *dpy = target->dpy; |
1058 | bool ret = false; |
1058 | bool ret = false; |
1059 | |
1059 | |
1060 | if (flags & tintWholesome) |
1060 | if (flags & tintWholesome) |
… | |
… | |
1066 | * performance improvements, as we eliminate XImage transfer |
1066 | * performance improvements, as we eliminate XImage transfer |
1067 | */ |
1067 | */ |
1068 | gcv.foreground = Pixel (tint); |
1068 | gcv.foreground = Pixel (tint); |
1069 | gcv.function = GXand; |
1069 | gcv.function = GXand; |
1070 | gcv.fill_style = FillSolid; |
1070 | gcv.fill_style = FillSolid; |
1071 | gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); |
1071 | gc = XCreateGC (dpy, pixmap, GCFillStyle | GCForeground | GCFunction, &gcv); |
1072 | if (gc) |
1072 | if (gc) |
1073 | { |
1073 | { |
1074 | XFillRectangle (dpy, pixmap, gc, 0, 0, width, height); |
1074 | XFillRectangle (dpy, pixmap, gc, 0, 0, width, height); |
1075 | ret = true; |
1075 | ret = true; |
1076 | XFreeGC (dpy, gc); |
1076 | XFreeGC (dpy, gc); |
… | |
… | |
1096 | c.g = ((0xffff - c.g) * (200 - shade)) / 100; |
1096 | c.g = ((0xffff - c.g) * (200 - shade)) / 100; |
1097 | c.b = ((0xffff - c.b) * (200 - shade)) / 100; |
1097 | c.b = ((0xffff - c.b) * (200 - shade)) / 100; |
1098 | } |
1098 | } |
1099 | |
1099 | |
1100 | XRenderPictFormat *solid_format = XRenderFindStandardFormat (dpy, PictStandardARGB32); |
1100 | XRenderPictFormat *solid_format = XRenderFindStandardFormat (dpy, PictStandardARGB32); |
1101 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
1101 | XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); |
1102 | XRenderPictureAttributes pa; |
1102 | XRenderPictureAttributes pa; |
1103 | |
1103 | |
1104 | Picture back_pic = XRenderCreatePicture (dpy, pixmap, root_format, 0, &pa); |
1104 | Picture back_pic = XRenderCreatePicture (dpy, pixmap, format, 0, &pa); |
1105 | |
1105 | |
1106 | pa.repeat = True; |
1106 | pa.repeat = True; |
1107 | |
1107 | |
1108 | Pixmap overlay_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
1108 | Pixmap overlay_pmap = XCreatePixmap (dpy, pixmap, 1, 1, 32); |
1109 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
1109 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
1110 | XFreePixmap (dpy, overlay_pmap); |
1110 | XFreePixmap (dpy, overlay_pmap); |
1111 | |
1111 | |
1112 | pa.component_alpha = True; |
1112 | pa.component_alpha = True; |
1113 | Pixmap mask_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
1113 | Pixmap mask_pmap = XCreatePixmap (dpy, pixmap, 1, 1, 32); |
1114 | 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); |
1115 | XFreePixmap (dpy, mask_pmap); |
1115 | XFreePixmap (dpy, mask_pmap); |
1116 | |
1116 | |
1117 | if (mask_pic && overlay_pic && back_pic) |
1117 | if (mask_pic && overlay_pic && back_pic) |
1118 | { |
1118 | { |
… | |
… | |
1278 | { |
1278 | { |
1279 | if (!need_client_side_rendering ()) |
1279 | if (!need_client_side_rendering ()) |
1280 | { |
1280 | { |
1281 | if ((flags & tintNeeded)) |
1281 | if ((flags & tintNeeded)) |
1282 | { |
1282 | { |
1283 | if (tint_pixmap (tiled_root_pmap, root, window_width, window_height)) |
1283 | if (tint_pixmap (tiled_root_pmap, DefaultVisual (dpy, target->display->screen), window_width, window_height)) |
1284 | result |= transpPmapTinted; |
1284 | result |= transpPmapTinted; |
1285 | } |
1285 | } |
1286 | } /* server side rendering completed */ |
1286 | } /* server side rendering completed */ |
1287 | |
1287 | |
1288 | if (pixmap) |
1288 | if (pixmap) |