aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-06-25 02:39:00 +0000
committerJohannes Schickel2009-06-25 02:39:00 +0000
commitbd4b5d83368e7b9cd3ed2771923f6168db0d480d (patch)
treeb40cc9cb177874a9f8f9da94d9b29e4849e57164
parent951e82a9219c6f536f505adea92faae5e1eb669d (diff)
downloadscummvm-rg350-bd4b5d83368e7b9cd3ed2771923f6168db0d480d.tar.gz
scummvm-rg350-bd4b5d83368e7b9cd3ed2771923f6168db0d480d.tar.bz2
scummvm-rg350-bd4b5d83368e7b9cd3ed2771923f6168db0d480d.zip
Implement proper VGA (a color component in [0, 63]) to our palette format (color component in [0, 255]) conversion.
svn-id: r41851
-rw-r--r--engines/kyra/screen.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index b9929bab1a..036b8b9bc2 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -604,9 +604,9 @@ void Screen::getRealPalette(int num, uint8 *dst) {
}
for (int i = 0; i < colors; ++i) {
- dst[0] = (palData[0] << 2) | (palData[0] & 3);
- dst[1] = (palData[1] << 2) | (palData[1] & 3);
- dst[2] = (palData[2] << 2) | (palData[2] & 3);
+ dst[0] = (palData[0] * 0xFF) / 0x3F;
+ dst[1] = (palData[1] * 0xFF) / 0x3F;
+ dst[2] = (palData[2] * 0xFF) / 0x3F;
dst += 3;
palData += 3;
}
@@ -617,9 +617,9 @@ void Screen::setScreenPalette(const Palette &pal) {
_screenPalette->copy(pal);
for (int i = 0; i < pal.getNumColors(); ++i) {
- screenPal[4 * i + 0] = (pal[i * 3 + 0] << 2) | (pal[i * 3 + 0] & 3);
- screenPal[4 * i + 1] = (pal[i * 3 + 1] << 2) | (pal[i * 3 + 1] & 3);
- screenPal[4 * i + 2] = (pal[i * 3 + 2] << 2) | (pal[i * 3 + 2] & 3);
+ screenPal[4 * i + 0] = (pal[i * 3 + 0] * 0xFF) / 0x3F;
+ screenPal[4 * i + 1] = (pal[i * 3 + 1] * 0xFF) / 0x3F;
+ screenPal[4 * i + 2] = (pal[i * 3 + 2] * 0xFF) / 0x3F;
screenPal[4 * i + 3] = 0;
}