… | |
… | |
1367 | if (gc) |
1367 | if (gc) |
1368 | { |
1368 | { |
1369 | XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); |
1369 | XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); |
1370 | result |= transpPmapTiled; |
1370 | result |= transpPmapTiled; |
1371 | XFreeGC (dpy, gc); |
1371 | XFreeGC (dpy, gc); |
1372 | } |
|
|
1373 | |
1372 | |
1374 | if (tiled_root_pmap != None) |
|
|
1375 | { |
|
|
1376 | if (!need_client_side_rendering ()) |
1373 | if (!need_client_side_rendering ()) |
1377 | { |
1374 | { |
1378 | if ((flags & blurNeeded) |
1375 | if ((flags & blurNeeded) |
1379 | && (flags & HAS_RENDER_CONV)) |
1376 | && (flags & HAS_RENDER_CONV)) |
1380 | { |
1377 | { |
… | |
… | |
1395 | pixmap = tiled_root_pmap; |
1392 | pixmap = tiled_root_pmap; |
1396 | pmap_width = window_width; |
1393 | pmap_width = window_width; |
1397 | pmap_height = window_height; |
1394 | pmap_height = window_height; |
1398 | pmap_depth = target->depth; |
1395 | pmap_depth = target->depth; |
1399 | } |
1396 | } |
|
|
1397 | else |
|
|
1398 | XFreePixmap (dpy, tiled_root_pmap); |
1400 | |
1399 | |
1401 | if (recoded_root_pmap != root_pixmap) |
1400 | if (recoded_root_pmap != root_pixmap) |
1402 | XFreePixmap (dpy, recoded_root_pmap); |
1401 | XFreePixmap (dpy, recoded_root_pmap); |
1403 | |
1402 | |
1404 | return result; |
1403 | return result; |
… | |
… | |
1414 | root_pixmap = new_root_pixmap; |
1413 | root_pixmap = new_root_pixmap; |
1415 | } |
1414 | } |
1416 | # endif /* ENABLE_TRANSPARENCY */ |
1415 | # endif /* ENABLE_TRANSPARENCY */ |
1417 | |
1416 | |
1418 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1417 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1419 | static void ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm); |
1418 | static void ShadeXImage(Visual *visual, XImage *srcImage, int shade, const rgba &c); |
1420 | # endif |
1419 | # endif |
1421 | |
1420 | |
1422 | bool |
1421 | bool |
1423 | bgPixmap_t::render () |
1422 | bgPixmap_t::render () |
1424 | { |
1423 | { |
… | |
… | |
1463 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1462 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1464 | { |
1463 | { |
1465 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1464 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1466 | if (flags & tintSet) |
1465 | if (flags & tintSet) |
1467 | tint.get (c); |
1466 | tint.get (c); |
1468 | ShadeXImage (DefaultVisual (target->dpy, target->display->screen), result, shade, c.r, c.g, c.b); |
1467 | ShadeXImage (DefaultVisual (target->dpy, target->display->screen), result, shade, c); |
1469 | } |
1468 | } |
1470 | |
1469 | |
1471 | GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); |
1470 | GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); |
1472 | |
1471 | |
1473 | if (gc) |
1472 | if (gc) |
… | |
… | |
1578 | |
1577 | |
1579 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1578 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1580 | /* taken from aterm-0.4.2 */ |
1579 | /* taken from aterm-0.4.2 */ |
1581 | |
1580 | |
1582 | static void |
1581 | static void |
1583 | ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm) |
1582 | ShadeXImage(Visual *visual, XImage *srcImage, int shade, const rgba &c) |
1584 | { |
1583 | { |
1585 | int sh_r, sh_g, sh_b; |
1584 | int sh_r, sh_g, sh_b; |
1586 | uint32_t mask_r, mask_g, mask_b; |
1585 | uint32_t mask_r, mask_g, mask_b; |
1587 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1586 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1588 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
1587 | rgba low; |
1589 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
1588 | rgba high; |
1590 | int i; |
1589 | int i; |
1591 | int host_byte_order = byteorder.big_endian () ? MSBFirst : LSBFirst; |
1590 | int host_byte_order = byteorder.big_endian () ? MSBFirst : LSBFirst; |
1592 | |
1591 | |
1593 | if (visual->c_class != TrueColor || srcImage->format != ZPixmap) return; |
1592 | if (visual->c_class != TrueColor || srcImage->format != ZPixmap) return; |
1594 | |
1593 | |
… | |
… | |
1659 | /* prepare limits for color transformation (each channel is handled separately) */ |
1658 | /* prepare limits for color transformation (each channel is handled separately) */ |
1660 | if (shade > 100) |
1659 | if (shade > 100) |
1661 | { |
1660 | { |
1662 | shade = 200 - shade; |
1661 | shade = 200 - shade; |
1663 | |
1662 | |
1664 | lower_lim_r = 65535-rm; |
1663 | high.r = (65535 - c.r) * shade / 100; |
1665 | lower_lim_g = 65535-gm; |
1664 | high.g = (65535 - c.g) * shade / 100; |
1666 | lower_lim_b = 65535-bm; |
1665 | high.b = (65535 - c.b) * shade / 100; |
1667 | |
1666 | |
1668 | lower_lim_r = 65535-(unsigned int)(((uint32_t)lower_lim_r)*((uint32_t)shade)/100); |
1667 | low.r = 65535 - high.r; |
1669 | lower_lim_g = 65535-(unsigned int)(((uint32_t)lower_lim_g)*((uint32_t)shade)/100); |
1668 | low.g = 65535 - high.g; |
1670 | lower_lim_b = 65535-(unsigned int)(((uint32_t)lower_lim_b)*((uint32_t)shade)/100); |
1669 | low.b = 65535 - high.b; |
1671 | |
|
|
1672 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
|
|
1673 | } |
1670 | } |
1674 | else |
1671 | else |
1675 | { |
1672 | { |
|
|
1673 | high.r = c.r * shade / 100; |
|
|
1674 | high.g = c.g * shade / 100; |
|
|
1675 | high.b = c.b * shade / 100; |
1676 | |
1676 | |
1677 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
1677 | low.r = low.g = low.b = 0; |
1678 | |
|
|
1679 | upper_lim_r = (unsigned int)((((uint32_t)rm)*((uint32_t)shade))/100); |
|
|
1680 | upper_lim_g = (unsigned int)((((uint32_t)gm)*((uint32_t)shade))/100); |
|
|
1681 | upper_lim_b = (unsigned int)((((uint32_t)bm)*((uint32_t)shade))/100); |
|
|
1682 | } |
1678 | } |
1683 | |
1679 | |
1684 | /* fill our lookup tables */ |
1680 | /* fill our lookup tables */ |
1685 | for (i = 0; i <= mask_r>>sh_r; i++) |
1681 | for (i = 0; i <= mask_r>>sh_r; i++) |
1686 | { |
1682 | { |
1687 | uint32_t tmp; |
1683 | uint32_t tmp; |
1688 | tmp = ((uint32_t)i)*((uint32_t)(upper_lim_r-lower_lim_r)); |
1684 | tmp = i * high.r; |
1689 | tmp += ((uint32_t)(mask_r>>sh_r))*((uint32_t)lower_lim_r); |
1685 | tmp += (mask_r>>sh_r) * low.r; |
1690 | lookup_r[i] = (tmp/65535)<<sh_r; |
1686 | lookup_r[i] = (tmp/65535)<<sh_r; |
1691 | } |
1687 | } |
1692 | for (i = 0; i <= mask_g>>sh_g; i++) |
1688 | for (i = 0; i <= mask_g>>sh_g; i++) |
1693 | { |
1689 | { |
1694 | uint32_t tmp; |
1690 | uint32_t tmp; |
1695 | tmp = ((uint32_t)i)*((uint32_t)(upper_lim_g-lower_lim_g)); |
1691 | tmp = i * high.g; |
1696 | tmp += ((uint32_t)(mask_g>>sh_g))*((uint32_t)lower_lim_g); |
1692 | tmp += (mask_g>>sh_g) * low.g; |
1697 | lookup_g[i] = (tmp/65535)<<sh_g; |
1693 | lookup_g[i] = (tmp/65535)<<sh_g; |
1698 | } |
1694 | } |
1699 | for (i = 0; i <= mask_b>>sh_b; i++) |
1695 | for (i = 0; i <= mask_b>>sh_b; i++) |
1700 | { |
1696 | { |
1701 | uint32_t tmp; |
1697 | uint32_t tmp; |
1702 | tmp = ((uint32_t)i)*((uint32_t)(upper_lim_b-lower_lim_b)); |
1698 | tmp = i * high.b; |
1703 | tmp += ((uint32_t)(mask_b>>sh_b))*((uint32_t)lower_lim_b); |
1699 | tmp += (mask_b>>sh_b) * low.b; |
1704 | lookup_b[i] = (tmp/65535)<<sh_b; |
1700 | lookup_b[i] = (tmp/65535)<<sh_b; |
1705 | } |
1701 | } |
1706 | |
1702 | |
1707 | /* apply table to input image (replacing colors by newly calculated ones) */ |
1703 | /* apply table to input image (replacing colors by newly calculated ones) */ |
1708 | if (srcImage->bits_per_pixel == 32 |
1704 | if (srcImage->bits_per_pixel == 32 |