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.179 by sf-exg, Sat Dec 24 09:44:10 2011 UTC vs.
Revision 1.182 by sf-exg, Sun Dec 25 17:01:21 2011 UTC

953} 953}
954 954
955void 955void
956rxvt_term::set_tint_shade_flags () 956rxvt_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)
1033bool 1033bool
1034rxvt_term::blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height) 1034rxvt_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 */
1453shade_ximage (Visual *visual, XImage *ximage, int shade, const rgba &c) 1454shade_ximage (Visual *visual, XImage *ximage, int shade, const rgba &c)
1454{ 1455{
1455 int sh_r, sh_g, sh_b; 1456 int sh_r, sh_g, sh_b;
1456 uint32_t mask_r, mask_g, mask_b; 1457 uint32_t mask_r, mask_g, mask_b;
1457 uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; 1458 uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b;
1458 rgba low; 1459 unsigned short low;
1459 rgba high; 1460 rgba high;
1460 int host_byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; 1461 int host_byte_order = ecb_big_endian () ? MSBFirst : LSBFirst;
1461 1462
1462 if (visual->c_class != TrueColor || ximage->format != ZPixmap) return; 1463 if (visual->c_class != TrueColor || ximage->format != ZPixmap) return;
1463 1464
1532 1533
1533 high.r = c.r * shade / 100; 1534 high.r = c.r * shade / 100;
1534 high.g = c.g * shade / 100; 1535 high.g = c.g * shade / 100;
1535 high.b = c.b * shade / 100; 1536 high.b = c.b * shade / 100;
1536 1537
1537 low.r = 65535 * (100 - shade) / 100; 1538 low = 0xffff * (100 - shade) / 100;
1538 low.g = 65535 * (100 - shade) / 100;
1539 low.b = 65535 * (100 - shade) / 100;
1540 } 1539 }
1541 else 1540 else
1542 { 1541 {
1543 high.r = c.r * shade / 100; 1542 high.r = c.r * shade / 100;
1544 high.g = c.g * shade / 100; 1543 high.g = c.g * shade / 100;
1545 high.b = c.b * shade / 100; 1544 high.b = c.b * shade / 100;
1546 1545
1547 low.r = low.g = low.b = 0; 1546 low = 0;
1548 } 1547 }
1549 1548
1550 /* fill our lookup tables */ 1549 /* fill our lookup tables */
1551 fill_lut (lookup_r, mask_r, sh_r, low.r, high.r); 1550 fill_lut (lookup_r, mask_r, sh_r, low, high.r);
1552 fill_lut (lookup_g, mask_g, sh_g, low.g, high.g); 1551 fill_lut (lookup_g, mask_g, sh_g, low, high.g);
1553 fill_lut (lookup_b, mask_b, sh_b, low.b, high.b); 1552 fill_lut (lookup_b, mask_b, sh_b, low, high.b);
1554 1553
1555 /* apply table to input image (replacing colors by newly calculated ones) */ 1554 /* apply table to input image (replacing colors by newly calculated ones) */
1556 if (ximage->bits_per_pixel == 32 1555 if (ximage->bits_per_pixel == 32
1557 && (ximage->depth == 24 || ximage->depth == 32) 1556 && (ximage->depth == 24 || ximage->depth == 32)
1558 && ximage->byte_order == host_byte_order) 1557 && ximage->byte_order == host_byte_order)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines