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.186 by sf-exg, Wed Dec 28 11:11:25 2011 UTC vs.
Revision 1.187 by sf-exg, Wed Dec 28 13:13:33 2011 UTC

374 if (tr_flags & BG_NEEDS_TINT) 374 if (tr_flags & BG_NEEDS_TINT)
375 { 375 {
376 ShadingInfo as_shade; 376 ShadingInfo as_shade;
377 as_shade.shading = shade; 377 as_shade.shading = shade;
378 378
379 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); 379 rgba c;
380 if (bg_flags & BG_TINT_SET)
381 tint.get (c); 380 tint.get (c);
382 as_shade.tintColor.red = c.r; 381 as_shade.tintColor.red = c.r;
383 as_shade.tintColor.green = c.g; 382 as_shade.tintColor.green = c.g;
384 as_shade.tintColor.blue = c.b; 383 as_shade.tintColor.blue = c.b;
385 384
386 background_tint = shading2tint32 (&as_shade); 385 background_tint = shading2tint32 (&as_shade);
960 rgba c; 959 rgba c;
961 bool has_shade = shade != 100; 960 bool has_shade = shade != 100;
962 961
963 bg_flags &= ~BG_TINT_FLAGS; 962 bg_flags &= ~BG_TINT_FLAGS;
964 963
965 if (bg_flags & BG_TINT_SET)
966 {
967 tint.get (c); 964 tint.get (c);
965
968 if (!has_shade 966 if (!has_shade
969 && (c.r <= 0x00ff || c.r >= 0xff00) 967 && (c.r <= 0x00ff || c.r >= 0xff00)
970 && (c.g <= 0x00ff || c.g >= 0xff00) 968 && (c.g <= 0x00ff || c.g >= 0xff00)
971 && (c.b <= 0x00ff || c.b >= 0xff00)) 969 && (c.b <= 0x00ff || c.b >= 0xff00))
972 bg_flags |= BG_TINT_BITAND; 970 bg_flags |= BG_TINT_BITAND;
973 }
974 971
975 if (has_shade || (bg_flags & BG_TINT_SET)) 972 if (has_shade
973 || c.r < 0xff00
974 || c.g < 0xff00
975 || c.b < 0xff00)
976 bg_flags |= BG_NEEDS_TINT; 976 bg_flags |= BG_NEEDS_TINT;
977} 977}
978 978
979bool 979bool
980rxvt_term::bg_set_tint (rxvt_color &new_tint) 980rxvt_term::bg_set_tint (rxvt_color &new_tint)
981{ 981{
982 if (!(bg_flags & BG_TINT_SET) || tint != new_tint) 982 if (tint != new_tint)
983 { 983 {
984 tint = new_tint; 984 tint = new_tint;
985 bg_flags |= BG_TINT_SET;
986 set_tint_shade_flags (); 985 set_tint_shade_flags ();
987 return true; 986 return true;
988 } 987 }
989 988
990 return false; 989 return false;
1123 } 1122 }
1124 } 1123 }
1125# if XRENDER 1124# if XRENDER
1126 else if (bg_flags & BG_HAS_RENDER) 1125 else if (bg_flags & BG_HAS_RENDER)
1127 { 1126 {
1128 rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC); 1127 rgba c;
1129 1128
1130 if (bg_flags & BG_TINT_SET)
1131 tint.get (c); 1129 tint.get (c);
1132 1130
1133 if (shade <= 100) 1131 if (shade <= 100)
1134 { 1132 {
1135 c.r = c.r * shade / 100; 1133 c.r = c.r * shade / 100;
1136 c.g = c.g * shade / 100; 1134 c.g = c.g * shade / 100;
1404 1402
1405void 1403void
1406rxvt_term::bg_init () 1404rxvt_term::bg_init ()
1407{ 1405{
1408#ifdef ENABLE_TRANSPARENCY 1406#ifdef ENABLE_TRANSPARENCY
1407 rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC);
1408 tint.set (this, c);
1409 shade = 100; 1409 shade = 100;
1410#endif 1410#endif
1411 1411
1412 bg_flags &= ~(BG_HAS_RENDER | BG_HAS_RENDER_CONV); 1412 bg_flags &= ~(BG_HAS_RENDER | BG_HAS_RENDER_CONV);
1413#if XRENDER 1413#if XRENDER
1516 break; 1516 break;
1517 default: 1517 default:
1518 return; /* we do not support this color depth */ 1518 return; /* we do not support this color depth */
1519 } 1519 }
1520 1520
1521 rgba c (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC); 1521 rgba c;
1522 1522
1523 if (bg_flags & BG_TINT_SET)
1524 tint.get (c); 1523 tint.get (c);
1525 1524
1526 /* prepare limits for color transformation (each channel is handled separately) */ 1525 /* prepare limits for color transformation (each channel is handled separately) */
1527 if (shade > 100) 1526 if (shade > 100)
1528 { 1527 {
1529 c.r = c.r * (200 - shade) / 100; 1528 c.r = c.r * (200 - shade) / 100;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines