diff options
author | Jody Northup | 2009-08-21 09:37:51 +0000 |
---|---|---|
committer | Jody Northup | 2009-08-21 09:37:51 +0000 |
commit | 3084919b32771d43d17fdd5d584505cd31d20b72 (patch) | |
tree | 3f42b5e0cb69f340ccd30fad96f6ee4e51e260cf /engines/scumm/palette.cpp | |
parent | cba2897cc8f7b70d27fc75ca8b8d55cde4738e4a (diff) | |
parent | 89d7fea4e619cd44d5ce16eee1e46ad417e26c9c (diff) | |
download | scummvm-rg350-3084919b32771d43d17fdd5d584505cd31d20b72.tar.gz scummvm-rg350-3084919b32771d43d17fdd5d584505cd31d20b72.tar.bz2 scummvm-rg350-3084919b32771d43d17fdd5d584505cd31d20b72.zip |
Merged RGB color API and support in from /scummvm/branches/gsoc2009-16bit/
svn-id: r43577
Diffstat (limited to 'engines/scumm/palette.cpp')
-rw-r--r-- | engines/scumm/palette.cpp | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index c356e7a06c..a596cc5b1a 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -33,6 +33,27 @@ namespace Scumm { +uint8 *ScummEngine::getHEPaletteSlot(uint16 palSlot) { + assertRange(0, palSlot, _numPalettes, "palette"); + + if (_game.heversion >= 99) { + if (palSlot) + return _hePalettes + palSlot * _hePaletteSlot + 768; + else + return _hePalettes + _hePaletteSlot + 768; + } + + return NULL; +} + +uint16 ScummEngine::get16BitColor(uint8 r, uint8 g, uint8 b) { + uint16 ar = (r >> 3) << 10; + uint16 ag = (g >> 3) << 5; + uint16 ab = (b >> 3) << 0; + uint16 col = ar | ag | ab; + return col; +} + void ScummEngine::resetPalette() { if (_game.version <= 1) { if (_game.platform == Common::kPlatformApple2GS) { @@ -310,9 +331,6 @@ void ScummEngine::setDirtyColors(int min, int max) { _palDirtyMin = min; if (_palDirtyMax < max) _palDirtyMax = max; - - if (_hePaletteCache) - memset(_hePaletteCache, -1, 65536); } void ScummEngine::initCycl(const byte *ptr) { @@ -799,16 +817,6 @@ void ScummEngine_v8::desaturatePalette(int hueScale, int satScale, int lightScal #endif -int ScummEngine::convert16BitColor(uint16 color, uint8 r, uint8 g, uint8 b) { - // HACK: Find the closest matching color, and store in - // cache for faster access. - if (_hePaletteCache[color] == -1) { - _hePaletteCache[color] = remapPaletteColor(r, g, b, -1); - } - - return _hePaletteCache[color]; -} - int ScummEngine::remapPaletteColor(int r, int g, int b, int threshold) { byte *pal; int ar, ag, ab, i; |