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.92 by sf-exg, Mon Oct 18 23:28:48 2010 UTC vs.
Revision 1.93 by sf-exg, Tue Oct 19 14:44:30 2010 UTC

1624 RUINT32T mask_r, mask_g, mask_b; 1624 RUINT32T mask_r, mask_g, mask_b;
1625 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; 1625 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b;
1626 unsigned int lower_lim_r, lower_lim_g, lower_lim_b; 1626 unsigned int lower_lim_r, lower_lim_g, lower_lim_b;
1627 unsigned int upper_lim_r, upper_lim_g, upper_lim_b; 1627 unsigned int upper_lim_r, upper_lim_g, upper_lim_b;
1628 int i; 1628 int i;
1629 int host_byte_order = byteorder.big_endian () ? MSBFirst : LSBFirst;
1629 1630
1630 if (visual->c_class != TrueColor || srcImage->format != ZPixmap) return; 1631 if (visual->c_class != TrueColor || srcImage->format != ZPixmap) return;
1631 1632
1632 /* for convenience */ 1633 /* for convenience */
1633 mask_r = visual->red_mask; 1634 mask_r = visual->red_mask;
1740 tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b); 1741 tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b);
1741 lookup_b[i] = (tmp/65535)<<sh_b; 1742 lookup_b[i] = (tmp/65535)<<sh_b;
1742 } 1743 }
1743 1744
1744 /* apply table to input image (replacing colors by newly calculated ones) */ 1745 /* apply table to input image (replacing colors by newly calculated ones) */
1745 switch (srcImage->bits_per_pixel) 1746 if (srcImage->bits_per_pixel == 32
1747 && (srcImage->depth == 24 || srcImage->depth == 32)
1748 && srcImage->byte_order == host_byte_order)
1746 { 1749 {
1747 case 32:
1748 {
1749 RUINT32T *p1, *pf, *p, *pl; 1750 RUINT32T *p1, *pf, *p, *pl;
1750 p1 = (RUINT32T *) srcImage->data; 1751 p1 = (RUINT32T *) srcImage->data;
1751 pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); 1752 pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
1752 1753
1753 while (p1 < pf) 1754 while (p1 < pf)
1754 { 1755 {
1755 p = p1; 1756 p = p1;
1756 pl = p1 + srcImage->width; 1757 pl = p1 + srcImage->width;
1757 for (; p < pl; p++) 1758 for (; p < pl; p++)
1758 { 1759 {
1759 *p = lookup_r[(*p & 0xff0000)>>16] | 1760 *p = lookup_r[(*p & 0xff0000) >> 16] |
1760 lookup_g[(*p & 0x00ff00)>> 8] | 1761 lookup_g[(*p & 0x00ff00) >> 8] |
1761 lookup_b[(*p & 0x0000ff)] | 1762 lookup_b[(*p & 0x0000ff)] |
1762 (*p & ~0xffffff); 1763 (*p & 0xff000000);
1763 } 1764 }
1764 p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); 1765 p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line);
1765 } 1766 }
1766 break; 1767 }
1767 } 1768 else
1768 default: 1769 {
1769 for (int y = 0; y < srcImage->height; y++) 1770 for (int y = 0; y < srcImage->height; y++)
1770 for (int x = 0; x < srcImage->width; x++) 1771 for (int x = 0; x < srcImage->width; x++)
1771 { 1772 {
1772 unsigned long pixel = XGetPixel (srcImage, x, y); 1773 unsigned long pixel = XGetPixel (srcImage, x, y);
1773 pixel = lookup_r[(pixel & mask_r) >> sh_r] | 1774 pixel = lookup_r[(pixel & mask_r) >> sh_r] |
1774 lookup_g[(pixel & mask_g) >> sh_g] | 1775 lookup_g[(pixel & mask_g) >> sh_g] |
1775 lookup_b[(pixel & mask_b) >> sh_b]; 1776 lookup_b[(pixel & mask_b) >> sh_b];
1776 XPutPixel (srcImage, x, y, pixel); 1777 XPutPixel (srcImage, x, y, pixel);
1777 } 1778 }
1778 break;
1779 } 1779 }
1780 1780
1781 free (lookup); 1781 free (lookup);
1782} 1782}
1783#endif /* defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) */ 1783#endif /* defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines