… | |
… | |
181 | { |
181 | { |
182 | bool changed = false; |
182 | bool changed = false; |
183 | int geom_flags = 0; |
183 | int geom_flags = 0; |
184 | int x = 0, y = 0; |
184 | int x = 0, y = 0; |
185 | unsigned int w = 0, h = 0; |
185 | unsigned int w = 0, h = 0; |
186 | unsigned long new_flags = bg_flags & ~BG_GEOMETRY_FLAGS; |
186 | unsigned long new_flags = 0; |
187 | |
187 | |
188 | if (geom == NULL) |
188 | if (geom == NULL) |
189 | return false; |
189 | return false; |
190 | |
190 | |
191 | if (geom[0]) |
191 | if (geom[0]) |
… | |
… | |
283 | geom_flags |= XParseGeometry (arr[i], &x, &y, &w, &h); |
283 | geom_flags |= XParseGeometry (arr[i], &x, &y, &w, &h); |
284 | } /* done parsing ops */ |
284 | } /* done parsing ops */ |
285 | |
285 | |
286 | rxvt_free_strsplit (arr); |
286 | rxvt_free_strsplit (arr); |
287 | } |
287 | } |
|
|
288 | |
|
|
289 | new_flags |= bg_flags & ~BG_GEOMETRY_FLAGS; |
288 | |
290 | |
289 | if (!update) |
291 | if (!update) |
290 | { |
292 | { |
291 | if (!(geom_flags & XValue)) |
293 | if (!(geom_flags & XValue)) |
292 | x = y = defaultAlign; |
294 | x = y = defaultAlign; |
… | |
… | |
1327 | |
1329 | |
1328 | root_pixmap = new_root_pixmap; |
1330 | root_pixmap = new_root_pixmap; |
1329 | } |
1331 | } |
1330 | # endif /* ENABLE_TRANSPARENCY */ |
1332 | # endif /* ENABLE_TRANSPARENCY */ |
1331 | |
1333 | |
1332 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
|
|
1333 | static void shade_ximage (Visual *visual, XImage *ximage, int shade, const rgba &c); |
|
|
1334 | # endif |
|
|
1335 | |
|
|
1336 | bool |
1334 | bool |
1337 | rxvt_term::bg_render () |
1335 | rxvt_term::bg_render () |
1338 | { |
1336 | { |
1339 | unsigned long tr_flags = 0; |
1337 | unsigned long tr_flags = 0; |
1340 | |
1338 | |
… | |
… | |
1370 | if (result) |
1368 | if (result) |
1371 | { |
1369 | { |
1372 | /* our own client-side tinting */ |
1370 | /* our own client-side tinting */ |
1373 | //if (tr_flags & BG_NEEDS_TINT) |
1371 | //if (tr_flags & BG_NEEDS_TINT) |
1374 | if (1) |
1372 | if (1) |
1375 | { |
|
|
1376 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
|
|
1377 | if (bg_flags & BG_TINT_SET) |
|
|
1378 | tint.get (c); |
|
|
1379 | shade_ximage (DefaultVisual (dpy, display->screen), result, shade, c); |
1373 | tint_ximage (DefaultVisual (dpy, display->screen), result); |
1380 | } |
|
|
1381 | |
1374 | |
1382 | GC gc = XCreateGC (dpy, vt, 0UL, NULL); |
1375 | GC gc = XCreateGC (dpy, vt, 0UL, NULL); |
1383 | |
1376 | |
1384 | if (gc) |
1377 | if (gc) |
1385 | { |
1378 | { |
… | |
… | |
1448 | tmp += (mask >> sh) * low; |
1441 | tmp += (mask >> sh) * low; |
1449 | lookup[i] = (tmp / 0xffff) << sh; |
1442 | lookup[i] = (tmp / 0xffff) << sh; |
1450 | } |
1443 | } |
1451 | } |
1444 | } |
1452 | |
1445 | |
1453 | static void |
1446 | void |
1454 | shade_ximage (Visual *visual, XImage *ximage, int shade, const rgba &c) |
1447 | rxvt_term::tint_ximage (Visual *visual, XImage *ximage) |
1455 | { |
1448 | { |
1456 | int sh_r, sh_g, sh_b; |
1449 | int sh_r, sh_g, sh_b; |
1457 | uint32_t mask_r, mask_g, mask_b; |
1450 | uint32_t mask_r, mask_g, mask_b; |
1458 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1451 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1459 | unsigned short low; |
1452 | unsigned short low; |
1460 | rgba high; |
|
|
1461 | int host_byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; |
1453 | int host_byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; |
1462 | |
1454 | |
1463 | if (visual->c_class != TrueColor || ximage->format != ZPixmap) return; |
1455 | if (visual->c_class != TrueColor || ximage->format != ZPixmap) return; |
1464 | |
1456 | |
1465 | /* for convenience */ |
1457 | /* for convenience */ |
… | |
… | |
1524 | break; |
1516 | break; |
1525 | default: |
1517 | default: |
1526 | return; /* we do not support this color depth */ |
1518 | return; /* we do not support this color depth */ |
1527 | } |
1519 | } |
1528 | |
1520 | |
|
|
1521 | rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC); |
|
|
1522 | |
|
|
1523 | if (bg_flags & BG_TINT_SET) |
|
|
1524 | tint.get (c); |
|
|
1525 | |
1529 | /* prepare limits for color transformation (each channel is handled separately) */ |
1526 | /* prepare limits for color transformation (each channel is handled separately) */ |
1530 | if (shade > 100) |
1527 | if (shade > 100) |
1531 | { |
1528 | { |
1532 | shade = 200 - shade; |
1529 | c.r = c.r * (200 - shade) / 100; |
|
|
1530 | c.g = c.g * (200 - shade) / 100; |
|
|
1531 | c.b = c.b * (200 - shade) / 100; |
1533 | |
1532 | |
1534 | high.r = c.r * shade / 100; |
|
|
1535 | high.g = c.g * shade / 100; |
|
|
1536 | high.b = c.b * shade / 100; |
|
|
1537 | |
|
|
1538 | low = 0xffff * (100 - shade) / 100; |
1533 | low = 0xffff * (shade - 100) / 100; |
1539 | } |
1534 | } |
1540 | else |
1535 | else |
1541 | { |
1536 | { |
1542 | high.r = c.r * shade / 100; |
1537 | c.r = c.r * shade / 100; |
1543 | high.g = c.g * shade / 100; |
1538 | c.g = c.g * shade / 100; |
1544 | high.b = c.b * shade / 100; |
1539 | c.b = c.b * shade / 100; |
1545 | |
1540 | |
1546 | low = 0; |
1541 | low = 0; |
1547 | } |
1542 | } |
1548 | |
1543 | |
1549 | /* fill our lookup tables */ |
1544 | /* fill our lookup tables */ |
1550 | fill_lut (lookup_r, mask_r, sh_r, low, high.r); |
1545 | fill_lut (lookup_r, mask_r, sh_r, low, c.r); |
1551 | fill_lut (lookup_g, mask_g, sh_g, low, high.g); |
1546 | fill_lut (lookup_g, mask_g, sh_g, low, c.g); |
1552 | fill_lut (lookup_b, mask_b, sh_b, low, high.b); |
1547 | fill_lut (lookup_b, mask_b, sh_b, low, c.b); |
1553 | |
1548 | |
1554 | /* apply table to input image (replacing colors by newly calculated ones) */ |
1549 | /* apply table to input image (replacing colors by newly calculated ones) */ |
1555 | if (ximage->bits_per_pixel == 32 |
1550 | if (ximage->bits_per_pixel == 32 |
1556 | && (ximage->depth == 24 || ximage->depth == 32) |
1551 | && (ximage->depth == 24 || ximage->depth == 32) |
1557 | && ximage->byte_order == host_byte_order) |
1552 | && ximage->byte_order == host_byte_order) |