diff options
author | Kari Salminen | 2009-03-11 21:11:52 +0000 |
---|---|---|
committer | Kari Salminen | 2009-03-11 21:11:52 +0000 |
commit | bac7bd00be2ed9dc2da799f35bf01a43303c84c6 (patch) | |
tree | 9190ae1244084fc0957988588ead0b5a56c351a5 | |
parent | e01e4d6dbe80cf2010d865329eca58394092d745 (diff) | |
download | scummvm-rg350-bac7bd00be2ed9dc2da799f35bf01a43303c84c6.tar.gz scummvm-rg350-bac7bd00be2ed9dc2da799f35bf01a43303c84c6.tar.bz2 scummvm-rg350-bac7bd00be2ed9dc2da799f35bf01a43303c84c6.zip |
Cine::Palette: Move color format setting to setColorFormat-method.
svn-id: r39339
-rw-r--r-- | engines/cine/pal.cpp | 22 | ||||
-rw-r--r-- | engines/cine/pal.h | 1 |
2 files changed, 14 insertions, 9 deletions
diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp index b8b2580cf0..a1c5b6f675 100644 --- a/engines/cine/pal.cpp +++ b/engines/cine/pal.cpp @@ -184,6 +184,18 @@ Graphics::PixelFormat Palette::colorFormat() const { return _format; } +void Palette::setColorFormat(const Graphics::PixelFormat format) { + _format = format; + + _rBits = (8 - format.rLoss); + _gBits = (8 - format.gLoss); + _bBits = (8 - format.bLoss); + + _rMax = (1 << _rBits) - 1; + _gMax = (1 << _gBits) - 1; + _bMax = (1 << _bBits) - 1; +} + // a.k.a. transformPaletteRange Palette &Palette::saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b) { assert(firstIndex < colorCount() && lastIndex < colorCount()); @@ -218,15 +230,7 @@ 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); - - _rMax = (1 << _rBits) - 1; - _gMax = (1 << _gBits) - 1; - _bMax = (1 << _bBits) - 1; + setColorFormat(format); _colors.clear(); _colors.resize(numColors); diff --git a/engines/cine/pal.h b/engines/cine/pal.h index 806a8ab5ac..4d59a6e998 100644 --- a/engines/cine/pal.h +++ b/engines/cine/pal.h @@ -70,6 +70,7 @@ public: Graphics::PixelFormat colorFormat() const; private: + void setColorFormat(const Graphics::PixelFormat format); void saturatedAddColor(byte index, signed r, signed g, signed b); private: |