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.145 by sf-exg, Fri Jan 28 00:21:10 2011 UTC vs.
Revision 1.146 by sf-exg, Sat Jan 29 17:50:31 2011 UTC

943 bg_flags |= BG_NEEDS_BLUR; 943 bg_flags |= BG_NEEDS_BLUR;
944 944
945 return changed; 945 return changed;
946} 946}
947 947
948static inline unsigned long 948void
949compute_tint_shade_flags (rxvt_color *tint, int shade) 949rxvt_term::set_tint_shade_flags ()
950{ 950{
951 unsigned long flags = 0;
952 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); 951 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC);
953 bool has_shade = shade != 100; 952 bool has_shade = shade != 100;
954 953
955 if (tint) 954 bg_flags &= ~BG_TINT_FLAGS;
955
956 if (bg_flags & BG_TINT_SET)
956 { 957 {
957 tint->get (c); 958 tint.get (c);
958 if (!has_shade 959 if (!has_shade
959 && (c.r <= 0x00ff || c.r >= 0xff00) 960 && (c.r <= 0x00ff || c.r >= 0xff00)
960 && (c.g <= 0x00ff || c.g >= 0xff00) 961 && (c.g <= 0x00ff || c.g >= 0xff00)
961 && (c.b <= 0x00ff || c.b >= 0xff00)) 962 && (c.b <= 0x00ff || c.b >= 0xff00))
962 flags |= rxvt_term::BG_TINT_BITAND; 963 bg_flags |= BG_TINT_BITAND;
963 } 964 }
964 965
965 if (has_shade || tint) 966 if (has_shade || (bg_flags & BG_TINT_SET))
966 flags |= rxvt_term::BG_NEEDS_TINT; 967 bg_flags |= BG_NEEDS_TINT;
967
968 return flags;
969} 968}
970 969
971bool 970bool
972rxvt_term::bg_set_tint (rxvt_color &new_tint) 971rxvt_term::bg_set_tint (rxvt_color &new_tint)
973{ 972{
974 if (!(bg_flags & BG_TINT_SET) || tint != new_tint) 973 if (!(bg_flags & BG_TINT_SET) || tint != new_tint)
975 { 974 {
976 unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade);
977 tint = new_tint; 975 tint = new_tint;
978 bg_flags = (bg_flags & ~BG_TINT_FLAGS) | new_flags | BG_TINT_SET; 976 bg_flags |= BG_TINT_SET;
977 set_tint_shade_flags ();
979 return true; 978 return true;
980 } 979 }
981 980
982 return false; 981 return false;
983} 982}
991 if (new_shade < 0) 990 if (new_shade < 0)
992 new_shade = 200 - (100 + new_shade); 991 new_shade = 200 - (100 + new_shade);
993 992
994 if (new_shade != shade) 993 if (new_shade != shade)
995 { 994 {
996 unsigned long new_flags = compute_tint_shade_flags ((bg_flags & BG_TINT_SET) ? &tint : NULL, new_shade);
997 shade = new_shade; 995 shade = new_shade;
998 bg_flags = (bg_flags & ~BG_TINT_FLAGS) | new_flags; 996 set_tint_shade_flags ();
999 return true; 997 return true;
1000 } 998 }
1001 999
1002 return false; 1000 return false;
1003} 1001}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines