[Scummvm-cvs-logs] SF.net SVN: scummvm:[39454] scummvm/trunk/engines/cine
buddha_ at users.sourceforge.net
buddha_ at users.sourceforge.net
Mon Mar 16 22:10:15 CET 2009
Revision: 39454
http://scummvm.svn.sourceforge.net/scummvm/?rev=39454&view=rev
Author: buddha_
Date: 2009-03-16 21:10:15 +0000 (Mon, 16 Mar 2009)
Log Message:
-----------
Cine::Palette: Make saturatedAddColor-methods more like their old counterparts transformPaletteRange and transformColor.
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-16 20:57:17 UTC (rev 39453)
+++ scummvm/trunk/engines/cine/pal.cpp 2009-03-16 21:10:15 UTC (rev 39454)
@@ -236,23 +236,27 @@
}
// a.k.a. transformPaletteRange
-Palette &Palette::saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b) {
+Palette &Palette::saturatedAddColor(Palette& output, byte firstIndex, byte lastIndex, signed r, signed g, signed b) {
assert(firstIndex < colorCount() && lastIndex < colorCount());
+ assert(firstIndex < output.colorCount() && lastIndex < output.colorCount());
+ assert(output.colorFormat() == colorFormat());
for (uint i = firstIndex; i <= lastIndex; i++)
- saturatedAddColor(i, r, g, b);
+ output._colors[i] = saturatedAddColor(_colors[i], r, g, b);
- return *this;
+ return output;
}
// 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
// e.g. r = -7 sets the resulting color's red component to minimum (i.e. zero)
-void Palette::saturatedAddColor(byte index, signed r, signed g, signed b) {
- _colors[index].r = CLIP<int>(_colors[index].r + r, 0, _rMax);
- _colors[index].g = CLIP<int>(_colors[index].g + g, 0, _gMax);
- _colors[index].b = CLIP<int>(_colors[index].b + b, 0, _bMax);
+Cine::Palette::Color Palette::saturatedAddColor(Cine::Palette::Color baseColor, signed r, signed g, signed b) const {
+ Cine::Palette::Color result;
+ result.r = CLIP<int>(baseColor.r + r, 0, _rMax);
+ result.g = CLIP<int>(baseColor.g + g, 0, _gMax);
+ result.b = CLIP<int>(baseColor.b + b, 0, _bMax);
+ return result;
}
Palette &Palette::load(const byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors, const EndianType endianType) {
Modified: scummvm/trunk/engines/cine/pal.h
===================================================================
--- scummvm/trunk/engines/cine/pal.h 2009-03-16 20:57:17 UTC (rev 39453)
+++ scummvm/trunk/engines/cine/pal.h 2009-03-16 21:10:15 UTC (rev 39454)
@@ -74,6 +74,11 @@
// TODO: Make use of
// TODO: Test
class Palette {
+private:
+ struct Color {
+ uint8 r, g, b;
+ };
+
public:
/*! \brief Load palette from buffer with given color format, endianness and number of colors.
* \param buf Input buffer
@@ -110,7 +115,7 @@
byte *save(byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors, const EndianType endianType, const byte firstIndex = 0) const;
Palette &rotateRight(byte firstIndex, byte lastIndex);
- Palette &saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b);
+ Palette &saturatedAddColor(Palette& output, byte firstIndex, byte lastIndex, signed r, signed g, signed b);
uint colorCount() const;
/*! \brief The original endian type in which this palette was loaded.
@@ -124,13 +129,9 @@
private:
void setColorFormat(const Graphics::PixelFormat format);
void setEndianType(const EndianType endianType);
- void saturatedAddColor(byte index, signed r, signed g, signed b);
+ Cine::Palette::Color saturatedAddColor(Cine::Palette::Color baseColor, signed r, signed g, signed b) const;
private:
- struct Color {
- uint8 r, g, b;
- };
-
// The used source format, its endianness etc.
Graphics::PixelFormat _format;
uint _rBits, _gBits, _bBits;
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