diff options
author | Johannes Schickel | 2009-06-25 15:53:21 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-06-25 15:53:21 +0000 |
commit | 9b2da1ad0aca324fa0c18b9a20fb09a01c7e808b (patch) | |
tree | 7f4268bee4bc03bcb37c30c3bde50d9c6cf0f1e4 | |
parent | c202a119d401c663d8f53b99077d21248397fe26 (diff) | |
download | scummvm-rg350-9b2da1ad0aca324fa0c18b9a20fb09a01c7e808b.tar.gz scummvm-rg350-9b2da1ad0aca324fa0c18b9a20fb09a01c7e808b.tar.bz2 scummvm-rg350-9b2da1ad0aca324fa0c18b9a20fb09a01c7e808b.zip |
Cleanup.
svn-id: r41871
-rw-r--r-- | engines/kyra/screen_lok.cpp | 19 | ||||
-rw-r--r-- | engines/kyra/screen_lok.h | 8 |
2 files changed, 16 insertions, 11 deletions
diff --git a/engines/kyra/screen_lok.cpp b/engines/kyra/screen_lok.cpp index a436a97dfd..8ab1ee853c 100644 --- a/engines/kyra/screen_lok.cpp +++ b/engines/kyra/screen_lok.cpp @@ -243,6 +243,7 @@ int Screen_LoK::getRectSize(int x, int y) { #pragma mark - Screen_LoK_16::Screen_LoK_16(KyraEngine_LoK *vm, OSystem *system) : Screen_LoK(vm, system) { + memset(_paletteDither, 0, sizeof(_paletteDither)); } void Screen_LoK_16::setScreenPalette(const Palette &pal) { @@ -426,11 +427,8 @@ void Screen_LoK_16::paletteMap(uint8 idx, int r, int g, int b) { } } - _paletteMap[idx * 4 + 0] = index2; - _paletteMap[idx * 4 + 3] = index2; - - _paletteMap[idx * 4 + 1] = index1; - _paletteMap[idx * 4 + 2] = index1; + _paletteDither[idx].bestMatch = index1; + _paletteDither[idx].invertMatch = index2; } void Screen_LoK_16::convertTo16Colors(uint8 *page, int w, int h, int pitch, int keyColor) { @@ -442,11 +440,12 @@ void Screen_LoK_16::convertTo16Colors(uint8 *page, int w, int h, int pitch, int for (int i = 0; i < h; i += 2) { for (int k = 0; k < w; k += 2) { if (keyColor == -1 || keyColor != *row1) { - *row1 = _paletteMap[*row1 * 4 + 0]; ++row1; - *row1 = _paletteMap[*row1 * 4 + 1]; ++row1; + const PaletteDither &dither = _paletteDither[*row1]; - *row2 = _paletteMap[*row2 * 4 + 2]; ++row2; - *row2 = _paletteMap[*row2 * 4 + 3]; ++row2; + *row1++ = dither.bestMatch; + *row1++ = dither.invertMatch; + *row2++ = dither.invertMatch; + *row2++ = dither.bestMatch; } else { row1 += 2; row2 += 2; @@ -474,7 +473,7 @@ void Screen_LoK_16::mergeOverlay(int x, int y, int w, int h) { for (x = 0; x < w; ++x, ++dst) { byte col = *src++; if (col != _sjisInvisibleColor) - *dst = _paletteMap[col * 4 + 2]; + *dst = _paletteDither[col].bestMatch; } dst += add; src += add; diff --git a/engines/kyra/screen_lok.h b/engines/kyra/screen_lok.h index 098fd1e389..7ab0bb2811 100644 --- a/engines/kyra/screen_lok.h +++ b/engines/kyra/screen_lok.h @@ -97,7 +97,13 @@ private: void set16ColorPalette(const uint8 *pal); void paletteMap(uint8 idx, int r, int g, int b); - uint8 _paletteMap[1024]; + + struct PaletteDither { + uint8 bestMatch; + uint8 invertMatch; + }; + + PaletteDither _paletteDither[256]; static const uint8 _palette16[48]; }; |