[Scummvm-cvs-logs] SF.net SVN: scummvm:[39333] scummvm/trunk/engines/cine/pal.cpp

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Wed Mar 11 21:04:08 CET 2009


Revision: 39333
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39333&view=rev
Author:   buddha_
Date:     2009-03-11 20:04:08 +0000 (Wed, 11 Mar 2009)

Log Message:
-----------
Fix assertions in palette loading function to really test that each color component fits inside a single byte (Easier to parse that way).

Modified Paths:
--------------
    scummvm/trunk/engines/cine/pal.cpp

Modified: scummvm/trunk/engines/cine/pal.cpp
===================================================================
--- scummvm/trunk/engines/cine/pal.cpp	2009-03-11 17:09:30 UTC (rev 39332)
+++ scummvm/trunk/engines/cine/pal.cpp	2009-03-11 20:04:08 UTC (rev 39333)
@@ -207,9 +207,9 @@
 
 Palette &Palette::load(const byte *colors, const Graphics::PixelFormat format, const uint numColors) {
 	assert(format.aLoss == 8); // No alpha	
-	assert(format.rShift % 8 == ((format.rShift + (8 - format.rLoss - 1)) % 8)); // R must be inside one byte
-	assert(format.gShift % 8 == ((format.gShift + (8 - format.gLoss - 1)) % 8)); // G must be inside one byte
-	assert(format.bShift % 8 == ((format.bShift + (8 - format.bLoss - 1)) % 8)); // B must be inside one byte
+	assert(format.rShift / 8 == (format.rShift + MAX<int>(0, 8 - format.rLoss - 1)) / 8); // R must be inside one byte
+	assert(format.gShift / 8 == (format.gShift + MAX<int>(0, 8 - format.gLoss - 1)) / 8); // G must be inside one byte
+	assert(format.bShift / 8 == (format.bShift + MAX<int>(0, 8 - format.bLoss - 1)) / 8); // B must be inside one byte
 
 	_rBits = (8 - format.rLoss);
 	_gBits = (8 - format.gLoss);


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