diff options
author | Travis Howell | 2006-02-21 21:59:37 +0000 |
---|---|---|
committer | Travis Howell | 2006-02-21 21:59:37 +0000 |
commit | fcd9c0905910ccb6485b3f16810acab944a48517 (patch) | |
tree | c3af87f8f5759f5f105721f0edd0e019b2c9bd5a /engines/scumm/he | |
parent | c50da10571e0e6c8fc8601eefef0238f3e5c3353 (diff) | |
download | scummvm-rg350-fcd9c0905910ccb6485b3f16810acab944a48517.tar.gz scummvm-rg350-fcd9c0905910ccb6485b3f16810acab944a48517.tar.bz2 scummvm-rg350-fcd9c0905910ccb6485b3f16810acab944a48517.zip |
Cleanup decompressWizImage() in HE games
svn-id: r20809
Diffstat (limited to 'engines/scumm/he')
-rw-r--r-- | engines/scumm/he/wiz_he.cpp | 125 |
1 files changed, 56 insertions, 69 deletions
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index aa35412587..ab9d7a0d6d 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -480,94 +480,81 @@ void Wiz::decompressWizImage(uint8 *dst, int dstPitch, const Common::Rect &dstRe while (h--) { xoff = srcRect.left; - off = READ_LE_UINT16(dataPtr); - w = srcRect.right - srcRect.left; - dstPtrNext = dstPitch + dstPtr; - dataPtrNext = off + 2 + dataPtr; - dataPtr += 2; - if (off == 0) - goto dec_next; - - // Skip over the leftmost 'srcRect->left' pixels. - // TODO: This code could be merged (at a loss of efficency) with the - // loop below which does the actual drawing. - while (xoff > 0) { - code = *dataPtr++; - databit = code & 1; - code >>= 1; - if (databit) { - xoff -= code; - if (xoff < 0) { - code = -xoff; - goto dec_sub1; - } - } else { + w = srcRect.width(); + off = READ_LE_UINT16(dataPtr); dataPtr += 2; + dstPtrNext = dstPtr + dstPitch; + dataPtrNext = dataPtr + off; + if (off != 0) { + while (w > 0) { + code = *dataPtr++; databit = code & 1; - code = (code >> 1) + 1; + code >>= 1; if (databit) { - ++dataPtr; - xoff -= code; - if (xoff < 0) { - code = -xoff; - --dataPtr; - goto dec_sub2; - } - } else { - dataPtr += code; - xoff -= code; - if (xoff < 0) { - dataPtr += xoff; + if (xoff > 0) { + xoff -= code; + if (xoff >= 0) + continue; + code = -xoff; - goto dec_sub3; } - } - } - } - while (w > 0) { - code = *dataPtr++; - databit = code & 1; - code >>= 1; - if (databit) { -dec_sub1: dstPtr += code; - w -= code; - } else { - databit = code & 1; - code = (code >> 1) + 1; - if (databit) { -dec_sub2: w -= code; - if (w < 0) { - code += w; - } - while (code--) { - if (xmapPtr) { - *dstPtr = xmapPtr[palPtr[*dataPtr] * 256 + *dstPtr]; - dstPtr++; + dstPtr += code; + w -= code; + } else { + databit = code & 1; + code = (code >> 1) + 1; + + if (xoff > 0) { + xoff -= code; + if (databit) { + ++dataPtr; + if (xoff >= 0) + continue; + + code = -xoff; + --dataPtr; } else { - *dstPtr++ = palPtr[*dataPtr]; + dataPtr += code; + if (xoff >= 0) + continue; + + code = -xoff; + dataPtr += xoff; } } - dataPtr++; - } else { -dec_sub3: w -= code; + + w -= code; if (w < 0) { code += w; } - while (code--) { - if (xmapPtr) { - *dstPtr = xmapPtr[palPtr[*dataPtr++] * 256 + *dstPtr]; - dstPtr++; - } else { - *dstPtr++ = palPtr[*dataPtr++]; + + if (databit) { + while (code--) { + if (xmapPtr) { + *dstPtr = xmapPtr[palPtr[*dataPtr] * 256 + *dstPtr]; + dstPtr++; + } else { + *dstPtr++ = palPtr[*dataPtr]; + } + } + dataPtr++; + } else { + while (code--) { + if (xmapPtr) { + *dstPtr = xmapPtr[palPtr[*dataPtr++] * 256 + *dstPtr]; + dstPtr++; + } else { + *dstPtr++ = palPtr[*dataPtr++]; + } } } } } } -dec_next: dataPtr = dataPtrNext; dstPtr = dstPtrNext; } + } int Wiz::isWizPixelNonTransparent(const uint8 *data, int x, int y, int w, int h) { |