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

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Sat Mar 28 17:07:56 CET 2009


Revision: 39725
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39725&view=rev
Author:   buddha_
Date:     2009-03-28 16:07:56 +0000 (Sat, 28 Mar 2009)

Log Message:
-----------
Cine::Palette: Add empty() and isValid() functions.

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

Modified: scummvm/trunk/engines/cine/pal.cpp
===================================================================
--- scummvm/trunk/engines/cine/pal.cpp	2009-03-28 14:38:19 UTC (rev 39724)
+++ scummvm/trunk/engines/cine/pal.cpp	2009-03-28 16:07:56 UTC (rev 39725)
@@ -208,6 +208,10 @@
 	return *this;
 }
 
+bool Palette::empty() const {
+	return _colors.empty();
+}
+
 uint Palette::colorCount() const {
 	return _colors.size();
 }
@@ -222,6 +226,13 @@
 	return *this;
 }
 
+// TODO: Add better heuristic for checking whether the color format is valid
+bool Palette::isValid() const {
+	// Check that the color format has been actually set and not just default constructed.
+	// Also check that the alpha channel is discarded.
+	return _format != Graphics::PixelFormat() && _format.aLoss == 8;
+}
+
 Graphics::PixelFormat Palette::colorFormat() const {
 	return _format;
 }

Modified: scummvm/trunk/engines/cine/pal.h
===================================================================
--- scummvm/trunk/engines/cine/pal.h	2009-03-28 14:38:19 UTC (rev 39724)
+++ scummvm/trunk/engines/cine/pal.h	2009-03-28 16:07:56 UTC (rev 39725)
@@ -139,10 +139,14 @@
 	 */
 	Palette &saturatedAddNormalizedGray(Palette& output, byte firstIndex, byte lastIndex, signed grayDividend, signed grayDenominator);
 
+	bool empty() const;
 	uint colorCount() const;
 
 	Palette &fillWithBlack();
 
+	/*! \brief Is the palette valid? (Mostly just checks the color format for correctness) */
+	bool isValid() const;
+
 	/*! \brief The original color format in which this palette was loaded. */
 	Graphics::PixelFormat colorFormat() const;
 


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