[Scummvm-cvs-logs] SF.net SVN: scummvm: [24831] scummvm/trunk/engines/scumm/he
cyx at users.sourceforge.net
cyx at users.sourceforge.net
Sun Dec 10 01:44:40 CET 2006
Revision: 24831
http://scummvm.svn.sourceforge.net/scummvm/?rev=24831&view=rev
Author: cyx
Date: 2006-12-09 16:44:40 -0800 (Sat, 09 Dec 2006)
Log Message:
-----------
made CUP_Player only update the modified screen areas.
Modified Paths:
--------------
scummvm/trunk/engines/scumm/he/cup_player_he.cpp
scummvm/trunk/engines/scumm/he/cup_player_he.h
Modified: scummvm/trunk/engines/scumm/he/cup_player_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/cup_player_he.cpp 2006-12-10 00:41:45 UTC (rev 24830)
+++ scummvm/trunk/engines/scumm/he/cup_player_he.cpp 2006-12-10 00:44:40 UTC (rev 24831)
@@ -43,6 +43,7 @@
debug(1, "rate %d width %d height %d", _playbackRate, _width, _height);
_offscreenBuffer = (uint8 *)malloc(_width * _height);
memset(_offscreenBuffer, 0, _width * _height);
+ _paletteChanged = false;
opened = true;
}
}
@@ -108,9 +109,7 @@
} else {
_system->delayMillis(1);
}
- _system->setPalette(_paletteData, 0, 256);
- _system->copyRectToScreen(_offscreenBuffer, _width, 0, 0, _width, _height);
- _system->updateScreen();
+ updateScreen();
_vm->parseEvents();
ticks = _system->getMillis();
@@ -121,6 +120,19 @@
}
}
+void CUP_Player::setDirtyScreenRect(const Common::Rect &r) {
+ const uint8 *src = _offscreenBuffer + r.top * _width + r.left;
+ _system->copyRectToScreen(src, _width, r.left, r.top, r.width() + 1, r.height() + 1);
+}
+
+void CUP_Player::updateScreen() {
+ if (_paletteChanged) {
+ _system->setPalette(_paletteData, 0, 256);
+ _paletteChanged = false;
+ }
+ _system->updateScreen();
+}
+
void CUP_Player::parseNextTag(const uint8 *data, uint32 &tag, uint32 &size) {
tag = READ_BE_UINT32(data);
size = READ_BE_UINT32(data + 4);
@@ -183,6 +195,7 @@
*ptr++ = *data++;
*ptr++ = 0;
}
+ _paletteChanged = true;
}
void CUP_Player::handleFRAM(uint8 *dst, const uint8 *data, uint32 size) {
@@ -191,15 +204,16 @@
if (flags & 1) {
type = *data++;
}
- Common::Rect dstRect;
+ Common::Rect r;
if (flags & 2) {
- dstRect.left = READ_LE_UINT16(data); data += 2;
- dstRect.top = READ_LE_UINT16(data); data += 2;
- dstRect.right = READ_LE_UINT16(data); data += 2;
- dstRect.bottom = READ_LE_UINT16(data); data += 2;
+ r.left = READ_LE_UINT16(data); data += 2;
+ r.top = READ_LE_UINT16(data); data += 2;
+ r.right = READ_LE_UINT16(data); data += 2;
+ r.bottom = READ_LE_UINT16(data); data += 2;
}
if (flags & 0x80) {
- decodeFRAM(dst, dstRect, data, type);
+ decodeFRAM(dst, r, data, type);
+ setDirtyScreenRect(r);
}
}
@@ -240,13 +254,15 @@
}
void CUP_Player::handleSRLE(uint8 *dst, const uint8 *data, uint32 size) {
-// x1 = READ_LE_UINT16(data + 0);
-// y1 = READ_LE_UINT16(data + 2);
-// x2 = READ_LE_UINT16(data + 4);
-// y2 = READ_LE_UINT16(data + 6);
- const uint8 *colorMap = data + 8;
- int unpackedSize = READ_LE_UINT32(data + 40);
- decodeSRLE(dst, colorMap, data + 44, unpackedSize);
+ Common::Rect r;
+ r.left = READ_LE_UINT16(data); data += 2;
+ r.top = READ_LE_UINT16(data); data += 2;
+ r.right = READ_LE_UINT16(data); data += 2;
+ r.bottom = READ_LE_UINT16(data); data += 2;
+ const uint8 *colorMap = data;
+ int unpackedSize = READ_LE_UINT32(data + 32);
+ decodeSRLE(dst, colorMap, data + 36, unpackedSize);
+ setDirtyScreenRect(r);
}
void CUP_Player::decodeSRLE(uint8 *dst, const uint8 *colorMap, const uint8 *data, int unpackedSize) {
Modified: scummvm/trunk/engines/scumm/he/cup_player_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/cup_player_he.h 2006-12-10 00:41:45 UTC (rev 24830)
+++ scummvm/trunk/engines/scumm/he/cup_player_he.h 2006-12-10 00:44:40 UTC (rev 24831)
@@ -38,6 +38,7 @@
uint32 _currentChunkSize;
uint8 *_bufferLzssData;
uint32 _bufferLzssSize;
+ bool _paletteChanged;
ScummEngine_vCUPhe *_vm;
Audio::Mixer *_mixer;
@@ -58,6 +59,8 @@
uint32 loadNextChunk();
void parseHeaderTags();
void play();
+ void setDirtyScreenRect(const Common::Rect &r);
+ void updateScreen();
void parseNextTag(const uint8 *data, uint32 &tag, uint32 &size);
void handleHEAD(const uint8 *data, uint32 dataSize);
void handleSFXB(const uint8 *data, uint32 dataSize);
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