[Scummvm-cvs-logs] SF.net SVN: scummvm:[46603] scummvm/trunk/engines/sci/gui/gui_picture.cpp
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Sat Dec 26 20:23:57 CET 2009
Revision: 46603
http://scummvm.svn.sourceforge.net/scummvm/?rev=46603&view=rev
Author: m_kiewitz
Date: 2009-12-26 19:23:57 +0000 (Sat, 26 Dec 2009)
Log Message:
-----------
SCI: support for "no compression" pictures in sci32
Modified Paths:
--------------
scummvm/trunk/engines/sci/gui/gui_picture.cpp
Modified: scummvm/trunk/engines/sci/gui/gui_picture.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_picture.cpp 2009-12-26 19:06:17 UTC (rev 46602)
+++ scummvm/trunk/engines/sci/gui/gui_picture.cpp 2009-12-26 19:23:57 UTC (rev 46603)
@@ -138,6 +138,7 @@
int16 displaceX, displaceY;
byte priority = _addToFlag ? _priority : 0;
byte clearColor;
+ bool compression = true;
byte curByte, runLength;
int16 y, lastY, x, leftX, rightX;
uint16 pixelNr, pixelCount;
@@ -150,6 +151,8 @@
displaceX = READ_LE_UINT16(headerPtr + 4); // probably signed?!?
displaceY = READ_LE_UINT16(headerPtr + 6); // probably signed?!?
clearColor = headerPtr[8];
+ if (headerPtr[9] == 0)
+ compression = false;
}
if (displaceX || displaceY)
@@ -160,34 +163,74 @@
if (!celBitmap)
error("Unable to allocate temporary memory for picture drawing");
- // We will unpack cel-data into a temporary buffer and then plot it to screen
- // That needs to be done cause a mirrored picture may be requested
- memset(celBitmap, clearColor, pixelCount);
- pixelNr = 0;
- ptr = celBitmap;
- if (literalPos == 0) {
- // decompression for data that has only one stream (vecor embedded view data)
- switch (_resMan->getViewType()) {
- case kViewEga:
- while (pixelNr < pixelCount) {
- curByte = *rlePtr++;
- runLength = curByte >> 4;
- memset(ptr + pixelNr, curByte & 0x0F, MIN<uint16>(runLength, pixelCount - pixelNr));
- pixelNr += runLength;
+ if (compression) {
+ // We will unpack cel-data into a temporary buffer and then plot it to screen
+ // That needs to be done cause a mirrored picture may be requested
+ memset(celBitmap, clearColor, pixelCount);
+ pixelNr = 0;
+ ptr = celBitmap;
+ if (literalPos == 0) {
+ // decompression for data that has only one stream (vecor embedded view data)
+ switch (_resMan->getViewType()) {
+ case kViewEga:
+ while (pixelNr < pixelCount) {
+ curByte = *rlePtr++;
+ runLength = curByte >> 4;
+ memset(ptr + pixelNr, curByte & 0x0F, MIN<uint16>(runLength, pixelCount - pixelNr));
+ pixelNr += runLength;
+ }
+ break;
+ case kViewVga:
+ case kViewVga11:
+ while (pixelNr < pixelCount) {
+ curByte = *rlePtr++;
+ runLength = curByte & 0x3F;
+ switch (curByte & 0xC0) {
+ case 0: // copy bytes as-is
+ while (runLength-- && pixelNr < pixelCount)
+ ptr[pixelNr++] = *rlePtr++;
+ break;
+ case 0x80: // fill with color
+ memset(ptr + pixelNr, *rlePtr++, MIN<uint16>(runLength, pixelCount - pixelNr));
+ pixelNr += runLength;
+ break;
+ case 0xC0: // fill with transparent
+ pixelNr += runLength;
+ break;
+ }
+ }
+ break;
+ case kViewAmiga:
+ while (pixelNr < pixelCount) {
+ curByte = *rlePtr++;
+ if (curByte & 0x07) { // fill with color
+ runLength = curByte & 0x07;
+ curByte = curByte >> 3;
+ while (runLength-- && pixelNr < pixelCount) {
+ ptr[pixelNr++] = curByte;
+ }
+ } else { // fill with transparent
+ runLength = curByte >> 3;
+ pixelNr += runLength;
+ }
+ }
+ break;
+
+ default:
+ error("Unsupported picture viewtype");
}
- break;
- case kViewVga:
- case kViewVga11:
+ } else {
+ // decompression for data that has two separate streams (probably SCI 1.1 picture)
while (pixelNr < pixelCount) {
curByte = *rlePtr++;
runLength = curByte & 0x3F;
switch (curByte & 0xC0) {
case 0: // copy bytes as-is
while (runLength-- && pixelNr < pixelCount)
- ptr[pixelNr++] = *rlePtr++;
+ ptr[pixelNr++] = *literalPtr++;
break;
case 0x80: // fill with color
- memset(ptr + pixelNr, *rlePtr++, MIN<uint16>(runLength, pixelCount - pixelNr));
+ memset(ptr + pixelNr, *literalPtr++, MIN<uint16>(runLength, pixelCount - pixelNr));
pixelNr += runLength;
break;
case 0xC0: // fill with transparent
@@ -195,45 +238,10 @@
break;
}
}
- break;
- case kViewAmiga:
- while (pixelNr < pixelCount) {
- curByte = *rlePtr++;
- if (curByte & 0x07) { // fill with color
- runLength = curByte & 0x07;
- curByte = curByte >> 3;
- while (runLength-- && pixelNr < pixelCount) {
- ptr[pixelNr++] = curByte;
- }
- } else { // fill with transparent
- runLength = curByte >> 3;
- pixelNr += runLength;
- }
- }
- break;
-
- default:
- error("Unsupported picture viewtype");
}
} else {
- // decompression for data that has two separate streams (probably SCI 1.1 picture)
- while (pixelNr < pixelCount) {
- curByte = *rlePtr++;
- runLength = curByte & 0x3F;
- switch (curByte & 0xC0) {
- case 0: // copy bytes as-is
- while (runLength-- && pixelNr < pixelCount)
- ptr[pixelNr++] = *literalPtr++;
- break;
- case 0x80: // fill with color
- memset(ptr + pixelNr, *literalPtr++, MIN<uint16>(runLength, pixelCount - pixelNr));
- pixelNr += runLength;
- break;
- case 0xC0: // fill with transparent
- pixelNr += runLength;
- break;
- }
- }
+ // No compression (some SCI32 pictures)
+ memcpy(celBitmap, rlePtr, pixelCount);
}
// Set initial vertical coordinate by using current port
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list