… | |
… | |
953 | } |
953 | } |
954 | |
954 | |
955 | void |
955 | void |
956 | rxvt_term::set_tint_shade_flags () |
956 | rxvt_term::set_tint_shade_flags () |
957 | { |
957 | { |
958 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
958 | rgba c; |
959 | bool has_shade = shade != 100; |
959 | bool has_shade = shade != 100; |
960 | |
960 | |
961 | bg_flags &= ~BG_TINT_FLAGS; |
961 | bg_flags &= ~BG_TINT_FLAGS; |
962 | |
962 | |
963 | if (bg_flags & BG_TINT_SET) |
963 | if (bg_flags & BG_TINT_SET) |
… | |
… | |
1033 | bool |
1033 | bool |
1034 | rxvt_term::blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height) |
1034 | rxvt_term::blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height) |
1035 | { |
1035 | { |
1036 | bool ret = false; |
1036 | bool ret = false; |
1037 | #if XRENDER |
1037 | #if XRENDER |
|
|
1038 | if (!(bg_flags & BG_HAS_RENDER_CONV)) |
|
|
1039 | return false; |
|
|
1040 | |
1038 | int size = max (h_blurRadius, v_blurRadius) * 2 + 1; |
1041 | int size = max (h_blurRadius, v_blurRadius) * 2 + 1; |
1039 | double *kernel = (double *)malloc (size * sizeof (double)); |
1042 | double *kernel = (double *)malloc (size * sizeof (double)); |
1040 | XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); |
1043 | XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); |
1041 | |
1044 | |
1042 | XRenderPictureAttributes pa; |
1045 | XRenderPictureAttributes pa; |
… | |
… | |
1115 | XFillRectangle (dpy, pixmap, gc, 0, 0, width, height); |
1118 | XFillRectangle (dpy, pixmap, gc, 0, 0, width, height); |
1116 | ret = true; |
1119 | ret = true; |
1117 | XFreeGC (dpy, gc); |
1120 | XFreeGC (dpy, gc); |
1118 | } |
1121 | } |
1119 | } |
1122 | } |
1120 | else |
|
|
1121 | { |
|
|
1122 | # if XRENDER |
1123 | # if XRENDER |
|
|
1124 | else if (bg_flags & BG_HAS_RENDER) |
|
|
1125 | { |
1123 | rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC); |
1126 | rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC); |
1124 | |
1127 | |
1125 | if (bg_flags & BG_TINT_SET) |
1128 | if (bg_flags & BG_TINT_SET) |
1126 | tint.get (c); |
1129 | tint.get (c); |
1127 | |
1130 | |
… | |
… | |
1182 | ret = true; |
1185 | ret = true; |
1183 | |
1186 | |
1184 | XRenderFreePicture (dpy, mask_pic); |
1187 | XRenderFreePicture (dpy, mask_pic); |
1185 | XRenderFreePicture (dpy, overlay_pic); |
1188 | XRenderFreePicture (dpy, overlay_pic); |
1186 | XRenderFreePicture (dpy, back_pic); |
1189 | XRenderFreePicture (dpy, back_pic); |
|
|
1190 | } |
1187 | # endif |
1191 | # endif |
1188 | } |
|
|
1189 | |
1192 | |
1190 | return ret; |
1193 | return ret; |
1191 | } |
1194 | } |
1192 | |
1195 | |
1193 | /* |
1196 | /* |
… | |
… | |
1294 | result |= BG_IS_VALID | (bg_flags & BG_EFFECTS_FLAGS); |
1297 | result |= BG_IS_VALID | (bg_flags & BG_EFFECTS_FLAGS); |
1295 | XFreeGC (dpy, gc); |
1298 | XFreeGC (dpy, gc); |
1296 | |
1299 | |
1297 | if (!(bg_flags & BG_CLIENT_RENDER)) |
1300 | if (!(bg_flags & BG_CLIENT_RENDER)) |
1298 | { |
1301 | { |
1299 | if ((bg_flags & BG_NEEDS_BLUR) |
1302 | if (bg_flags & BG_NEEDS_BLUR) |
1300 | && (bg_flags & BG_HAS_RENDER_CONV)) |
|
|
1301 | { |
1303 | { |
1302 | if (blur_pixmap (bg_pixmap, visual, window_width, window_height)) |
1304 | if (blur_pixmap (bg_pixmap, visual, window_width, window_height)) |
1303 | result &= ~BG_NEEDS_BLUR; |
1305 | result &= ~BG_NEEDS_BLUR; |
1304 | } |
1306 | } |
1305 | if ((bg_flags & BG_NEEDS_TINT) |
1307 | if (bg_flags & BG_NEEDS_TINT) |
1306 | && (bg_flags & (BG_TINT_BITAND | BG_HAS_RENDER))) |
|
|
1307 | { |
1308 | { |
1308 | if (tint_pixmap (bg_pixmap, visual, window_width, window_height)) |
1309 | if (tint_pixmap (bg_pixmap, visual, window_width, window_height)) |
1309 | result &= ~BG_NEEDS_TINT; |
1310 | result &= ~BG_NEEDS_TINT; |
1310 | } |
1311 | } |
1311 | } /* server side rendering completed */ |
1312 | } /* server side rendering completed */ |
… | |
… | |
1325 | new_root_pixmap = get_pixmap_property (xa[XA_ESETROOT_PMAP_ID]); |
1326 | new_root_pixmap = get_pixmap_property (xa[XA_ESETROOT_PMAP_ID]); |
1326 | |
1327 | |
1327 | root_pixmap = new_root_pixmap; |
1328 | root_pixmap = new_root_pixmap; |
1328 | } |
1329 | } |
1329 | # endif /* ENABLE_TRANSPARENCY */ |
1330 | # endif /* ENABLE_TRANSPARENCY */ |
1330 | |
|
|
1331 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
|
|
1332 | static void shade_ximage (Visual *visual, XImage *ximage, int shade, const rgba &c); |
|
|
1333 | # endif |
|
|
1334 | |
1331 | |
1335 | bool |
1332 | bool |
1336 | rxvt_term::bg_render () |
1333 | rxvt_term::bg_render () |
1337 | { |
1334 | { |
1338 | unsigned long tr_flags = 0; |
1335 | unsigned long tr_flags = 0; |
… | |
… | |
1369 | if (result) |
1366 | if (result) |
1370 | { |
1367 | { |
1371 | /* our own client-side tinting */ |
1368 | /* our own client-side tinting */ |
1372 | //if (tr_flags & BG_NEEDS_TINT) |
1369 | //if (tr_flags & BG_NEEDS_TINT) |
1373 | if (1) |
1370 | if (1) |
1374 | { |
|
|
1375 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
|
|
1376 | if (bg_flags & BG_TINT_SET) |
|
|
1377 | tint.get (c); |
|
|
1378 | shade_ximage (DefaultVisual (dpy, display->screen), result, shade, c); |
1371 | tint_ximage (DefaultVisual (dpy, display->screen), result); |
1379 | } |
|
|
1380 | |
1372 | |
1381 | GC gc = XCreateGC (dpy, vt, 0UL, NULL); |
1373 | GC gc = XCreateGC (dpy, vt, 0UL, NULL); |
1382 | |
1374 | |
1383 | if (gc) |
1375 | if (gc) |
1384 | { |
1376 | { |
… | |
… | |
1447 | tmp += (mask >> sh) * low; |
1439 | tmp += (mask >> sh) * low; |
1448 | lookup[i] = (tmp / 0xffff) << sh; |
1440 | lookup[i] = (tmp / 0xffff) << sh; |
1449 | } |
1441 | } |
1450 | } |
1442 | } |
1451 | |
1443 | |
1452 | static void |
1444 | void |
1453 | shade_ximage (Visual *visual, XImage *ximage, int shade, const rgba &c) |
1445 | rxvt_term::tint_ximage (Visual *visual, XImage *ximage) |
1454 | { |
1446 | { |
1455 | int sh_r, sh_g, sh_b; |
1447 | int sh_r, sh_g, sh_b; |
1456 | uint32_t mask_r, mask_g, mask_b; |
1448 | uint32_t mask_r, mask_g, mask_b; |
1457 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1449 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1458 | unsigned short low; |
1450 | unsigned short low; |
… | |
… | |
1523 | break; |
1515 | break; |
1524 | default: |
1516 | default: |
1525 | return; /* we do not support this color depth */ |
1517 | return; /* we do not support this color depth */ |
1526 | } |
1518 | } |
1527 | |
1519 | |
|
|
1520 | rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC); |
|
|
1521 | |
|
|
1522 | if (bg_flags & BG_TINT_SET) |
|
|
1523 | tint.get (c); |
|
|
1524 | |
1528 | /* prepare limits for color transformation (each channel is handled separately) */ |
1525 | /* prepare limits for color transformation (each channel is handled separately) */ |
1529 | if (shade > 100) |
1526 | if (shade > 100) |
1530 | { |
1527 | { |
1531 | shade = 200 - shade; |
|
|
1532 | |
|
|
1533 | high.r = c.r * shade / 100; |
1528 | high.r = c.r * (200 - shade) / 100; |
1534 | high.g = c.g * shade / 100; |
1529 | high.g = c.g * (200 - shade) / 100; |
1535 | high.b = c.b * shade / 100; |
1530 | high.b = c.b * (200 - shade) / 100; |
1536 | |
1531 | |
1537 | low = 0xffff * (100 - shade) / 100; |
1532 | low = 0xffff * (shade - 100) / 100; |
1538 | } |
1533 | } |
1539 | else |
1534 | else |
1540 | { |
1535 | { |
1541 | high.r = c.r * shade / 100; |
1536 | high.r = c.r * shade / 100; |
1542 | high.g = c.g * shade / 100; |
1537 | high.g = c.g * shade / 100; |