aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorTravis Howell2004-09-25 11:17:23 +0000
committerTravis Howell2004-09-25 11:17:23 +0000
commit0c12afcd71cf5689279ee3ba6fc1e4922b66f23f (patch)
treebb02e69214a2e89a0ed94519b5556f413113faa9 /scumm
parent05829b6edb131033adc9010af05a5326bfea5cb5 (diff)
downloadscummvm-rg350-0c12afcd71cf5689279ee3ba6fc1e4922b66f23f.tar.gz
scummvm-rg350-0c12afcd71cf5689279ee3ba6fc1e4922b66f23f.tar.bz2
scummvm-rg350-0c12afcd71cf5689279ee3ba6fc1e4922b66f23f.zip
Cleanup to reduce code duplication.
svn-id: r15264
Diffstat (limited to 'scumm')
-rw-r--r--scumm/gfx.cpp51
-rw-r--r--scumm/gfx.h5
2 files changed, 7 insertions, 49 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 781798a615..4e1d112eb9 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -1384,12 +1384,12 @@ void Gdi::drawBMAPBg(const byte *ptr, VirtScreen *vs, int startstrip, int width)
// TODO: The following few lines more or less duplicate decompressBitmap(), only
// for an area spanning multiple strips. In particular, the codecs 13 & 14
// in decompressBitmap call drawStripHE(), which use the same algorithm as
- // decompressBMAPbg() does...
+ // drawStripHE() does...
if ((code >= 134 && code <= 138) || (code >= 144 && code <= 148)) {
_decomp_shr = code % 10;
_decomp_mask = 0xFF >> (8 - _decomp_shr);
- decompressBMAPbg((byte *)vs->backBuf, width, vs->w, vs->h, bmap_ptr);
+ drawStripHE((byte *)vs->backBuf, width, bmap_ptr, vs->w, vs->h, false);
}
copyVirtScreenBuffers(Common::Rect(0, 0, vs->w - 1, vs->h - 1));
@@ -2080,12 +2080,12 @@ bool Gdi::decompressBitmap(byte *dst, int dstPitch, const byte *src, int numLine
break;
case 13:
- drawStripHE(dst, dstPitch, src, numLinesToProcess, false);
+ drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, false);
break;
case 14:
useOrDecompress = true;
- drawStripHE(dst, dstPitch, src, numLinesToProcess, true);
+ drawStripHE(dst, dstPitch, src, 8, numLinesToProcess, true);
break;
default:
@@ -2155,9 +2155,7 @@ void Gdi::decompressMaskImgOr(byte *dst, const byte *src, int height) const {
} \
} while (0)
-
-// NOTE: decompressBMAPbg is actually very similar to drawStripComplex
-void Gdi::decompressBMAPbg(byte *dst, int dstPitch, int w, int height, const byte *src) const {
+void Gdi::drawStripHE(byte *dst, int dstPitch, const byte *src, int w, int height, const bool transpCheck) const {
uint32 dataBit, data, shift;
byte color;
int32 iteration;
@@ -2170,45 +2168,6 @@ void Gdi::decompressBMAPbg(byte *dst, int dstPitch, int w, int height, const byt
while (height) {
for (iteration = 0; iteration < w; iteration++) {
- *dst++ = color;
- FILL_BITS;
-
- if (READ_BIT) {
- if (!READ_BIT) {
- color = data & _decomp_mask;
- shift -= _decomp_shr;
- data >>= _decomp_shr;
- } else {
- dataBit = data & 7;
- shift -= 3;
- data >>= 3;
- // map (0, 1, 2, 3, 4, 5, 6, 7) to (-4, -3, -2, -1, 1, 2, 3, 4)
- if (dataBit >= 4)
- color += dataBit - 3;
- else
- color += dataBit - 4;
- }
- }
- }
- dst += dstPitch - w;
- height--;
- }
-}
-
-// FIXME/TODO: drawStripHE and decompressBMAPbg are essentially identical!
-void Gdi::drawStripHE(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const {
- uint32 dataBit, data, shift, iteration;
- byte color;
- const uint w = 8;
-
- color = *src;
- src++;
- data = READ_LE_UINT24(src);
- src += 3;
- shift = 24;
-
- while (height) {
- for (iteration = 0; iteration < w; iteration++) {
if (!transpCheck || color != _transparentColor)
*dst = _roomPalette[color];
dst++;
diff --git a/scumm/gfx.h b/scumm/gfx.h
index 937c74acfa..da02d90711 100644
--- a/scumm/gfx.h
+++ b/scumm/gfx.h
@@ -250,7 +250,8 @@ protected:
void unkDecode10(byte *dst, int dstPitch, const byte *src, int height) const;
void unkDecode11(byte *dst, int dstPitch, const byte *src, int height) const;
void drawStrip3DO(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
- void drawStripHE(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
+
+ void drawStripHE(byte *dst, int dstPitch, const byte *src, int w, int height, const bool transpCheck) const;
/* Mask decompressors */
void drawStripC64Mask(byte *dst, int stripnr, int width, int height) const;
@@ -265,8 +266,6 @@ protected:
int getZPlanes(const byte *smap_ptr, const byte *zplane_list[9]) const;
- void decompressBMAPbg(byte *dst, int dstPitch, int w, int h, const byte *ptr) const;
-
void drawBitmapV2Helper(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
int stripnr, int numstrip, StripTable *table);