[Scummvm-cvs-logs] SF.net SVN: scummvm: [21818] scummvm/trunk/gui/ThemeNew.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Apr 11 20:02:01 CEST 2006


Revision: 21818
Author:   lordhoto
Date:     2006-04-11 20:01:06 -0700 (Tue, 11 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21818&view=rev

Log Message:
-----------
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)

Modified Paths:
--------------
    scummvm/trunk/gui/ThemeNew.cpp
Modified: scummvm/trunk/gui/ThemeNew.cpp
===================================================================
--- scummvm/trunk/gui/ThemeNew.cpp	2006-04-12 02:27:56 UTC (rev 21817)
+++ scummvm/trunk/gui/ThemeNew.cpp	2006-04-12 03:01:06 UTC (rev 21818)
@@ -1540,8 +1540,9 @@
 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 @@
 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;
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list