aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/view.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2010-10-15 21:12:42 +0000
committerMartin Kiewitz2010-10-15 21:12:42 +0000
commit41e9691e86168ab9814aa9f2b15a0e35320c7a14 (patch)
treef124a7b3f52a0652c8ee6c790aadc510ed7ca4d4 /engines/sci/graphics/view.cpp
parent5ba92baa9fbf798a30da9c7cfe09fa31fd304854 (diff)
downloadscummvm-rg350-41e9691e86168ab9814aa9f2b15a0e35320c7a14.tar.gz
scummvm-rg350-41e9691e86168ab9814aa9f2b15a0e35320c7a14.tar.bz2
scummvm-rg350-41e9691e86168ab9814aa9f2b15a0e35320c7a14.zip
SCI: fixing view-undithering for laura bow 1
(cupboards in room 43, just in the room to the left from the start) svn-id: r53515
Diffstat (limited to 'engines/sci/graphics/view.cpp')
-rw-r--r--engines/sci/graphics/view.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 6b22ed397e..943e51654b 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -525,6 +525,10 @@ void GfxView::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte cl
if (width <= 3)
return;
+ // We need at least 2 pixel lines
+ if (height < 2)
+ return;
+
// If EGA mapping is used for this view, dont do undithering as well
if (_EGAmapping)
return;
@@ -533,20 +537,27 @@ void GfxView::unditherBitmap(byte *bitmapPtr, int16 width, int16 height, byte cl
int16 bitmapMemorial[SCI_SCREEN_UNDITHERMEMORIAL_SIZE];
byte *curPtr;
byte color1, color2;
+ byte nextColor1, nextColor2;
int16 y, x;
memset(&bitmapMemorial, 0, sizeof(bitmapMemorial));
// Count all seemingly dithered pixel-combinations as soon as at least 4
// pixels are adjacent
+ int16 checkHeight = height - 1;
curPtr = bitmapPtr;
- for (y = 0; y < height; y++) {
+ byte *nextPtr = curPtr + width;
+ for (y = 0; y < checkHeight; y++) {
color1 = curPtr[0]; color2 = (curPtr[1] << 4) | curPtr[2];
+ nextColor1 = nextPtr[0] << 4; nextColor2 = (nextPtr[2] << 4) | nextPtr[1];
curPtr += 3;
+ nextPtr += 3;
for (x = 3; x < width; x++) {
color1 = (color1 << 4) | (color2 >> 4);
color2 = (color2 << 4) | *curPtr++;
- if (color1 == color2)
+ nextColor1 = (nextColor1 >> 4) | (nextColor2 << 4);
+ nextColor2 = (nextColor2 >> 4) | *nextPtr++ << 4;
+ if ((color1 == color2) && (color1 == nextColor1) && (color1 == nextColor2))
bitmapMemorial[color1]++;
}
}