aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-05-27 06:01:15 -0400
committerPaul Gilbert2016-05-27 06:01:15 -0400
commit2b2dffc02ce4c37466b1d31cf53ddb963a05e185 (patch)
tree7cf773212cff36b736313abd6442bd0f69fe5226
parentf582548516fa09d04f381445ce35b03e2fae5b59 (diff)
downloadscummvm-rg350-2b2dffc02ce4c37466b1d31cf53ddb963a05e185.tar.gz
scummvm-rg350-2b2dffc02ce4c37466b1d31cf53ddb963a05e185.tar.bz2
scummvm-rg350-2b2dffc02ce4c37466b1d31cf53ddb963a05e185.zip
SHERLOCK: Remove redundant allocation in surface creation
-rw-r--r--engines/sherlock/screen.cpp5
-rw-r--r--engines/sherlock/surface.cpp3
2 files changed, 6 insertions, 2 deletions
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index a79f5f428b..a829ab22e6 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -40,7 +40,9 @@ Screen *Screen::init(SherlockEngine *vm) {
return new Scalpel::ScalpelScreen(vm);
}
-Screen::Screen(SherlockEngine *vm) : BaseSurface(), _vm(vm) {
+Screen::Screen(SherlockEngine *vm) : BaseSurface(), _vm(vm),
+ _backBuffer1(vm->getGameID() == GType_RoseTattoo ? 640 : 320, vm->getGameID() == GType_RoseTattoo ? 480 : 200),
+ _backBuffer2(vm->getGameID() == GType_RoseTattoo ? 640 : 320, vm->getGameID() == GType_RoseTattoo ? 480 : 200) {
_transitionSeed = 1;
_fadeStyle = false;
Common::fill(&_cMap[0], &_cMap[PALETTE_SIZE], 0);
@@ -55,6 +57,7 @@ Screen::Screen(SherlockEngine *vm) : BaseSurface(), _vm(vm) {
_oldFadePercent = 0;
_flushScreen = false;
+ create(_backBuffer1.w, _backBuffer1.h);
_backBuffer.create(_backBuffer1, _backBuffer1.getBounds());
}
diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp
index 92ebdb6fea..93bc001149 100644
--- a/engines/sherlock/surface.cpp
+++ b/engines/sherlock/surface.cpp
@@ -25,7 +25,8 @@
namespace Sherlock {
-BaseSurface::BaseSurface() : Graphics::Screen(), Fonts() {
+BaseSurface::BaseSurface() : Graphics::Screen(0, 0), Fonts() {
+ free(); // Free the 0x0 surface allocated by Graphics::Screen
}
BaseSurface::BaseSurface(int width, int height) : Graphics::Screen(width, height),