From e02625db6aeb9a25cff653d71ecedd13e2c1bb11 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 12 Apr 2006 03:01:06 +0000 Subject: 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 --- gui/ThemeNew.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gui/ThemeNew.cpp') 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 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 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; } -- cgit v1.2.3