diff options
author | Torbjörn Andersson | 2008-04-20 15:36:40 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2008-04-20 15:36:40 +0000 |
commit | 7e07dd5ec720905e09c5aac37a80941c6053e132 (patch) | |
tree | c547330503a3d8de2b15c596a406fd11485fd0ae /engines/made/graphics.cpp | |
parent | 84a7cd33876eabfcc1fedd0b126f77039647edaf (diff) | |
download | scummvm-rg350-7e07dd5ec720905e09c5aac37a80941c6053e132.tar.gz scummvm-rg350-7e07dd5ec720905e09c5aac37a80941c6053e132.tar.bz2 scummvm-rg350-7e07dd5ec720905e09c5aac37a80941c6053e132.zip |
Changed spaces to tabs.
svn-id: r31610
Diffstat (limited to 'engines/made/graphics.cpp')
-rw-r--r-- | engines/made/graphics.cpp | 226 |
1 files changed, 113 insertions, 113 deletions
diff --git a/engines/made/graphics.cpp b/engines/made/graphics.cpp index 76c10d97cc..081621ef18 100644 --- a/engines/made/graphics.cpp +++ b/engines/made/graphics.cpp @@ -31,121 +31,121 @@ namespace Made { void decompressImage(byte *source, Graphics::Surface &surface, uint16 cmdOffs, uint16 pixelOffs, uint16 maskOffs, uint16 lineSize, bool deltaFrame) { - const int offsets[] = { - 0, 1, 2, 3, - 320, 321, 322, 323, - 640, 641, 642, 643, - 960, 961, 962, 963 - }; + const int offsets[] = { + 0, 1, 2, 3, + 320, 321, 322, 323, + 640, 641, 642, 643, + 960, 961, 962, 963 + }; uint16 width = surface.w; - uint16 height = surface.h; - - byte *cmdBuffer = source + cmdOffs; - byte *maskBuffer = source + maskOffs; - byte *pixelBuffer = source + pixelOffs; - - byte *destPtr = (byte*)surface.getBasePtr(0, 0); - - //byte lineBuf[320 * 4]; - byte lineBuf[640 * 4]; - byte bitBuf[40]; - - int bitBufLastOfs = (((lineSize + 1) >> 1) << 1) - 2; - int bitBufLastCount = ((width + 3) >> 2) & 7; - if (bitBufLastCount == 0) - bitBufLastCount = 8; - - while (height > 0) { - - int drawDestOfs = 0; - - memset(lineBuf, 0, sizeof(lineBuf)); - - memcpy(bitBuf, cmdBuffer, lineSize); - cmdBuffer += lineSize; - - for (uint16 bitBufOfs = 0; bitBufOfs < lineSize; bitBufOfs += 2) { - - uint16 bits = READ_LE_UINT16(&bitBuf[bitBufOfs]); - - int bitCount; - if (bitBufOfs == bitBufLastOfs) - bitCount = bitBufLastCount; - else - bitCount = 8; - - for (int curCmd = 0; curCmd < bitCount; curCmd++) { - int cmd = bits & 3; - bits >>= 2; - - byte pixels[4]; - uint32 mask; - - switch (cmd) { - - case 0: - pixels[0] = *pixelBuffer++; - for (int i = 0; i < 16; i++) - lineBuf[drawDestOfs + offsets[i]] = pixels[0]; - break; - - case 1: - pixels[0] = *pixelBuffer++; - pixels[1] = *pixelBuffer++; - mask = READ_LE_UINT16(maskBuffer); - maskBuffer += 2; - for (int i = 0; i < 16; i++) { - lineBuf[drawDestOfs + offsets[i]] = pixels[mask & 1]; - mask >>= 1; - } - break; - - case 2: - pixels[0] = *pixelBuffer++; - pixels[1] = *pixelBuffer++; - pixels[2] = *pixelBuffer++; - pixels[3] = *pixelBuffer++; - mask = READ_LE_UINT32(maskBuffer); - maskBuffer += 4; - for (int i = 0; i < 16; i++) { - lineBuf[drawDestOfs + offsets[i]] = pixels[mask & 3]; - mask >>= 2; - } - break; - - case 3: - if (!deltaFrame) { - // Yes, it reads from maskBuffer here - for (int i = 0; i < 16; i++) - lineBuf[drawDestOfs + offsets[i]] = *maskBuffer++; - } - break; - - } - - drawDestOfs += 4; - - } - - } - - if (deltaFrame) { - for (int y = 0; y < 4 && height > 0; y++, height--) { - for (int x = 0; x < width; x++) { - if (lineBuf[x + y * 320] != 0) - *destPtr = lineBuf[x + y * 320]; - destPtr++; - } - } - } else { - for (int y = 0; y < 4 && height > 0; y++, height--) { - memcpy(destPtr, &lineBuf[y * 320], width); - destPtr += width; - } - } - - } + uint16 height = surface.h; + + byte *cmdBuffer = source + cmdOffs; + byte *maskBuffer = source + maskOffs; + byte *pixelBuffer = source + pixelOffs; + + byte *destPtr = (byte*)surface.getBasePtr(0, 0); + + //byte lineBuf[320 * 4]; + byte lineBuf[640 * 4]; + byte bitBuf[40]; + + int bitBufLastOfs = (((lineSize + 1) >> 1) << 1) - 2; + int bitBufLastCount = ((width + 3) >> 2) & 7; + if (bitBufLastCount == 0) + bitBufLastCount = 8; + + while (height > 0) { + + int drawDestOfs = 0; + + memset(lineBuf, 0, sizeof(lineBuf)); + + memcpy(bitBuf, cmdBuffer, lineSize); + cmdBuffer += lineSize; + + for (uint16 bitBufOfs = 0; bitBufOfs < lineSize; bitBufOfs += 2) { + + uint16 bits = READ_LE_UINT16(&bitBuf[bitBufOfs]); + + int bitCount; + if (bitBufOfs == bitBufLastOfs) + bitCount = bitBufLastCount; + else + bitCount = 8; + + for (int curCmd = 0; curCmd < bitCount; curCmd++) { + int cmd = bits & 3; + bits >>= 2; + + byte pixels[4]; + uint32 mask; + + switch (cmd) { + + case 0: + pixels[0] = *pixelBuffer++; + for (int i = 0; i < 16; i++) + lineBuf[drawDestOfs + offsets[i]] = pixels[0]; + break; + + case 1: + pixels[0] = *pixelBuffer++; + pixels[1] = *pixelBuffer++; + mask = READ_LE_UINT16(maskBuffer); + maskBuffer += 2; + for (int i = 0; i < 16; i++) { + lineBuf[drawDestOfs + offsets[i]] = pixels[mask & 1]; + mask >>= 1; + } + break; + + case 2: + pixels[0] = *pixelBuffer++; + pixels[1] = *pixelBuffer++; + pixels[2] = *pixelBuffer++; + pixels[3] = *pixelBuffer++; + mask = READ_LE_UINT32(maskBuffer); + maskBuffer += 4; + for (int i = 0; i < 16; i++) { + lineBuf[drawDestOfs + offsets[i]] = pixels[mask & 3]; + mask >>= 2; + } + break; + + case 3: + if (!deltaFrame) { + // Yes, it reads from maskBuffer here + for (int i = 0; i < 16; i++) + lineBuf[drawDestOfs + offsets[i]] = *maskBuffer++; + } + break; + + } + + drawDestOfs += 4; + + } + + } + + if (deltaFrame) { + for (int y = 0; y < 4 && height > 0; y++, height--) { + for (int x = 0; x < width; x++) { + if (lineBuf[x + y * 320] != 0) + *destPtr = lineBuf[x + y * 320]; + destPtr++; + } + } + } else { + for (int y = 0; y < 4 && height > 0; y++, height--) { + memcpy(destPtr, &lineBuf[y * 320], width); + destPtr += width; + } + } + + } } |