aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBastien Bouclet2010-11-29 20:57:41 +0000
committerBastien Bouclet2010-11-29 20:57:41 +0000
commit2ac1fdad321a510fdb10f01f89c32818a06488a3 (patch)
tree6f3385ded14bade7a7dc12038b8568ad837f826a /engines
parent359cece3b745e668316c4b36f4aa851d17a0465d (diff)
downloadscummvm-rg350-2ac1fdad321a510fdb10f01f89c32818a06488a3.tar.gz
scummvm-rg350-2ac1fdad321a510fdb10f01f89c32818a06488a3.tar.bz2
scummvm-rg350-2ac1fdad321a510fdb10f01f89c32818a06488a3.zip
Revert "MOHAWK: Revert the screen cache since it has a huge performance hit, and is not needed as is."
This reverts commit 291bea1858c12b8557aeb46e6f57dc701293c956. svn-id: r54624
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/graphics.cpp11
-rw-r--r--engines/mohawk/graphics.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index ee1ffb26f1..5732c96d0d 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -138,6 +138,9 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) {
_pictureFile.entries = NULL;
+ // Initialize our buffer
+ _mainScreen = new Graphics::Surface();
+ _mainScreen->create(_vm->_system->getWidth(), _vm->_system->getHeight(), _pixelFormat.bytesPerPixel);
_dirtyScreen = false;
}
@@ -146,6 +149,9 @@ MystGraphics::~MystGraphics() {
delete _jpegDecoder;
delete _pictDecoder;
delete[] _pictureFile.entries;
+
+ _mainScreen->free();
+ delete _mainScreen;
}
static const char* picFileNames[] = {
@@ -267,9 +273,9 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm
// Convert from bitmap coordinates to surface coordinates
uint16 top = surface->h - src.top - height;
-
- _vm->_system->copyRectToScreen((byte *)surface->getBasePtr(src.left, top), surface->pitch, dest.left, dest.top, width, height);
+ 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;
@@ -282,6 +288,7 @@ void MystGraphics::copyImageToScreen(uint16 image, Common::Rect dest) {
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);
_vm->_system->updateScreen();
_dirtyScreen = false;
}
diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h
index 75ffe12987..6942aba4f4 100644
--- a/engines/mohawk/graphics.h
+++ b/engines/mohawk/graphics.h
@@ -130,6 +130,7 @@ private:
Common::File picFile;
} _pictureFile;
+ Graphics::Surface *_mainScreen;
bool _dirtyScreen;
Graphics::PixelFormat _pixelFormat;
};