aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/screen_lok.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2009-06-25 15:53:21 +0000
committerJohannes Schickel2009-06-25 15:53:21 +0000
commit9b2da1ad0aca324fa0c18b9a20fb09a01c7e808b (patch)
tree7f4268bee4bc03bcb37c30c3bde50d9c6cf0f1e4 /engines/kyra/screen_lok.cpp
parentc202a119d401c663d8f53b99077d21248397fe26 (diff)
downloadscummvm-rg350-9b2da1ad0aca324fa0c18b9a20fb09a01c7e808b.tar.gz
scummvm-rg350-9b2da1ad0aca324fa0c18b9a20fb09a01c7e808b.tar.bz2
scummvm-rg350-9b2da1ad0aca324fa0c18b9a20fb09a01c7e808b.zip
Cleanup.
svn-id: r41871
Diffstat (limited to 'engines/kyra/screen_lok.cpp')
-rw-r--r--engines/kyra/screen_lok.cpp19
1 files changed, 9 insertions, 10 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;