[Scummvm-cvs-logs] SF.net SVN: scummvm:[54625] scummvm/trunk/engines/mohawk
bgk at users.sourceforge.net
bgk at users.sourceforge.net
Mon Nov 29 21:57:54 CET 2010
Revision: 54625
http://scummvm.svn.sourceforge.net/scummvm/?rev=54625&view=rev
Author: bgk
Date: 2010-11-29 20:57:54 +0000 (Mon, 29 Nov 2010)
Log Message:
-----------
MOHAWK: Added dirty rects support for Myst
Modified Paths:
--------------
scummvm/trunk/engines/mohawk/graphics.cpp
scummvm/trunk/engines/mohawk/graphics.h
Modified: scummvm/trunk/engines/mohawk/graphics.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/graphics.cpp 2010-11-29 20:57:41 UTC (rev 54624)
+++ scummvm/trunk/engines/mohawk/graphics.cpp 2010-11-29 20:57:54 UTC (rev 54625)
@@ -141,7 +141,6 @@
// Initialize our buffer
_mainScreen = new Graphics::Surface();
_mainScreen->create(_vm->_system->getWidth(), _vm->_system->getHeight(), _pixelFormat.bytesPerPixel);
- _dirtyScreen = false;
}
MystGraphics::~MystGraphics() {
@@ -277,8 +276,8 @@
for (uint16 i = 0; i < height; i++)
memcpy(_mainScreen->getBasePtr(dest.left, i + dest.top), surface->getBasePtr(src.left, top + i), width * surface->bytesPerPixel);
- // Mark the screen as dirty
- _dirtyScreen = true;
+ // Add to the list of dirty rects
+ _dirtyRects.push_back(dest);
}
void MystGraphics::copyImageToScreen(uint16 image, Common::Rect dest) {
@@ -286,11 +285,17 @@
}
void MystGraphics::updateScreen() {
- if (_dirtyScreen) {
- // Only copy the buffer to the screen if it's dirty
- _vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
+ // Only update the screen if there have been changes since last frame
+ if (!_dirtyRects.empty()) {
+
+ // Copy any modified area
+ for (uint i = 0; i < _dirtyRects.size(); i++) {
+ Common::Rect &r = _dirtyRects[i];
+ _vm->_system->copyRectToScreen((byte *)_mainScreen->getBasePtr(r.left, r.top), _mainScreen->pitch, r.left, r.top, r.width(), r.height());
+ }
+
_vm->_system->updateScreen();
- _dirtyScreen = false;
+ _dirtyRects.clear();
}
}
Modified: scummvm/trunk/engines/mohawk/graphics.h
===================================================================
--- scummvm/trunk/engines/mohawk/graphics.h 2010-11-29 20:57:41 UTC (rev 54624)
+++ scummvm/trunk/engines/mohawk/graphics.h 2010-11-29 20:57:54 UTC (rev 54625)
@@ -131,7 +131,7 @@
} _pictureFile;
Graphics::Surface *_mainScreen;
- bool _dirtyScreen;
+ Common::Array<Common::Rect> _dirtyRects;
Graphics::PixelFormat _pixelFormat;
};
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