ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/background.C
(Generate patch)

Comparing rxvt-unicode/src/background.C (file contents):
Revision 1.177 by sf-exg, Wed Dec 14 12:07:12 2011 UTC vs.
Revision 1.180 by sf-exg, Sat Dec 24 09:44:23 2011 UTC

1277 bg_pmap_width = window_width; 1277 bg_pmap_width = window_width;
1278 bg_pmap_height = window_height; 1278 bg_pmap_height = window_height;
1279 } 1279 }
1280 1280
1281 /* straightforward pixmap copy */ 1281 /* straightforward pixmap copy */
1282 while (sx < 0) sx += root_width; 1282 while (sx < 0) sx += root_pmap_width;
1283 while (sy < 0) sy += root_height; 1283 while (sy < 0) sy += root_pmap_height;
1284 1284
1285 gcv.tile = recoded_root_pmap; 1285 gcv.tile = recoded_root_pmap;
1286 gcv.fill_style = FillTiled; 1286 gcv.fill_style = FillTiled;
1287 gcv.ts_x_origin = -sx; 1287 gcv.ts_x_origin = -sx;
1288 gcv.ts_y_origin = -sy; 1288 gcv.ts_y_origin = -sy;
1435#endif /* HAVE_BG_PIXMAP */ 1435#endif /* HAVE_BG_PIXMAP */
1436 1436
1437#if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) 1437#if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE)
1438/* based on code from aterm-0.4.2 */ 1438/* based on code from aterm-0.4.2 */
1439 1439
1440static inline void
1441fill_lut (uint32_t *lookup, uint32_t mask, int sh, unsigned short low, unsigned short high)
1442{
1443 for (int i = 0; i <= mask >> sh; i++)
1444 {
1445 uint32_t tmp;
1446 tmp = i * high;
1447 tmp += (mask >> sh) * low;
1448 lookup[i] = (tmp / 0xffff) << sh;
1449 }
1450}
1451
1440static void 1452static void
1441shade_ximage (Visual *visual, XImage *ximage, int shade, const rgba &c) 1453shade_ximage (Visual *visual, XImage *ximage, int shade, const rgba &c)
1442{ 1454{
1443 int sh_r, sh_g, sh_b; 1455 int sh_r, sh_g, sh_b;
1444 uint32_t mask_r, mask_g, mask_b; 1456 uint32_t mask_r, mask_g, mask_b;
1445 uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; 1457 uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b;
1446 rgba low; 1458 unsigned short low;
1447 rgba high; 1459 rgba high;
1448 int i;
1449 int host_byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; 1460 int host_byte_order = ecb_big_endian () ? MSBFirst : LSBFirst;
1450 1461
1451 if (visual->c_class != TrueColor || ximage->format != ZPixmap) return; 1462 if (visual->c_class != TrueColor || ximage->format != ZPixmap) return;
1452 1463
1453 /* for convenience */ 1464 /* for convenience */
1521 1532
1522 high.r = c.r * shade / 100; 1533 high.r = c.r * shade / 100;
1523 high.g = c.g * shade / 100; 1534 high.g = c.g * shade / 100;
1524 high.b = c.b * shade / 100; 1535 high.b = c.b * shade / 100;
1525 1536
1526 low.r = 65535 * (100 - shade) / 100; 1537 low = 0xffff * (100 - shade) / 100;
1527 low.g = 65535 * (100 - shade) / 100;
1528 low.b = 65535 * (100 - shade) / 100;
1529 } 1538 }
1530 else 1539 else
1531 { 1540 {
1532 high.r = c.r * shade / 100; 1541 high.r = c.r * shade / 100;
1533 high.g = c.g * shade / 100; 1542 high.g = c.g * shade / 100;
1534 high.b = c.b * shade / 100; 1543 high.b = c.b * shade / 100;
1535 1544
1536 low.r = low.g = low.b = 0; 1545 low = 0;
1537 } 1546 }
1538 1547
1539 /* fill our lookup tables */ 1548 /* fill our lookup tables */
1540 for (i = 0; i <= mask_r>>sh_r; i++) 1549 fill_lut (lookup_r, mask_r, sh_r, low, high.r);
1541 { 1550 fill_lut (lookup_g, mask_g, sh_g, low, high.g);
1542 uint32_t tmp; 1551 fill_lut (lookup_b, mask_b, sh_b, low, high.b);
1543 tmp = i * high.r;
1544 tmp += (mask_r>>sh_r) * low.r;
1545 lookup_r[i] = (tmp/65535)<<sh_r;
1546 }
1547 for (i = 0; i <= mask_g>>sh_g; i++)
1548 {
1549 uint32_t tmp;
1550 tmp = i * high.g;
1551 tmp += (mask_g>>sh_g) * low.g;
1552 lookup_g[i] = (tmp/65535)<<sh_g;
1553 }
1554 for (i = 0; i <= mask_b>>sh_b; i++)
1555 {
1556 uint32_t tmp;
1557 tmp = i * high.b;
1558 tmp += (mask_b>>sh_b) * low.b;
1559 lookup_b[i] = (tmp/65535)<<sh_b;
1560 }
1561 1552
1562 /* apply table to input image (replacing colors by newly calculated ones) */ 1553 /* apply table to input image (replacing colors by newly calculated ones) */
1563 if (ximage->bits_per_pixel == 32 1554 if (ximage->bits_per_pixel == 32
1564 && (ximage->depth == 24 || ximage->depth == 32) 1555 && (ximage->depth == 24 || ximage->depth == 32)
1565 && ximage->byte_order == host_byte_order) 1556 && ximage->byte_order == host_byte_order)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines