aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2006-04-12 03:01:06 +0000
committerJohannes Schickel2006-04-12 03:01:06 +0000
commite02625db6aeb9a25cff653d71ecedd13e2c1bb11 (patch)
tree6aa4bfd39403e08bd8e5af84fb4323f3362fd853
parent3fab2f4898641a3cdbbc0b3f8d22a14a842b192c (diff)
downloadscummvm-rg350-e02625db6aeb9a25cff653d71ecedd13e2c1bb11.tar.gz
scummvm-rg350-e02625db6aeb9a25cff653d71ecedd13e2c1bb11.tar.bz2
scummvm-rg350-e02625db6aeb9a25cff653d71ecedd13e2c1bb11.zip
Speeds up calcGradient again a little bit.
Also this should fix a bug in getColorAlphaImpl (I'm not 100% sure if it was wrong before though) svn-id: r21818
-rw-r--r--gui/ThemeNew.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp
index 2c400328e3..fb6f2099cb 100644
--- a/gui/ThemeNew.cpp
+++ b/gui/ThemeNew.cpp
@@ -1540,8 +1540,9 @@ OverlayColor ThemeNew::calcCustomColor(OverlayColor col, bool cache) {
template<class T>
inline OverlayColor getColorAlphaImpl(OverlayColor col1, OverlayColor col2, int alpha) {
OverlayColor output = 0;
- output |= ((alpha * ((col1 & T::kRBMask) - (col2 & T::kRBMask)) >> 8) + (col2 & T::kRBMask)) & T::kRBMask;
+ output |= ((alpha * ((col1 & T::kRedMask) - (col2 & T::kRedMask)) >> 8) + (col2 & T::kRedMask)) & T::kRedMask;
output |= ((alpha * ((col1 & T::kGreenMask) - (col2 & T::kGreenMask)) >> 8) + (col2 & T::kGreenMask)) & T::kGreenMask;
+ output |= ((alpha * ((col1 & T::kBlueMask) - (col2 & T::kBlueMask)) >> 8) + (col2 & T::kBlueMask)) & T::kBlueMask;
return output;
}
@@ -1556,9 +1557,9 @@ OverlayColor getColorAlpha(OverlayColor col1, OverlayColor col2, int alpha) {
template<class T>
inline OverlayColor calcGradient(OverlayColor start, OverlayColor end, int pos) {
OverlayColor output = 0;
- output |= ((start & T::kRedMask) + (((((end & T::kRedMask) - (start & T::kRedMask))) * pos >> 12) & T::kRedMask)) & T::kRedMask;
- output |= ((start & T::kGreenMask) + (((((end & T::kGreenMask) - (start & T::kGreenMask))) * pos >> 12) & T::kGreenMask)) & T::kGreenMask;
- output |= ((start & T::kBlueMask) + (((((end & T::kBlueMask) - (start & T::kBlueMask))) * pos >> 12) & T::kBlueMask)) & T::kBlueMask;
+ output |= (start + ((((end & T::kRedMask) - (start & T::kRedMask))) * pos >> 12)) & T::kRedMask;
+ output |= (start + ((((end & T::kGreenMask) - (start & T::kGreenMask))) * pos >> 12)) & T::kGreenMask;
+ output |= (start + ((((end & T::kBlueMask) - (start & T::kBlueMask))) * pos >> 12)) & T::kBlueMask;
return output;
}