aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gui
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-09 20:21:21 +0000
committerMartin Kiewitz2009-10-09 20:21:21 +0000
commit23887e97355363e076b2eeb4e3321f7a27a7c63d (patch)
treebb1a9272941a1fc6958575f58797e3be0281673e /engines/sci/gui
parent5801dd206412542f4f93391c7cb9e0c38cca7697 (diff)
downloadscummvm-rg350-23887e97355363e076b2eeb4e3321f7a27a7c63d.tar.gz
scummvm-rg350-23887e97355363e076b2eeb4e3321f7a27a7c63d.tar.bz2
scummvm-rg350-23887e97355363e076b2eeb4e3321f7a27a7c63d.zip
SCI/newgui: changing undithering logic again, palette now uses decoded color-combinations, fixup happens during dithering run on undithered mode
svn-id: r44845
Diffstat (limited to 'engines/sci/gui')
-rw-r--r--engines/sci/gui/gui_palette.cpp12
-rw-r--r--engines/sci/gui/gui_screen.cpp41
2 files changed, 36 insertions, 17 deletions
diff --git a/engines/sci/gui/gui_palette.cpp b/engines/sci/gui/gui_palette.cpp
index 56072ecaef..2e2ae650ae 100644
--- a/engines/sci/gui/gui_palette.cpp
+++ b/engines/sci/gui/gui_palette.cpp
@@ -143,7 +143,7 @@ bool SciGuiPalette::setAmiga() {
void SciGuiPalette::setEGA() {
int i;
- byte color, color1, color2;
+ byte color1, color2;
_sysPalette.colors[1].r = 0x000; _sysPalette.colors[1].g = 0x000; _sysPalette.colors[1].b = 0x0AA;
_sysPalette.colors[2].r = 0x000; _sysPalette.colors[2].g = 0x0AA; _sysPalette.colors[2].b = 0x000;
_sysPalette.colors[3].r = 0x000; _sysPalette.colors[3].g = 0x0AA; _sysPalette.colors[3].b = 0x0AA;
@@ -165,13 +165,11 @@ void SciGuiPalette::setEGA() {
// Now setting colors 16-254 to the correct mix colors that occur when not doing a dithering run on
// finished pictures
for (i = 0x10; i <= 0xFE; i++) {
- color = i;
- _sysPalette.colors[color].used = 1;
- color ^= color << 4;
+ _sysPalette.colors[i].used = 1;
color1 = i & 0x0F; color2 = i >> 4;
- _sysPalette.colors[color].r = (_sysPalette.colors[color1].r >> 1) + (_sysPalette.colors[color2].r >> 1);
- _sysPalette.colors[color].g = (_sysPalette.colors[color1].g >> 1) + (_sysPalette.colors[color2].g >> 1);
- _sysPalette.colors[color].b = (_sysPalette.colors[color1].b >> 1) + (_sysPalette.colors[color2].b >> 1);
+ _sysPalette.colors[i].r = (_sysPalette.colors[color1].r >> 1) + (_sysPalette.colors[color2].r >> 1);
+ _sysPalette.colors[i].g = (_sysPalette.colors[color1].g >> 1) + (_sysPalette.colors[color2].g >> 1);
+ _sysPalette.colors[i].b = (_sysPalette.colors[color1].b >> 1) + (_sysPalette.colors[color2].b >> 1);
}
setOnScreen();
}
diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp
index f9a63c3d81..26a81ef833 100644
--- a/engines/sci/gui/gui_screen.cpp
+++ b/engines/sci/gui/gui_screen.cpp
@@ -222,17 +222,38 @@ void SciGuiScreen::dither() {
byte *screenPtr = _visualScreen;
byte *displayPtr = _displayScreen;
- for (y = 0; y < _height; y++) {
- for (x = 0; x < _width; x++) {
- color = *screenPtr;
- if (color & 0xF0) {
- color ^= color << 4;
- color = ((x^y) & 1) ? color >> 4 : color & 0x0F;
- *screenPtr = color;
- if (!_unditherState)
- *displayPtr = color;
+ if (!_unditherState) {
+ // Do dithering on visual and display-screen
+ for (y = 0; y < _height; y++) {
+ for (x = 0; x < _width; x++) {
+ color = *screenPtr;
+ if (color & 0xF0) {
+ color ^= color << 4;
+ color = ((x^y) & 1) ? color >> 4 : color & 0x0F;
+ *screenPtr = color; *displayPtr = color;
+ }
+ screenPtr++; displayPtr++;
+ }
+ }
+ } else {
+ // Do dithering on visual screen and put decoded but undithered byte onto display-screen
+ for (y = 0; y < _height; y++) {
+ for (x = 0; x < _width; x++) {
+ color = *screenPtr;
+ if (color & 0xF0) {
+ color ^= color << 4;
+ // if decoded color wants do dither with black on left side, we turn it around
+ // otherwise the normal ega color would get used for display
+ if (color & 0xF0) {
+ *displayPtr = color;
+ } else {
+ *displayPtr = color << 4;
+ }
+ color = ((x^y) & 1) ? color >> 4 : color & 0x0F;
+ *screenPtr = color;
+ }
+ screenPtr++; displayPtr++;
}
- screenPtr++; displayPtr++;
}
}
}