[Scummvm-cvs-logs] scummvm master -> 729d0182d81a1f1d7df43a4fed382c3f1eda944d
csnover
csnover at users.noreply.github.com
Tue Mar 8 06:48:56 CET 2016
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0afb056e2d SCI32: Fix palette color overflow
729d0182d8 SCI32: Add unnecessary micro-optimisation to palette merging code
Commit: 0afb056e2de6e3ca2801e7d13d4d5f2847803518
https://github.com/scummvm/scummvm/commit/0afb056e2de6e3ca2801e7d13d4d5f2847803518
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-03-07T23:47:44-06:00
Commit Message:
SCI32: Fix palette color overflow
Changed paths:
engines/sci/graphics/palette32.cpp
engines/sci/graphics/palette32.h
diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp
index 9b52e85..2957c72 100644
--- a/engines/sci/graphics/palette32.cpp
+++ b/engines/sci/graphics/palette32.cpp
@@ -55,7 +55,9 @@ GfxPalette32::GfxPalette32(ResourceManager *resMan, GfxScreen *screen)
_cyclers(),
_cycleMap() {
_varyPercent = _varyTargetPercent;
- memset(_fadeTable, 100, sizeof(_fadeTable));
+ for (int i = 0, len = ARRAYSIZE(_fadeTable); i < len; ++i) {
+ _fadeTable[i] = 100;
+ }
// NOTE: In SCI engine, the palette manager constructor loads
// the default palette, but in ScummVM this initialisation
// is performed by SciEngine::run; see r49523 for details
@@ -789,7 +791,7 @@ void GfxPalette32::applyCycles() {
// the last palette entry is intentionally left unmodified, or if this is a bug
// in the engine. It certainly seems confused because all other places that accept
// color ranges typically receive values in the range of 0–255.
-void GfxPalette32::setFade(uint8 percent, uint8 fromColor, uint16 numColorsToFade) {
+void GfxPalette32::setFade(uint16 percent, uint8 fromColor, uint16 numColorsToFade) {
if (fromColor > numColorsToFade) {
return;
}
@@ -811,9 +813,9 @@ void GfxPalette32::applyFade() {
Color &color = _nextPalette.colors[i];
- color.r = (int16)color.r * _fadeTable[i] / 100;
- color.g = (int16)color.g * _fadeTable[i] / 100;
- color.b = (int16)color.b * _fadeTable[i] / 100;
+ color.r = MIN(255, (uint16)color.r * _fadeTable[i] / 100);
+ color.g = MIN(255, (uint16)color.g * _fadeTable[i] / 100);
+ color.b = MIN(255, (uint16)color.b * _fadeTable[i] / 100);
}
}
}
diff --git a/engines/sci/graphics/palette32.h b/engines/sci/graphics/palette32.h
index 9da217b..40674b7 100644
--- a/engines/sci/graphics/palette32.h
+++ b/engines/sci/graphics/palette32.h
@@ -265,10 +265,15 @@ private:
* The fade table records the expected intensity level of each pixel
* in the palette that will be displayed on the next frame.
*/
- byte _fadeTable[256];
+ uint16 _fadeTable[256];
public:
- void setFade(const uint8 percent, const uint8 fromColor, const uint16 toColor);
+ /**
+ * Sets the intensity level for a range of palette
+ * entries. An intensity of zero indicates total
+ * darkness. Intensity may be set to over 100 percent.
+ */
+ void setFade(const uint16 percent, const uint8 fromColor, const uint16 toColor);
void fadeOff();
void applyFade();
};
Commit: 729d0182d81a1f1d7df43a4fed382c3f1eda944d
https://github.com/scummvm/scummvm/commit/729d0182d81a1f1d7df43a4fed382c3f1eda944d
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-03-07T23:48:13-06:00
Commit Message:
SCI32: Add unnecessary micro-optimisation to palette merging code
Changed paths:
engines/sci/graphics/palette32.cpp
diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp
index 2957c72..9d828dd 100644
--- a/engines/sci/graphics/palette32.cpp
+++ b/engines/sci/graphics/palette32.cpp
@@ -70,7 +70,7 @@ GfxPalette32::~GfxPalette32() {
}
inline void mergePaletteInternal(Palette *const to, const Palette *const from) {
- for (int i = 0; i < ARRAYSIZE(to->colors); ++i) {
+ for (int i = 0, len = ARRAYSIZE(to->colors); i < len; ++i) {
if (from->colors[i].used) {
to->colors[i] = from->colors[i];
}
More information about the Scummvm-git-logs
mailing list