[Scummvm-cvs-logs] SF.net SVN: scummvm:[41871] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Thu Jun 25 17:53:21 CEST 2009
Revision: 41871
http://scummvm.svn.sourceforge.net/scummvm/?rev=41871&view=rev
Author: lordhoto
Date: 2009-06-25 15:53:21 +0000 (Thu, 25 Jun 2009)
Log Message:
-----------
Cleanup.
Modified Paths:
--------------
scummvm/trunk/engines/kyra/screen_lok.cpp
scummvm/trunk/engines/kyra/screen_lok.h
Modified: scummvm/trunk/engines/kyra/screen_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lok.cpp 2009-06-25 15:53:09 UTC (rev 41870)
+++ scummvm/trunk/engines/kyra/screen_lok.cpp 2009-06-25 15:53:21 UTC (rev 41871)
@@ -243,6 +243,7 @@
#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 @@
}
}
- _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 @@
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 @@
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;
Modified: scummvm/trunk/engines/kyra/screen_lok.h
===================================================================
--- scummvm/trunk/engines/kyra/screen_lok.h 2009-06-25 15:53:09 UTC (rev 41870)
+++ scummvm/trunk/engines/kyra/screen_lok.h 2009-06-25 15:53:21 UTC (rev 41871)
@@ -97,8 +97,14 @@
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];
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list