diff options
author | Martin Kiewitz | 2009-10-07 22:03:17 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-10-07 22:03:17 +0000 |
commit | e6fc06344d78bece094e01112db044c2cf185c7e (patch) | |
tree | 444c5b0f8c5105cf2c3880524ccf903bfd379603 | |
parent | a61076a645e8c185b54d290f223b70fea2fccb3b (diff) | |
download | scummvm-rg350-e6fc06344d78bece094e01112db044c2cf185c7e.tar.gz scummvm-rg350-e6fc06344d78bece094e01112db044c2cf185c7e.tar.bz2 scummvm-rg350-e6fc06344d78bece094e01112db044c2cf185c7e.zip |
SCI/newgui: changed dithering logic, otherwise colors combined with black wouldnt get undithered correctly
svn-id: r44762
-rw-r--r-- | engines/sci/gui/gui_palette.cpp | 11 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.cpp | 10 |
2 files changed, 10 insertions, 11 deletions
diff --git a/engines/sci/gui/gui_palette.cpp b/engines/sci/gui/gui_palette.cpp index d979491d1d..5c2bfa6c01 100644 --- a/engines/sci/gui/gui_palette.cpp +++ b/engines/sci/gui/gui_palette.cpp @@ -144,7 +144,7 @@ bool SciGuiPalette::setAmiga() { void SciGuiPalette::setEGA() { int i; - byte color1, color2; + byte color, 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,12 +165,13 @@ 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 = 16; i <= 254; i++) { + for (i = 0x10; i <= 0xFE; i++) { _sysPalette.colors[i].used = 1; + color ^= i << 4; color1 = i & 0x0F; color2 = i >> 4; - _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); + _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); } setOnScreen(); } diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp index e2da6fd072..555387e537 100644 --- a/engines/sci/gui/gui_screen.cpp +++ b/engines/sci/gui/gui_screen.cpp @@ -224,7 +224,7 @@ void SciGuiScreen::setPalette(GuiPalette*pal) { // Currently not really done, its supposed to be possible to only dither _visualScreen void SciGuiScreen::dither() { int y, x; - byte color, ditheredColor; + byte color; byte *screenPtr = _visualScreen; byte *displayPtr = _displayScreen; @@ -233,12 +233,10 @@ void SciGuiScreen::dither() { color = *screenPtr; if (color & 0xF0) { color ^= color << 4; - ditheredColor = ((x^y) & 1) ? color >> 4 : color & 0x0F; - *screenPtr = ditheredColor; - if (_unditherState) + color = ((x^y) & 1) ? color >> 4 : color & 0x0F; + *screenPtr = color; + if (!_unditherState) *displayPtr = color; - else - *displayPtr = ditheredColor; } screenPtr++; displayPtr++; } |