aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoost Peters2005-04-06 19:18:08 +0000
committerJoost Peters2005-04-06 19:18:08 +0000
commit60a64494d13f2266bf30c0c17633e23316cadb97 (patch)
treefccb0678fdecb6e68eb8aa8ac9ab6cb504e3bb19
parentfd6b2050abf3ef97fbd090dfdeb6e49b16f67746 (diff)
downloadscummvm-rg350-60a64494d13f2266bf30c0c17633e23316cadb97.tar.gz
scummvm-rg350-60a64494d13f2266bf30c0c17633e23316cadb97.tar.bz2
scummvm-rg350-60a64494d13f2266bf30c0c17633e23316cadb97.zip
use upper bits instead of lower bits when upscaling palette
svn-id: r17423
-rw-r--r--gob/video.cpp18
-rw-r--r--sky/screen.cpp12
2 files changed, 15 insertions, 15 deletions
diff --git a/gob/video.cpp b/gob/video.cpp
index ec87e44ce2..077ae3be49 100644
--- a/gob/video.cpp
+++ b/gob/video.cpp
@@ -331,9 +331,9 @@ void vid_setPalElem(int16 index, char red, char green, char blue, int16 unused,
error("vid_setPalElem: Video mode 0x%x is not supported!",
vidMode);
- pal[0] = (red << 2) | (red & 3);
- pal[1] = (green << 2) | (green & 3);
- pal[2] = (blue << 2) | (blue & 3);
+ pal[0] = (red << 2) | (red >> 4);
+ pal[1] = (green << 2) | (green >> 4);
+ pal[2] = (blue << 2) | (blue >> 4);
pal[3] = 0;
g_system->setPalette(pal, index, 1);
}
@@ -353,9 +353,9 @@ void vid_setPalette(PalDesc *palDesc) {
numcolors = 16;
for (i = 0; i < numcolors; i++) {
- pal[i * 4 + 0] = (palDesc->vgaPal[i].red << 2) | (palDesc->vgaPal[i].red & 3);
- pal[i * 4 + 1] = (palDesc->vgaPal[i].green << 2) | (palDesc->vgaPal[i].green & 3);
- pal[i * 4 + 2] = (palDesc->vgaPal[i].blue << 2) | (palDesc->vgaPal[i].blue & 3);
+ pal[i * 4 + 0] = (palDesc->vgaPal[i].red << 2) | (palDesc->vgaPal[i].red >> 4);
+ pal[i * 4 + 1] = (palDesc->vgaPal[i].green << 2) | (palDesc->vgaPal[i].green >> 4);
+ pal[i * 4 + 2] = (palDesc->vgaPal[i].blue << 2) | (palDesc->vgaPal[i].blue >> 4);
pal[i * 4 + 3] = 0;
}
@@ -376,9 +376,9 @@ void vid_setFullPalette(PalDesc *palDesc) {
}
for (i = 0; i < 256; i++) {
- pal[i * 4 + 0] = (colors[i].red << 2) | (colors[i].red & 3);
- pal[i * 4 + 1] = (colors[i].green << 2) | (colors[i].green & 3);
- pal[i * 4 + 2] = (colors[i].blue << 2) | (colors[i].blue & 3);
+ pal[i * 4 + 0] = (colors[i].red << 2) | (colors[i].red >> 4);
+ pal[i * 4 + 1] = (colors[i].green << 2) | (colors[i].green >> 4);
+ pal[i * 4 + 2] = (colors[i].blue << 2) | (colors[i].blue >> 4);
pal[i * 4 + 3] = 0;
}
g_system->setPalette(pal, 0, 256);
diff --git a/sky/screen.cpp b/sky/screen.cpp
index ab7bbbc815..c16c8a215c 100644
--- a/sky/screen.cpp
+++ b/sky/screen.cpp
@@ -71,9 +71,9 @@ Screen::Screen(OSystem *pSystem, Disk *pDisk, SkyCompact *skyCompact) {
//set the remaining colors
for (i = 0; i < (VGA_COLOURS-GAME_COLOURS); i++) {
- tmpPal[4 * GAME_COLOURS + i * 4] = (_top16Colours[i * 3] << 2) + (_top16Colours[i * 3] & 3);
- tmpPal[4 * GAME_COLOURS + i * 4 + 1] = (_top16Colours[i * 3 + 1] << 2) + (_top16Colours[i * 3 + 1] & 3);
- tmpPal[4 * GAME_COLOURS + i * 4 + 2] = (_top16Colours[i * 3 + 2] << 2) + (_top16Colours[i * 3 + 2] & 3);
+ tmpPal[4 * GAME_COLOURS + i * 4] = (_top16Colours[i * 3] << 2) + (_top16Colours[i * 3] >> 4);
+ tmpPal[4 * GAME_COLOURS + i * 4 + 1] = (_top16Colours[i * 3 + 1] << 2) + (_top16Colours[i * 3 + 1] >> 4);
+ tmpPal[4 * GAME_COLOURS + i * 4 + 2] = (_top16Colours[i * 3 + 2] << 2) + (_top16Colours[i * 3 + 2] >> 4);
tmpPal[4 * GAME_COLOURS + i * 4 + 3] = 0x00;
}
@@ -167,9 +167,9 @@ void Screen::convertPalette(uint8 *inPal, uint8* outPal) { //convert 3 byte 0..6
int i;
for (i = 0; i < VGA_COLOURS; i++) {
- outPal[4 * i] = (inPal[3 * i] << 2) + (inPal[3 * i] & 3);
- outPal[4 * i + 1] = (inPal[3 * i + 1] << 2) + (inPal[3 * i + 1] & 3);
- outPal[4 * i + 2] = (inPal[3 * i + 2] << 2) + (inPal[3 * i + 2] & 3);
+ outPal[4 * i] = (inPal[3 * i] << 2) + (inPal[3 * i] >> 4);
+ outPal[4 * i + 1] = (inPal[3 * i + 1] << 2) + (inPal[3 * i + 1] >> 4);
+ outPal[4 * i + 2] = (inPal[3 * i + 2] << 2) + (inPal[3 * i + 2] >> 4);
outPal[4 * i + 3] = 0x00;
}
}