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

buddha_ at users.sourceforge.net buddha_ at users.sourceforge.net
Wed Mar 11 22:03:09 CET 2009


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

Log Message:
-----------
Add saving in original palette format and the OSystem's palette format to Cine::Palette.

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-11 20:44:16 UTC (rev 39336)
+++ scummvm/trunk/engines/cine/pal.cpp	2009-03-11 21:03:09 UTC (rev 39337)
@@ -25,12 +25,13 @@
 
 #include "cine/cine.h"
 #include "cine/various.h"
-#include "graphics/pixelformat.h"
+#include "cine/pal.h"
 
 namespace Cine {
 
 static const Graphics::PixelFormat kLowPalFormat  = {2, 5, 5, 5, 8, 8, 4,  0, 0};
 static const Graphics::PixelFormat kHighPalFormat = {3, 0, 0, 0, 8, 0, 8, 16, 0};
+static const Graphics::PixelFormat kSystemPalFormat = {4, 0, 0, 0, 8, 0, 8, 16, 0};
 
 Common::Array<PalEntry> palArray;
 static byte paletteBuffer1[16];
@@ -179,6 +180,10 @@
 	return _colors.size();
 }
 
+Graphics::PixelFormat Palette::colorFormat() const {
+	return _format;
+}
+
 // a.k.a. transformPaletteRange
 Palette &Palette::saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b) {
 	assert(firstIndex < colorCount() && lastIndex < colorCount());
@@ -212,6 +217,8 @@
 	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
 
+	_format = format;
+
 	_rBits = (8 - format.rLoss);
 	_gBits = (8 - format.gLoss);
 	_bBits = (8 - format.bLoss);
@@ -262,4 +269,14 @@
 	return save(colors, numBytes, kHighPalFormat);
 }
 
+byte *Palette::saveOrigFormat(byte *colors, const uint numBytes) const
+{
+	return save(colors, numBytes, colorFormat());
+}
+
+byte *Palette::saveSystemFormat(byte *colors, const uint numBytes) const
+{
+	return save(colors, numBytes, kSystemPalFormat);
+}
+
 } // End of namespace Cine

Modified: scummvm/trunk/engines/cine/pal.h
===================================================================
--- scummvm/trunk/engines/cine/pal.h	2009-03-11 20:44:16 UTC (rev 39336)
+++ scummvm/trunk/engines/cine/pal.h	2009-03-11 21:03:09 UTC (rev 39337)
@@ -26,10 +26,7 @@
 #ifndef CINE_PAL_H
 #define CINE_PAL_H
 
-// Forward declare Graphics::PixelFormat so we don't have to include its header here
-namespace Graphics {
-	struct PixelFormat;
-}
+#include "graphics/pixelformat.h"
 
 namespace Cine {
 
@@ -63,11 +60,14 @@
 
 	byte *saveCineLowPal(byte *colors, const uint numBytes) const;
 	byte *saveCineHighPal(byte *colors, const uint numBytes) const;
+	byte *saveOrigFormat(byte *colors, const uint numBytes) const;
+	byte *saveSystemFormat(byte *colors, const uint numBytes) const;
 	byte *save(byte *colors, const uint numBytes, const Graphics::PixelFormat format) const;
 
 	Palette &rotateRight(byte firstIndex, byte lastIndex);
 	Palette &saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b);	
 	uint colorCount() const;
+	Graphics::PixelFormat colorFormat() const;
 
 private:
 	void saturatedAddColor(byte index, signed r, signed g, signed b);
@@ -77,6 +77,7 @@
 		uint8 r, g, b;
 	};
 
+	Graphics::PixelFormat _format;
 	uint _rBits, _gBits, _bBits;
 	uint _rMax, _gMax, _bMax;
 


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