… | |
… | |
476 | } |
476 | } |
477 | |
477 | |
478 | flags &= ~sizeSensitive; |
478 | flags &= ~sizeSensitive; |
479 | if (h_scale != 0 || v_scale != 0 |
479 | if (h_scale != 0 || v_scale != 0 |
480 | || h_align != 0 || v_align != 0 |
480 | || h_align != 0 || v_align != 0 |
481 | || image_width > target_width || image_height > target_height) |
481 | || w > target_width || h > target_height) |
482 | flags |= sizeSensitive; |
482 | flags |= sizeSensitive; |
483 | } |
483 | } |
484 | |
484 | |
485 | # ifdef HAVE_AFTERIMAGE |
485 | # ifdef HAVE_AFTERIMAGE |
486 | bool |
486 | bool |
… | |
… | |
616 | layers[0].clip_width = target_width; |
616 | layers[0].clip_width = target_width; |
617 | layers[0].clip_height = target_height; |
617 | layers[0].clip_height = target_height; |
618 | layers[0].tint = background_tint; |
618 | layers[0].tint = background_tint; |
619 | layers[1].im = result; |
619 | layers[1].im = result; |
620 | |
620 | |
621 | if (w <= 0) |
621 | if (h_scale == 0 || v_scale == 0) |
622 | { |
622 | { |
623 | /* tile horizontally */ |
623 | /* tile horizontally */ |
624 | while (x > 0) x -= (int)result->width; |
624 | while (x > 0) x -= (int)result->width; |
625 | layers[1].dst_x = x; |
625 | layers[1].dst_x = x; |
626 | layers[1].clip_width = result->width+target_width; |
626 | layers[1].clip_width = result->width+target_width; |
… | |
… | |
630 | /* clip horizontally */ |
630 | /* clip horizontally */ |
631 | layers[1].dst_x = x; |
631 | layers[1].dst_x = x; |
632 | layers[1].clip_width = result->width; |
632 | layers[1].clip_width = result->width; |
633 | } |
633 | } |
634 | |
634 | |
635 | if (h <= 0) |
635 | if (h_scale == 0 || v_scale == 0) |
636 | { |
636 | { |
637 | while (y > 0) y -= (int)result->height; |
637 | while (y > 0) y -= (int)result->height; |
638 | layers[1].dst_y = y; |
638 | layers[1].dst_y = y; |
639 | layers[1].clip_height = result->height + target_height; |
639 | layers[1].clip_height = result->height + target_height; |
640 | } |
640 | } |
… | |
… | |
1001 | } |
1001 | } |
1002 | |
1002 | |
1003 | bool |
1003 | bool |
1004 | bgPixmap_t::set_tint (rxvt_color &new_tint) |
1004 | bgPixmap_t::set_tint (rxvt_color &new_tint) |
1005 | { |
1005 | { |
1006 | if (tint != new_tint) |
1006 | if (!(flags & tintSet) || tint != new_tint) |
1007 | { |
1007 | { |
1008 | unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade); |
1008 | unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade); |
1009 | tint = new_tint; |
1009 | tint = new_tint; |
1010 | flags = (flags & ~tintFlags) | new_flags | tintSet; |
1010 | flags = (flags & ~tintFlags) | new_flags | tintSet; |
1011 | return true; |
1011 | return true; |
… | |
… | |
1048 | |
1048 | |
1049 | return false; |
1049 | return false; |
1050 | } |
1050 | } |
1051 | |
1051 | |
1052 | bool |
1052 | bool |
1053 | bgPixmap_t::tint_pixmap (Pixmap pixmap) |
1053 | bgPixmap_t::tint_pixmap (Pixmap pixmap, Window root, int width, int height) |
1054 | { |
1054 | { |
1055 | Window root = target->display->root; |
|
|
1056 | Display *dpy = target->dpy; |
1055 | Display *dpy = target->dpy; |
1057 | int window_width = target->szHint.width; |
|
|
1058 | int window_height = target->szHint.height; |
|
|
1059 | bool ret = false; |
1056 | bool ret = false; |
1060 | |
1057 | |
1061 | if (flags & tintWholesome) |
1058 | if (flags & tintWholesome) |
1062 | { |
1059 | { |
1063 | XGCValues gcv; |
1060 | XGCValues gcv; |
… | |
… | |
1070 | gcv.function = GXand; |
1067 | gcv.function = GXand; |
1071 | gcv.fill_style = FillSolid; |
1068 | gcv.fill_style = FillSolid; |
1072 | gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); |
1069 | gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); |
1073 | if (gc) |
1070 | if (gc) |
1074 | { |
1071 | { |
1075 | XFillRectangle (dpy, pixmap, gc, 0, 0, window_width, window_height); |
1072 | XFillRectangle (dpy, pixmap, gc, 0, 0, width, height); |
1076 | ret = true; |
1073 | ret = true; |
1077 | XFreeGC (dpy, gc); |
1074 | XFreeGC (dpy, gc); |
1078 | } |
1075 | } |
1079 | } |
1076 | } |
1080 | else |
1077 | else |
… | |
… | |
1091 | c.g = (c.g * shade) / 100; |
1088 | c.g = (c.g * shade) / 100; |
1092 | c.b = (c.b * shade) / 100; |
1089 | c.b = (c.b * shade) / 100; |
1093 | } |
1090 | } |
1094 | else if (shade > 100 && shade < 200) |
1091 | else if (shade > 100 && shade < 200) |
1095 | { |
1092 | { |
1096 | c.r = (c.r * (200 - shade)) / 100; |
1093 | c.r = ((0xffff - c.r) * (200 - shade)) / 100; |
1097 | c.g = (c.g * (200 - shade)) / 100; |
1094 | c.g = ((0xffff - c.g) * (200 - shade)) / 100; |
1098 | c.b = (c.b * (200 - shade)) / 100; |
1095 | c.b = ((0xffff - c.b) * (200 - shade)) / 100; |
1099 | } |
1096 | } |
1100 | |
1097 | |
1101 | XRenderPictFormat pf; |
|
|
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, |
1098 | XRenderPictFormat *solid_format = XRenderFindStandardFormat (dpy, PictStandardARGB32); |
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))); |
1099 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
1119 | XRenderPictureAttributes pa; |
1100 | XRenderPictureAttributes pa; |
1120 | |
1101 | |
1121 | Picture back_pic = XRenderCreatePicture (dpy, pixmap, root_format, 0, &pa); |
1102 | Picture back_pic = XRenderCreatePicture (dpy, pixmap, root_format, 0, &pa); |
1122 | |
1103 | |
… | |
… | |
1142 | mask_c.alpha = 0; |
1123 | mask_c.alpha = 0; |
1143 | mask_c.red = 0xffff - c.r; |
1124 | mask_c.red = 0xffff - c.r; |
1144 | mask_c.green = 0xffff - c.g; |
1125 | mask_c.green = 0xffff - c.g; |
1145 | mask_c.blue = 0xffff - c.b; |
1126 | mask_c.blue = 0xffff - c.b; |
1146 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
1127 | 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); |
1128 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, width, height); |
1148 | ret = true; |
1129 | ret = true; |
1149 | } |
1130 | } |
1150 | |
1131 | |
1151 | XRenderFreePicture (dpy, mask_pic); |
1132 | XRenderFreePicture (dpy, mask_pic); |
1152 | XRenderFreePicture (dpy, overlay_pic); |
1133 | XRenderFreePicture (dpy, overlay_pic); |
… | |
… | |
1295 | { |
1276 | { |
1296 | if (!need_client_side_rendering ()) |
1277 | if (!need_client_side_rendering ()) |
1297 | { |
1278 | { |
1298 | if ((flags & tintNeeded)) |
1279 | if ((flags & tintNeeded)) |
1299 | { |
1280 | { |
1300 | if (tint_pixmap (tiled_root_pmap)) |
1281 | if (tint_pixmap (tiled_root_pmap, root, window_width, window_height)) |
1301 | result |= transpPmapTinted; |
1282 | result |= transpPmapTinted; |
1302 | } |
1283 | } |
1303 | } /* server side rendering completed */ |
1284 | } /* server side rendering completed */ |
1304 | |
1285 | |
1305 | if (pixmap) |
1286 | if (pixmap) |