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

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Tue Mar 24 22:45:39 CET 2009


Revision: 39676
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39676&view=rev
Author:   buddha_
Date:     2009-03-24 21:45:35 +0000 (Tue, 24 Mar 2009)

Log Message:
-----------
Cine::Palette: Add fillWithBlack and saturatedAddNormalizedGray-methods.

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-24 21:18:06 UTC (rev 39675)
+++ scummvm/trunk/engines/cine/pal.cpp	2009-03-24 21:45:35 UTC (rev 39676)
@@ -211,6 +211,16 @@
 	return _colors.size();
 }
 
+Palette &Palette::fillWithBlack() {
+	for (uint i = 0; i < _colors.size(); i++) {
+		_colors[i].r = 0;
+		_colors[i].g = 0;
+		_colors[i].b = 0;
+	}
+
+	return *this;
+}
+
 EndianType Palette::endianType() const {
 	return (_bigEndian ? CINE_BIG_ENDIAN : CINE_LITTLE_ENDIAN);
 }
@@ -247,6 +257,16 @@
 	return output;
 }
 
+Palette &Palette::saturatedAddNormalizedGray(Palette& output, byte firstIndex, byte lastIndex, double normalizedGray) {
+	// Calculate the gray value rounded up away from zero
+	const double signedHalf = ((normalizedGray >= 0) ? +0.5 : -0.5);
+	const signed r = (signed)(_rMax * normalizedGray + signedHalf);
+	const signed g = (signed)(_gMax * normalizedGray + signedHalf);
+	const signed b = (signed)(_bMax * normalizedGray + signedHalf);
+
+	return saturatedAddColor(output, firstIndex, lastIndex, r, g, b);
+}
+
 // a.k.a. transformColor
 // Parameter color components (i.e. r, g and b) are in range [-7, 7]
 // e.g. r = 7 sets the resulting color's red component to maximum

Modified: scummvm/trunk/engines/cine/pal.h
===================================================================
--- scummvm/trunk/engines/cine/pal.h	2009-03-24 21:18:06 UTC (rev 39675)
+++ scummvm/trunk/engines/cine/pal.h	2009-03-24 21:45:35 UTC (rev 39676)
@@ -116,8 +116,11 @@
 
 	Palette &rotateRight(byte firstIndex, byte lastIndex);
 	Palette &saturatedAddColor(Palette& output, byte firstIndex, byte lastIndex, signed r, signed g, signed b);
+	Palette &saturatedAddNormalizedGray(Palette& output, byte firstIndex, byte lastIndex, double normalizedGray);
 	uint colorCount() const;
 
+	Palette &fillWithBlack();
+
 	/*! \brief The original endian type in which this palette was loaded.
 	 * \note This will always return either CINE_BIG_ENDIAN or CINE_LITTLE_ENDIAN (So no CINE_NATIVE_ENDIAN).
 	 */


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