aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-03-10 22:09:10 +0000
committerJohannes Schickel2009-03-10 22:09:10 +0000
commit333d2c8e34e50d827c7e19dfa7e3efa9fd587c1e (patch)
tree69b26afa00ecfb6c2b6b13f356baecdb9c192150
parenteaaa703c62eb22dbe2e0ebec5d81ee29d4e8db43 (diff)
downloadscummvm-rg350-333d2c8e34e50d827c7e19dfa7e3efa9fd587c1e.tar.gz
scummvm-rg350-333d2c8e34e50d827c7e19dfa7e3efa9fd587c1e.tar.bz2
scummvm-rg350-333d2c8e34e50d827c7e19dfa7e3efa9fd587c1e.zip
- Fix warnings
- Formatting svn-id: r39317
-rw-r--r--engines/cine/pal.cpp28
-rw-r--r--engines/cine/pal.h10
2 files changed, 17 insertions, 21 deletions
diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp
index 060674f4da..55f9576590 100644
--- a/engines/cine/pal.cpp
+++ b/engines/cine/pal.cpp
@@ -147,9 +147,8 @@ uint16 transformColor(uint16 baseColor, int r, int g, int b) {
void transformPaletteRange(uint16 *dstPal, uint16 *srcPal, int startColor, int stopColor, int r, int g, int b) {
assert(srcPal && dstPal);
- for (int i = startColor; i <= stopColor; i++) {
+ for (int i = startColor; i <= stopColor; i++)
dstPal[i] = transformColor(srcPal[i], r, g, b);
- }
}
void transformPaletteRange(byte *dstPal, byte *srcPal, int startColor, int stopColor, int r, int g, int b) {
@@ -163,12 +162,11 @@ void transformPaletteRange(byte *dstPal, byte *srcPal, int startColor, int stopC
}
// a.k.a. palRotate
-Palette& Palette::rotateRight(byte firstIndex, byte lastIndex) {
+Palette &Palette::rotateRight(byte firstIndex, byte lastIndex) {
const Color lastColor = _colors[lastIndex];
- for (int i = lastIndex; i > firstIndex; i--) {
+ for (int i = lastIndex; i > firstIndex; i--)
_colors[i] = _colors[i - 1];
- }
_colors[firstIndex] = lastColor;
return *this;
@@ -179,12 +177,11 @@ uint Palette::colorCount() const {
}
// a.k.a. transformPaletteRange
-Palette& Palette::saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b) {
+Palette &Palette::saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b) {
assert(firstIndex < colorCount() && lastIndex < colorCount());
- for (uint i = firstIndex; i <= lastIndex; i++) {
+ for (uint i = firstIndex; i <= lastIndex; i++)
saturatedAddColor(i, r, g, b);
- }
return *this;
}
@@ -198,17 +195,17 @@ void Palette::saturatedAddColor(byte index, signed r, signed g, signed b) {
_colors[index].b = CLIP<int>(_colors[index].b + b, 0, _bMax);
}
-Palette& Palette::loadCineLowPal(const byte *colors, const uint colorCount) {
+Palette &Palette::loadCineLowPal(const byte *colors, const uint numColors) {
static const Graphics::PixelFormat format = {2, 5, 5, 5, 8, 8, 4, 0, 0};
- return load(colors, format, colorCount);
+ return load(colors, format, numColors);
}
-Palette& Palette::loadCineHighPal(const byte *colors, const uint colorCount) {
+Palette &Palette::loadCineHighPal(const byte *colors, const uint numColors) {
static const Graphics::PixelFormat format = {3, 0, 0, 0, 8, 0, 8, 16, 0};
- return load(colors, format, colorCount);
+ return load(colors, format, numColors);
}
-Palette& Palette::load(const byte *colors, const Graphics::PixelFormat format, const uint colorCount) {
+Palette &Palette::load(const byte *colors, const Graphics::PixelFormat format, const uint numColors) {
assert(format.aLoss == 8); // No alpha
assert(format.rShift % 8 == ((format.rShift + (8 - format.rLoss - 1)) % 8)); // R must be inside one byte
assert(format.gShift % 8 == ((format.gShift + (8 - format.gLoss - 1)) % 8)); // G must be inside one byte
@@ -223,10 +220,9 @@ Palette& Palette::load(const byte *colors, const Graphics::PixelFormat format, c
_bMax = (1 << _bBits) - 1;
_colors.clear();
- _colors.resize(colorCount);
+ _colors.resize(numColors);
- for (uint i = 0; i < colorCount; i++)
- {
+ for (uint i = 0; i < numColors; i++) {
// _rMax, _gMax, _bMax are also used as masks here
_colors[i].r = (colors[i * format.bytesPerPixel + (format.rShift / 8)] >> (format.rShift % 8)) & _rMax;
_colors[i].g = (colors[i * format.bytesPerPixel + (format.gShift / 8)] >> (format.gShift % 8)) & _gMax;
diff --git a/engines/cine/pal.h b/engines/cine/pal.h
index d21e7e206a..3bebcaabba 100644
--- a/engines/cine/pal.h
+++ b/engines/cine/pal.h
@@ -57,11 +57,11 @@ void transformPaletteRange(byte *srcPal, byte *dstPal, int startColor, int stopC
// TODO: Test
class Palette {
public:
- Palette& loadCineLowPal(const byte *colors, const uint colorCount = 16);
- Palette& loadCineHighPal(const byte *colors, const uint colorCount = 256);
- Palette& load(const byte *colors, const Graphics::PixelFormat format, const uint colorCount);
- Palette& rotateRight(byte firstIndex, byte lastIndex);
- Palette& saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b);
+ Palette &loadCineLowPal(const byte *colors, const uint numColors = 16);
+ Palette &loadCineHighPal(const byte *colors, const uint numColors = 256);
+ Palette &load(const byte *colors, const Graphics::PixelFormat format, const uint numColors);
+ Palette &rotateRight(byte firstIndex, byte lastIndex);
+ Palette &saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b);
uint colorCount() const;
private: