diff options
| -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: | 
