From 9b2da1ad0aca324fa0c18b9a20fb09a01c7e808b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 25 Jun 2009 15:53:21 +0000 Subject: Cleanup. svn-id: r41871 --- engines/kyra/screen_lok.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'engines/kyra/screen_lok.cpp') 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; -- cgit v1.2.3