diff options
author | Kari Salminen | 2009-03-11 21:03:09 +0000 |
---|---|---|
committer | Kari Salminen | 2009-03-11 21:03:09 +0000 |
commit | c6767861463924aa0cfc5743237506baa0330083 (patch) | |
tree | 7c3ddacf2f024f3789f6e4fcc7197f90e055554f /engines/cine | |
parent | 4cbd3678f86956e0cc97e51c73bddfc0b5211cd0 (diff) | |
download | scummvm-rg350-c6767861463924aa0cfc5743237506baa0330083.tar.gz scummvm-rg350-c6767861463924aa0cfc5743237506baa0330083.tar.bz2 scummvm-rg350-c6767861463924aa0cfc5743237506baa0330083.zip |
Add saving in original palette format and the OSystem's palette format to Cine::Palette.
svn-id: r39337
Diffstat (limited to 'engines/cine')
-rw-r--r-- | engines/cine/pal.cpp | 19 | ||||
-rw-r--r-- | engines/cine/pal.h | 9 |
2 files changed, 23 insertions, 5 deletions
diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp index 72c04086da..e6c5c9d43e 100644 --- a/engines/cine/pal.cpp +++ b/engines/cine/pal.cpp @@ -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 @@ uint Palette::colorCount() const { 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 @@ Palette &Palette::load(const byte *colors, const Graphics::PixelFormat format, c 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 @@ byte *Palette::saveCineHighPal(byte *colors, const uint numBytes) const 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 diff --git a/engines/cine/pal.h b/engines/cine/pal.h index 5e6b3ea9a2..806a8ab5ac 100644 --- a/engines/cine/pal.h +++ b/engines/cine/pal.h @@ -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 @@ public: 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 @@ private: uint8 r, g, b; }; + Graphics::PixelFormat _format; uint _rBits, _gBits, _bBits; uint _rMax, _gMax, _bMax; |