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.193 by sf-exg, Sun Jan 1 14:31:29 2012 UTC vs.
Revision 1.194 by sf-exg, Sun Jan 1 17:43:47 2012 UTC

392 if (tr_flags & BG_NEEDS_TINT) 392 if (tr_flags & BG_NEEDS_TINT)
393 { 393 {
394 ShadingInfo as_shade; 394 ShadingInfo as_shade;
395 as_shade.shading = shade; 395 as_shade.shading = shade;
396 396
397 rgba c; 397 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC);
398 if (bg_flags & BG_TINT_SET)
398 tint.get (c); 399 tint.get (c);
399 as_shade.tintColor.red = c.r; 400 as_shade.tintColor.red = c.r;
400 as_shade.tintColor.green = c.g; 401 as_shade.tintColor.green = c.g;
401 as_shade.tintColor.blue = c.b; 402 as_shade.tintColor.blue = c.b;
402 403
403 background_tint = shading2tint32 (&as_shade); 404 background_tint = shading2tint32 (&as_shade);
972 rgba c; 973 rgba c;
973 bool has_shade = shade != 100; 974 bool has_shade = shade != 100;
974 975
975 bg_flags &= ~BG_TINT_FLAGS; 976 bg_flags &= ~BG_TINT_FLAGS;
976 977
978 if (bg_flags & BG_TINT_SET)
979 {
977 tint.get (c); 980 tint.get (c);
978
979 if (!has_shade 981 if (!has_shade
980 && (c.r <= 0x00ff || c.r >= 0xff00) 982 && (c.r <= 0x00ff || c.r >= 0xff00)
981 && (c.g <= 0x00ff || c.g >= 0xff00) 983 && (c.g <= 0x00ff || c.g >= 0xff00)
982 && (c.b <= 0x00ff || c.b >= 0xff00)) 984 && (c.b <= 0x00ff || c.b >= 0xff00))
983 bg_flags |= BG_TINT_BITAND; 985 bg_flags |= BG_TINT_BITAND;
986 }
984 987
985 if (has_shade 988 if (has_shade || (bg_flags & BG_TINT_SET))
986 || c.r < 0xff00
987 || c.g < 0xff00
988 || c.b < 0xff00)
989 bg_flags |= BG_NEEDS_TINT; 989 bg_flags |= BG_NEEDS_TINT;
990} 990}
991 991
992bool 992bool
993rxvt_term::bg_set_tint (rxvt_color &new_tint) 993rxvt_term::bg_set_tint (rxvt_color &new_tint)
994{ 994{
995 if (tint != new_tint) 995 if (!(bg_flags & BG_TINT_SET) || tint != new_tint)
996 { 996 {
997 tint = new_tint; 997 tint = new_tint;
998 bg_flags |= BG_TINT_SET;
998 set_tint_shade_flags (); 999 set_tint_shade_flags ();
999 return true; 1000 return true;
1000 } 1001 }
1001 1002
1002 return false; 1003 return false;
1128 } 1129 }
1129 } 1130 }
1130# if XRENDER 1131# if XRENDER
1131 else if (bg_flags & BG_HAS_RENDER) 1132 else if (bg_flags & BG_HAS_RENDER)
1132 { 1133 {
1133 rgba c; 1134 rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC);
1134 1135
1136 if (bg_flags & BG_TINT_SET)
1135 tint.get (c); 1137 tint.get (c);
1136 1138
1137 if (shade <= 100) 1139 if (shade <= 100)
1138 { 1140 {
1139 c.r = c.r * shade / 100; 1141 c.r = c.r * shade / 100;
1140 c.g = c.g * shade / 100; 1142 c.g = c.g * shade / 100;
1387 1389
1388void 1390void
1389rxvt_term::bg_init () 1391rxvt_term::bg_init ()
1390{ 1392{
1391#ifdef ENABLE_TRANSPARENCY 1393#ifdef ENABLE_TRANSPARENCY
1392 rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC);
1393 tint.set (this, c);
1394 shade = 100; 1394 shade = 100;
1395#endif 1395#endif
1396 1396
1397 bg_flags &= ~(BG_HAS_RENDER | BG_HAS_RENDER_CONV); 1397 bg_flags &= ~(BG_HAS_RENDER | BG_HAS_RENDER_CONV);
1398#if XRENDER 1398#if XRENDER
1501 break; 1501 break;
1502 default: 1502 default:
1503 return; /* we do not support this color depth */ 1503 return; /* we do not support this color depth */
1504 } 1504 }
1505 1505
1506 rgba c; 1506 rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC);
1507 1507
1508 if (bg_flags & BG_TINT_SET)
1508 tint.get (c); 1509 tint.get (c);
1509 1510
1510 /* prepare limits for color transformation (each channel is handled separately) */ 1511 /* prepare limits for color transformation (each channel is handled separately) */
1511 if (shade > 100) 1512 if (shade > 100)
1512 { 1513 {
1513 c.r = c.r * (200 - shade) / 100; 1514 c.r = c.r * (200 - shade) / 100;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines