[Scummvm-cvs-logs] scummvm master -> 024f79d282bd30bf11e30aee46b77669c05f60ea

dreammaster dreammaster at scummvm.org
Tue Mar 22 01:23:32 CET 2016


This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
892aa2886c SHERLOCK: Get rid of Surface::setPixelData.
fc17d9750f SHERLOCK: Make Screen::_backBuffer protected.
453b77d386 SHERLOCK: Make Screen::_backBuffer an object instead of pointer.
c299b8ce08 GRAPHICS: Set parameterless Screen constructor to use screen format
8fa5522819 SHERLOCK: Fix crashes due to back buffer refactoring
024f79d282 Merge branch 'sherlock-setpixels'


Commit: 892aa2886cee1ccf829e90fc72a941de22c49467
    https://github.com/scummvm/scummvm/commit/892aa2886cee1ccf829e90fc72a941de22c49467
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2016-03-21T16:24:13+01:00

Commit Message:
SHERLOCK: Get rid of Surface::setPixelData.

Changed paths:
    engines/sherlock/screen.cpp
    engines/sherlock/surface.cpp
    engines/sherlock/surface.h



diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index 33e1253..b60a931 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -319,8 +319,9 @@ void Screen::vgaBar(const Common::Rect &r, int color) {
 }
 
 void Screen::setDisplayBounds(const Common::Rect &r) {
-	_sceneSurface.setPixelsData((byte *)_backBuffer1.getBasePtr(r.left, r.top),
-		r.width(), r.height(), _backBuffer1.format);
+	_sceneSurface.create(_backBuffer1, r);
+	assert(_sceneSurface.width()  == r.width());
+	assert(_sceneSurface.height() == r.height());
 
 	_backBuffer = &_sceneSurface;
 }
diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp
index b9df33a..47b7d4a 100644
--- a/engines/sherlock/surface.cpp
+++ b/engines/sherlock/surface.cpp
@@ -33,14 +33,6 @@ Surface::Surface(int width, int height) : Graphics::ManagedSurface(width, height
 	create(width, height);
 }
 
-void Surface::setPixelsData(byte *pixelsPtr, int sizeX, int sizeY, const Graphics::PixelFormat &pixFormat) {
-	Graphics::ManagedSurface::setPixels(pixelsPtr);
-	this->format = pixFormat;
-	this->w = sizeX;
-	this->h = sizeY;
-	this->pitch = sizeX * pixFormat.bytesPerPixel;
-}
-
 void Surface::writeString(const Common::String &str, const Common::Point &pt, uint overrideColor) {
 	Fonts::writeString(this, str, pt, overrideColor);
 }
diff --git a/engines/sherlock/surface.h b/engines/sherlock/surface.h
index 856d0ed..7f946b4 100644
--- a/engines/sherlock/surface.h
+++ b/engines/sherlock/surface.h
@@ -52,11 +52,6 @@ public:
 	Surface(int width, int height);
 
 	/**
-	 * Set the surface details
-	 */
-	void setPixelsData(byte *pixelsPtr, int sizeX, int sizeY, const Graphics::PixelFormat &pixFormat);
-
-	/**
 	 * Draws a surface on this surface
 	 */
 	virtual void SHblitFrom(const Graphics::Surface &src) {


Commit: fc17d9750f08102bd13b6b7a5c5bb340b0a913bc
    https://github.com/scummvm/scummvm/commit/fc17d9750f08102bd13b6b7a5c5bb340b0a913bc
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2016-03-21T16:24:14+01:00

Commit Message:
SHERLOCK: Make Screen::_backBuffer protected.

Changed paths:
    engines/sherlock/scalpel/scalpel_inventory.cpp
    engines/sherlock/scalpel/scalpel_scene.cpp
    engines/sherlock/scalpel/scalpel_talk.cpp
    engines/sherlock/scalpel/scalpel_user_interface.cpp
    engines/sherlock/screen.h



diff --git a/engines/sherlock/scalpel/scalpel_inventory.cpp b/engines/sherlock/scalpel/scalpel_inventory.cpp
index e8d4d3b..6eb8c2c 100644
--- a/engines/sherlock/scalpel/scalpel_inventory.cpp
+++ b/engines/sherlock/scalpel/scalpel_inventory.cpp
@@ -72,11 +72,11 @@ void ScalpelInventory::drawInventory(InvNewMode mode) {
 	loadInv();
 
 	if (mode == INVENTORY_DONT_DISPLAY) {
-		screen._backBuffer = &screen._backBuffer2;
+		screen.activateBackBuffer2();
 	}
 
 	// Draw the window background
-	Surface &bb = *screen._backBuffer;
+	Surface &bb = *screen.getBackBuffer();
 	bb.fillRect(Common::Rect(0, CONTROLS_Y1, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y1 + 10), BORDER_COLOR);
 	bb.fillRect(Common::Rect(0, CONTROLS_Y1 + 10, 2, SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
 	bb.fillRect(Common::Rect(SHERLOCK_SCREEN_WIDTH - 2, CONTROLS_Y1 + 10,
@@ -128,7 +128,7 @@ void ScalpelInventory::drawInventory(InvNewMode mode) {
 		ui._windowOpen = true;
 	} else {
 		// Reset the screen back buffer to the first buffer now that drawing is done
-		screen._backBuffer = &screen._backBuffer1;
+		screen.activateBackBuffer1();
 	}
 
 	assert(IS_SERRATED_SCALPEL);
@@ -196,7 +196,7 @@ void ScalpelInventory::invCommands(bool slamIt) {
 
 void ScalpelInventory::highlight(int index, byte color) {
 	Screen &screen = *_vm->_screen;
-	Surface &bb = *screen._backBuffer;
+	Surface &bb = *screen.getBackBuffer();
 	int slot = index - _invIndex;
 	ImageFrame &frame = (*_invShapes[slot])[0];
 
@@ -278,9 +278,9 @@ void ScalpelInventory::putInv(InvSlamMode slamIt) {
 		invCommands(0);
 	}
 	else if (slamIt == SLAM_SECONDARY_BUFFER) {
-		screen._backBuffer = &screen._backBuffer2;
+		screen.activateBackBuffer2();
 		invCommands(0);
-		screen._backBuffer = &screen._backBuffer1;
+		screen.activateBackBuffer1();
 	}
 }
 
diff --git a/engines/sherlock/scalpel/scalpel_scene.cpp b/engines/sherlock/scalpel/scalpel_scene.cpp
index 83e49bb..11fb807 100644
--- a/engines/sherlock/scalpel/scalpel_scene.cpp
+++ b/engines/sherlock/scalpel/scalpel_scene.cpp
@@ -71,26 +71,26 @@ void ScalpelScene::drawAllShapes() {
 	// Draw all active shapes which are behind the person
 	for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
 		if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == BEHIND)
-			screen._backBuffer->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED);
+			screen.getBackBuffer()->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED);
 	}
 
 	// Draw all canimations which are behind the person
 	for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
 		if (_canimShapes[idx]->_type == ACTIVE_BG_SHAPE && _canimShapes[idx]->_misc == BEHIND)
-			screen._backBuffer->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame,
+			screen.getBackBuffer()->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame,
 			_canimShapes[idx]->_position, _canimShapes[idx]->_flags & OBJ_FLIPPED);
 	}
 
 	// Draw all active shapes which are normal and behind the person
 	for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
 		if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == NORMAL_BEHIND)
-			screen._backBuffer->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED);
+			screen.getBackBuffer()->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED);
 	}
 
 	// Draw all canimations which are normal and behind the person
 	for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
 		if (_canimShapes[idx]->_type == ACTIVE_BG_SHAPE && _canimShapes[idx]->_misc == NORMAL_BEHIND)
-			screen._backBuffer->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position,
+			screen.getBackBuffer()->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position,
 			_canimShapes[idx]->_flags & OBJ_FLIPPED);
 	}
 
@@ -103,7 +103,7 @@ void ScalpelScene::drawAllShapes() {
 				p._sequenceNumber == WALK_UPLEFT || p._sequenceNumber == STOP_UPLEFT ||
 				p._sequenceNumber == WALK_DOWNRIGHT || p._sequenceNumber == STOP_DOWNRIGHT);
 
-			screen._backBuffer->SHtransBlitFrom(*p._imageFrame, Common::Point(p._position.x / FIXED_INT_MULTIPLIER,
+			screen.getBackBuffer()->SHtransBlitFrom(*p._imageFrame, Common::Point(p._position.x / FIXED_INT_MULTIPLIER,
 				p._position.y / FIXED_INT_MULTIPLIER - p.frameHeight()), flipped);
 		}
 	}
@@ -112,7 +112,7 @@ void ScalpelScene::drawAllShapes() {
 	for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
 		if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) &&
 			_bgShapes[idx]._misc == NORMAL_FORWARD)
-			screen._backBuffer->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position,
+			screen.getBackBuffer()->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position,
 			_bgShapes[idx]._flags & OBJ_FLIPPED);
 	}
 
@@ -120,7 +120,7 @@ void ScalpelScene::drawAllShapes() {
 	for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
 		if ((_canimShapes[idx]->_type == ACTIVE_BG_SHAPE || _canimShapes[idx]->_type == STATIC_BG_SHAPE) &&
 			_canimShapes[idx]->_misc == NORMAL_FORWARD)
-			screen._backBuffer->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position,
+			screen.getBackBuffer()->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position,
 			_canimShapes[idx]->_flags & OBJ_FLIPPED);
 	}
 
@@ -132,7 +132,7 @@ void ScalpelScene::drawAllShapes() {
 
 		if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) &&
 			_bgShapes[idx]._misc == FORWARD)
-			screen._backBuffer->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position,
+			screen.getBackBuffer()->SHtransBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position,
 			_bgShapes[idx]._flags & OBJ_FLIPPED);
 	}
 
@@ -140,7 +140,7 @@ void ScalpelScene::drawAllShapes() {
 	for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
 		if ((_canimShapes[idx]->_type == ACTIVE_BG_SHAPE || _canimShapes[idx]->_type == STATIC_BG_SHAPE) &&
 			_canimShapes[idx]->_misc == FORWARD)
-			screen._backBuffer->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position,
+			screen.getBackBuffer()->SHtransBlitFrom(*_canimShapes[idx]->_imageFrame, _canimShapes[idx]->_position,
 			_canimShapes[idx]->_flags & OBJ_FLIPPED);
 	}
 
@@ -242,7 +242,7 @@ void ScalpelScene::doBgAnim() {
 		if (people[HOLMES]._type == CHARACTER)
 			screen.restoreBackground(bounds);
 		else if (people[HOLMES]._type == REMOVE)
-			screen._backBuffer->SHblitFrom(screen._backBuffer2, pt, bounds);
+			screen.getBackBuffer()->SHblitFrom(screen._backBuffer2, pt, bounds);
 
 		for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
 			Object &o = _bgShapes[idx];
@@ -261,7 +261,7 @@ void ScalpelScene::doBgAnim() {
 			Object &o = _bgShapes[idx];
 			if (o._type == NO_SHAPE && ((o._flags & OBJ_BEHIND) == 0)) {
 				// Restore screen area
-				screen._backBuffer->SHblitFrom(screen._backBuffer2, o._position,
+				screen.getBackBuffer()->SHblitFrom(screen._backBuffer2, o._position,
 					Common::Rect(o._position.x, o._position.y,
 					o._position.x + o._noShapeSize.x, o._position.y + o._noShapeSize.y));
 
@@ -309,14 +309,14 @@ void ScalpelScene::doBgAnim() {
 	for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
 		Object &o = _bgShapes[idx];
 		if (o._type == ACTIVE_BG_SHAPE && o._misc == BEHIND)
-			screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
+			screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
 	}
 
 	// Draw all canimations which are behind the person
 	for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
 		Object &o = *_canimShapes[idx];
 		if (o._type == ACTIVE_BG_SHAPE && o._misc == BEHIND) {
-			screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
+			screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
 		}
 	}
 
@@ -324,14 +324,14 @@ void ScalpelScene::doBgAnim() {
 	for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
 		Object &o = _bgShapes[idx];
 		if (o._type == ACTIVE_BG_SHAPE && o._misc == NORMAL_BEHIND)
-			screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
+			screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
 	}
 
 	// Draw all canimations which are NORMAL and behind the person
 	for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
 		Object &o = *_canimShapes[idx];
 		if (o._type == ACTIVE_BG_SHAPE && o._misc == NORMAL_BEHIND) {
-			screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
+			screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
 		}
 	}
 
@@ -344,7 +344,7 @@ void ScalpelScene::doBgAnim() {
 		bool flipped = people[HOLMES]._sequenceNumber == WALK_LEFT || people[HOLMES]._sequenceNumber == STOP_LEFT ||
 			people[HOLMES]._sequenceNumber == WALK_UPLEFT || people[HOLMES]._sequenceNumber == STOP_UPLEFT ||
 			people[HOLMES]._sequenceNumber == WALK_DOWNRIGHT || people[HOLMES]._sequenceNumber == STOP_DOWNRIGHT;
-		screen._backBuffer->SHtransBlitFrom(*people[HOLMES]._imageFrame,
+		screen.getBackBuffer()->SHtransBlitFrom(*people[HOLMES]._imageFrame,
 			Common::Point(tempX, people[HOLMES]._position.y / FIXED_INT_MULTIPLIER - people[HOLMES]._imageFrame->_frame.h), flipped);
 	}
 
@@ -352,14 +352,14 @@ void ScalpelScene::doBgAnim() {
 	for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
 		Object &o = _bgShapes[idx];
 		if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == NORMAL_FORWARD)
-			screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
+			screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
 	}
 
 	// Draw all static and active canimations that are NORMAL and are in front of the person
 	for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
 		Object &o = *_canimShapes[idx];
 		if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == NORMAL_FORWARD) {
-			screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
+			screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
 		}
 	}
 
@@ -367,19 +367,19 @@ void ScalpelScene::doBgAnim() {
 	for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
 		Object &o = _bgShapes[idx];
 		if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == FORWARD)
-			screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
+			screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
 	}
 
 	// Draw any active portrait
 	if (people._portraitLoaded && people._portrait._type == ACTIVE_BG_SHAPE)
-		screen._backBuffer->SHtransBlitFrom(*people._portrait._imageFrame,
+		screen.getBackBuffer()->SHtransBlitFrom(*people._portrait._imageFrame,
 			people._portrait._position, people._portrait._flags & OBJ_FLIPPED);
 
 	// Draw all static and active canimations that are in front of the person
 	for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
 		Object &o = *_canimShapes[idx];
 		if ((o._type == ACTIVE_BG_SHAPE || o._type == STATIC_BG_SHAPE) && o._misc == FORWARD) {
-			screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
+			screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
 		}
 	}
 
@@ -387,7 +387,7 @@ void ScalpelScene::doBgAnim() {
 	for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
 		Object &o = _bgShapes[idx];
 		if (o._type == NO_SHAPE && (o._flags & OBJ_BEHIND) == 0)
-			screen._backBuffer->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
+			screen.getBackBuffer()->SHtransBlitFrom(*o._imageFrame, o._position, o._flags & OBJ_FLIPPED);
 	}
 
 	// Bring the newly built picture to the screen
diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp
index b6e9482..ff38c07 100644
--- a/engines/sherlock/scalpel/scalpel_talk.cpp
+++ b/engines/sherlock/scalpel/scalpel_talk.cpp
@@ -684,7 +684,7 @@ Common::Point ScalpelTalk::get3doPortraitPosition() const {
 
 void ScalpelTalk::drawInterface() {
 	ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen;
-	Surface &bb = *screen._backBuffer;
+	Surface &bb = *screen.getBackBuffer();
 
 	bb.fillRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, CONTROLS_Y1 + 10), BORDER_COLOR);
 	bb.fillRect(Common::Rect(0, CONTROLS_Y + 10, 2, SHERLOCK_SCREEN_HEIGHT), BORDER_COLOR);
diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp
index 6534f61..8dae24e 100644
--- a/engines/sherlock/scalpel/scalpel_user_interface.cpp
+++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp
@@ -1968,7 +1968,7 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first
 		return;
 	}
 
-	Surface &bb = *screen._backBuffer;
+	Surface &bb = *screen.getBackBuffer();
 	if (firstTime) {
 		// Only draw the border on the first call
 		_infoFlag = true;
@@ -2073,7 +2073,7 @@ void ScalpelUserInterface::summonWindow(const Surface &bgSurface, bool slideUp)
 	if (slideUp) {
 		// Gradually slide up the display of the window
 		for (int idx = 1; idx <= bgSurface.height(); idx += 2) {
-			screen._backBuffer->SHblitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - idx),
+			screen.getBackBuffer()->SHblitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - idx),
 				Common::Rect(0, 0, bgSurface.width(), idx));
 			screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - idx,
 				SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
@@ -2083,7 +2083,7 @@ void ScalpelUserInterface::summonWindow(const Surface &bgSurface, bool slideUp)
 	} else {
 		// Gradually slide down the display of the window
 		for (int idx = 1; idx <= bgSurface.height(); idx += 2) {
-			screen._backBuffer->SHblitFrom(bgSurface,
+			screen.getBackBuffer()->SHblitFrom(bgSurface,
 				Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height()),
 				Common::Rect(0, bgSurface.height() - idx, bgSurface.width(), bgSurface.height()));
 			screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height(),
@@ -2094,7 +2094,7 @@ void ScalpelUserInterface::summonWindow(const Surface &bgSurface, bool slideUp)
 	}
 
 	// Final display of the entire window
-	screen._backBuffer->SHblitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height()),
+	screen.getBackBuffer()->SHblitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height()),
 		Common::Rect(0, 0, bgSurface.width(), bgSurface.height()));
 	screen.slamArea(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.height(), bgSurface.width(), bgSurface.height());
 
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index ceeb129..50aec0a 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -49,9 +49,10 @@ private:
 	int _oldFadePercent;
 protected:
 	SherlockEngine *_vm;
+	Surface *_backBuffer;
+
 public:
 	Surface _backBuffer1, _backBuffer2;
-	Surface *_backBuffer;
 	bool _fadeStyle;
 	byte _cMap[PALETTE_SIZE];
 	byte _sMap[PALETTE_SIZE];
@@ -64,6 +65,21 @@ public:
 	virtual ~Screen();
 
 	/**
+	 * Obtain the currently active back buffer.
+	 */
+	Surface *getBackBuffer() const { return _backBuffer; }
+
+	/**
+	 * Makes first back buffer active.
+	 */
+	void activateBackBuffer1() { _backBuffer = &_backBuffer1; }
+
+	/**
+	 * Makes second back buffer active.
+	 */
+	void activateBackBuffer2() { _backBuffer = &_backBuffer2; }
+
+	/**
 	 * Fades from the currently active palette to the passed palette
 	 */
 	int equalizePalette(const byte palette[PALETTE_SIZE]);


Commit: 453b77d386369ebb4c8687ab252fc0e49384cdc3
    https://github.com/scummvm/scummvm/commit/453b77d386369ebb4c8687ab252fc0e49384cdc3
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2016-03-21T16:25:15+01:00

Commit Message:
SHERLOCK: Make Screen::_backBuffer an object instead of pointer.

Changed paths:
    engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp
    engines/sherlock/scalpel/scalpel_screen.cpp
    engines/sherlock/screen.cpp
    engines/sherlock/screen.h



diff --git a/engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp b/engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp
index f848394..f8112d8 100644
--- a/engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp
+++ b/engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp
@@ -117,7 +117,7 @@ void Scalpel3DOScreen::fillRect(const Common::Rect &r, uint color) {
 void Scalpel3DOScreen::fadeIntoScreen3DO(int speed) {
 	Events &events = *_vm->_events;
 	uint16 *currentScreenBasePtr = (uint16 *)getPixels();
-	uint16 *targetScreenBasePtr = (uint16 *)_backBuffer->getPixels();
+	uint16 *targetScreenBasePtr = (uint16 *)_backBuffer.getPixels();
 	uint16  currentScreenPixel = 0;
 	uint16  targetScreenPixel = 0;
 
@@ -211,7 +211,7 @@ void Scalpel3DOScreen::fadeIntoScreen3DO(int speed) {
 
 void Scalpel3DOScreen::blitFrom3DOcolorLimit(uint16 limitColor) {
 	uint16 *currentScreenPtr = (uint16 *)getPixels();
-	uint16 *targetScreenPtr = (uint16 *)_backBuffer->getPixels();
+	uint16 *targetScreenPtr = (uint16 *)_backBuffer.getPixels();
 	uint16  currentScreenPixel = 0;
 
 	uint16  screenWidth = SHERLOCK_SCREEN_WIDTH;
diff --git a/engines/sherlock/scalpel/scalpel_screen.cpp b/engines/sherlock/scalpel/scalpel_screen.cpp
index 37e5294..ba78f48 100644
--- a/engines/sherlock/scalpel/scalpel_screen.cpp
+++ b/engines/sherlock/scalpel/scalpel_screen.cpp
@@ -35,7 +35,7 @@ ScalpelScreen::ScalpelScreen(SherlockEngine *vm) : Screen(vm) {
 void ScalpelScreen::makeButton(const Common::Rect &bounds, int textX,
 		const Common::String &buttonText, bool textContainsHotkey) {
 
-	Surface &bb = *_backBuffer;
+	Surface &bb = _backBuffer;
 	bb.fillRect(Common::Rect(bounds.left, bounds.top, bounds.right, bounds.top + 1), BUTTON_TOP);
 	bb.fillRect(Common::Rect(bounds.left, bounds.top, bounds.left + 1, bounds.bottom), BUTTON_TOP);
 	bb.fillRect(Common::Rect(bounds.right - 1, bounds.top, bounds.right, bounds.bottom), BUTTON_BOTTOM);
@@ -105,24 +105,24 @@ void ScalpelScreen::buttonPrint(const Common::Point &pt, uint color, bool slamIt
 }
 
 void ScalpelScreen::makePanel(const Common::Rect &r) {
-	_backBuffer->fillRect(r, BUTTON_MIDDLE);
-	_backBuffer->hLine(r.left, r.top, r.right - 2, BUTTON_TOP);
-	_backBuffer->hLine(r.left + 1, r.top + 1, r.right - 3, BUTTON_TOP);
-	_backBuffer->vLine(r.left, r.top, r.bottom - 1, BUTTON_TOP);
-	_backBuffer->vLine(r.left + 1, r.top + 1, r.bottom - 2, BUTTON_TOP);
-
-	_backBuffer->vLine(r.right - 1, r.top, r.bottom - 1, BUTTON_BOTTOM);
-	_backBuffer->vLine(r.right - 2, r.top + 1, r.bottom - 2, BUTTON_BOTTOM);
-	_backBuffer->hLine(r.left, r.bottom - 1, r.right - 1, BUTTON_BOTTOM);
-	_backBuffer->hLine(r.left + 1, r.bottom - 2, r.right - 1, BUTTON_BOTTOM);
+	_backBuffer.fillRect(r, BUTTON_MIDDLE);
+	_backBuffer.hLine(r.left, r.top, r.right - 2, BUTTON_TOP);
+	_backBuffer.hLine(r.left + 1, r.top + 1, r.right - 3, BUTTON_TOP);
+	_backBuffer.vLine(r.left, r.top, r.bottom - 1, BUTTON_TOP);
+	_backBuffer.vLine(r.left + 1, r.top + 1, r.bottom - 2, BUTTON_TOP);
+
+	_backBuffer.vLine(r.right - 1, r.top, r.bottom - 1, BUTTON_BOTTOM);
+	_backBuffer.vLine(r.right - 2, r.top + 1, r.bottom - 2, BUTTON_BOTTOM);
+	_backBuffer.hLine(r.left, r.bottom - 1, r.right - 1, BUTTON_BOTTOM);
+	_backBuffer.hLine(r.left + 1, r.bottom - 2, r.right - 1, BUTTON_BOTTOM);
 }
 
 void ScalpelScreen::makeField(const Common::Rect &r) {
-	_backBuffer->fillRect(r, BUTTON_MIDDLE);
-	_backBuffer->hLine(r.left, r.top, r.right - 1, BUTTON_BOTTOM);
-	_backBuffer->hLine(r.left + 1, r.bottom - 1, r.right - 1, BUTTON_TOP);
-	_backBuffer->vLine(r.left, r.top + 1, r.bottom - 1, BUTTON_BOTTOM);
-	_backBuffer->vLine(r.right - 1, r.top + 1, r.bottom - 2, BUTTON_TOP);
+	_backBuffer.fillRect(r, BUTTON_MIDDLE);
+	_backBuffer.hLine(r.left, r.top, r.right - 1, BUTTON_BOTTOM);
+	_backBuffer.hLine(r.left + 1, r.bottom - 1, r.right - 1, BUTTON_TOP);
+	_backBuffer.vLine(r.left, r.top + 1, r.bottom - 1, BUTTON_BOTTOM);
+	_backBuffer.vLine(r.right - 1, r.top + 1, r.bottom - 2, BUTTON_TOP);
 }
 
 } // End of namespace Scalpel
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index b60a931..d96310a 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -40,7 +40,7 @@ Screen *Screen::init(SherlockEngine *vm) {
 		return new Scalpel::ScalpelScreen(vm);
 }
 
-Screen::Screen(SherlockEngine *vm) : Graphics::Screen(), _vm(vm), _backBuffer(&_backBuffer1) {
+Screen::Screen(SherlockEngine *vm) : Graphics::Screen(), _vm(vm) {
 	_transitionSeed = 1;
 	_fadeStyle = false;
 	Common::fill(&_cMap[0], &_cMap[PALETTE_SIZE], 0);
@@ -54,12 +54,22 @@ Screen::Screen(SherlockEngine *vm) : Graphics::Screen(), _vm(vm), _backBuffer(&_
 	_fadeBytesRead = _fadeBytesToRead = 0;
 	_oldFadePercent = 0;
 	_flushScreen = false;
+
+	_backBuffer.create(_backBuffer1, _backBuffer1.getBounds());
 }
 
 Screen::~Screen() {
 	Fonts::freeFont();
 }
 
+void Screen::activateBackBuffer1() {
+	_backBuffer.create(_backBuffer1, _backBuffer1.getBounds());
+}
+
+void Screen::activateBackBuffer2() {
+	_backBuffer.create(_backBuffer2, _backBuffer2.getBounds());
+}
+
 int Screen::equalizePalette(const byte palette[PALETTE_SIZE]) {
 	int total = 0;
 	byte tempPalette[PALETTE_SIZE];
@@ -116,7 +126,7 @@ void Screen::randomTransition() {
 		int offset = _transitionSeed & 0xFFFF;
 
 		if (offset < (this->width() * this->height()))
-			*((byte *)getPixels() + offset) = *((const byte *)_backBuffer->getPixels() + offset);
+			*((byte *)getPixels() + offset) = *((const byte *)_backBuffer.getPixels() + offset);
 
 		if (idx != 0 && (idx % 300) == 0) {
 			// Ensure there's a full screen dirty rect for the next frame update
@@ -129,7 +139,7 @@ void Screen::randomTransition() {
 	}
 
 	// Make sure everything has been transferred
-	SHblitFrom(*_backBuffer);
+	SHblitFrom(_backBuffer);
 }
 
 void Screen::verticalTransition() {
@@ -156,7 +166,7 @@ void Screen::verticalTransition() {
 
 void Screen::restoreBackground(const Common::Rect &r) {
 	if (r.width() > 0 && r.height() > 0)
-		_backBuffer->SHblitFrom(_backBuffer2, Common::Point(r.left, r.top), r);
+		_backBuffer.SHblitFrom(_backBuffer2, Common::Point(r.left, r.top), r);
 }
 
 void Screen::slamArea(int16 xp, int16 yp, int16 width, int16 height) {
@@ -187,7 +197,7 @@ void Screen::slamRect(const Common::Rect &r) {
 		}
 
 		if (srcRect.isValidRect())
-			SHblitFrom(*_backBuffer, Common::Point(destRect.left, destRect.top), srcRect);
+			SHblitFrom(_backBuffer, Common::Point(destRect.left, destRect.top), srcRect);
 	}
 }
 
@@ -310,29 +320,26 @@ void Screen::gPrint(const Common::Point &pt, uint color, const char *formatStr,
 }
 
 void Screen::writeString(const Common::String &str, const Common::Point &pt, uint overrideColor) {
-	Fonts::writeString(_backBuffer, str, pt, overrideColor);
+	Fonts::writeString(&_backBuffer, str, pt, overrideColor);
 }
 
 void Screen::vgaBar(const Common::Rect &r, int color) {
-	_backBuffer->fillRect(r, color);
+	_backBuffer.fillRect(r, color);
 	slamRect(r);
 }
 
 void Screen::setDisplayBounds(const Common::Rect &r) {
-	_sceneSurface.create(_backBuffer1, r);
-	assert(_sceneSurface.width()  == r.width());
-	assert(_sceneSurface.height() == r.height());
-
-	_backBuffer = &_sceneSurface;
+	_backBuffer.create(_backBuffer1, r);
+	assert(_backBuffer.width()  == r.width());
+	assert(_backBuffer.height() == r.height());
 }
 
 void Screen::resetDisplayBounds() {
-	_backBuffer = &_backBuffer1;
+	_backBuffer.create(_backBuffer1, _backBuffer1.getBounds());
 }
 
 Common::Rect Screen::getDisplayBounds() {
-	return (_backBuffer == &_sceneSurface) ? Common::Rect(0, 0, _sceneSurface.width(), _sceneSurface.height()) :
-		Common::Rect(0, 0, this->width(), this->height());
+	return _backBuffer.getBounds();
 }
 
 void Screen::synchronize(Serializer &s) {
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index 50aec0a..f05a4f0 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -42,14 +42,13 @@ class SherlockEngine;
 class Screen : virtual public Graphics::Screen, virtual public Surface {
 private:
 	uint32 _transitionSeed;
-	Surface _sceneSurface;
 
 	// Rose Tattoo fields
 	int _fadeBytesRead, _fadeBytesToRead;
 	int _oldFadePercent;
 protected:
 	SherlockEngine *_vm;
-	Surface *_backBuffer;
+	Surface _backBuffer;
 
 public:
 	Surface _backBuffer1, _backBuffer2;
@@ -67,17 +66,17 @@ public:
 	/**
 	 * Obtain the currently active back buffer.
 	 */
-	Surface *getBackBuffer() const { return _backBuffer; }
+	Surface *getBackBuffer() { return &_backBuffer; }
 
 	/**
 	 * Makes first back buffer active.
 	 */
-	void activateBackBuffer1() { _backBuffer = &_backBuffer1; }
+	void activateBackBuffer1();
 
 	/**
 	 * Makes second back buffer active.
 	 */
-	void activateBackBuffer2() { _backBuffer = &_backBuffer2; }
+	void activateBackBuffer2();
 
 	/**
 	 * Fades from the currently active palette to the passed palette


Commit: c299b8ce08630d3471336cb8a5715fcffab791f8
    https://github.com/scummvm/scummvm/commit/c299b8ce08630d3471336cb8a5715fcffab791f8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-03-21T20:12:10-04:00

Commit Message:
GRAPHICS: Set parameterless Screen constructor to use screen format

Changed paths:
    graphics/screen.cpp



diff --git a/graphics/screen.cpp b/graphics/screen.cpp
index 4169c98..ccf651f 100644
--- a/graphics/screen.cpp
+++ b/graphics/screen.cpp
@@ -28,7 +28,7 @@
 namespace Graphics {
 
 Screen::Screen(): ManagedSurface() {
-	create(g_system->getWidth(), g_system->getHeight());
+	create(g_system->getWidth(), g_system->getHeight(), g_system->getScreenFormat());
 }
 
 Screen::Screen(int width, int height): ManagedSurface() {


Commit: 8fa5522819229628f9f43e542a90245380f5edf5
    https://github.com/scummvm/scummvm/commit/8fa5522819229628f9f43e542a90245380f5edf5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-03-21T20:19:55-04:00

Commit Message:
SHERLOCK: Fix crashes due to back buffer refactoring

Changed paths:
    engines/sherlock/scalpel/scalpel_screen.cpp
    engines/sherlock/tattoo/tattoo_map.cpp
    engines/sherlock/tattoo/tattoo_screen.cpp



diff --git a/engines/sherlock/scalpel/scalpel_screen.cpp b/engines/sherlock/scalpel/scalpel_screen.cpp
index ba78f48..15e8436 100644
--- a/engines/sherlock/scalpel/scalpel_screen.cpp
+++ b/engines/sherlock/scalpel/scalpel_screen.cpp
@@ -30,6 +30,7 @@ namespace Scalpel {
 ScalpelScreen::ScalpelScreen(SherlockEngine *vm) : Screen(vm) {
 	_backBuffer1.create(320, 200);
 	_backBuffer2.create(320, 200);
+	activateBackBuffer1();
 }
 
 void ScalpelScreen::makeButton(const Common::Rect &bounds, int textX,
diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp
index 0839e46..23e8bd9 100644
--- a/engines/sherlock/tattoo/tattoo_map.cpp
+++ b/engines/sherlock/tattoo/tattoo_map.cpp
@@ -106,6 +106,7 @@ int TattooMap::show() {
 	ImageFile *map = new ImageFile("map.vgs");
 	screen._backBuffer1.create(SHERLOCK_SCREEN_WIDTH * 2, SHERLOCK_SCREEN_HEIGHT * 2);
 	screen._backBuffer1.SHblitFrom((*map)[0], Common::Point(0, 0));
+	screen.activateBackBuffer1();
 	delete map;
 
 	screen.clear();
@@ -224,6 +225,7 @@ int TattooMap::show() {
 	// Reset the back buffers back to standard size
 	screen._backBuffer1.create(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
 	screen._backBuffer2.create(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);
+	screen.activateBackBuffer1();
 
 	return result;
 }
diff --git a/engines/sherlock/tattoo/tattoo_screen.cpp b/engines/sherlock/tattoo/tattoo_screen.cpp
index c98ae26..159060b 100644
--- a/engines/sherlock/tattoo/tattoo_screen.cpp
+++ b/engines/sherlock/tattoo/tattoo_screen.cpp
@@ -30,6 +30,7 @@ namespace Tattoo {
 TattooScreen::TattooScreen(SherlockEngine *vm) : Screen(vm) {
 	_backBuffer1.create(640, 480);
 	_backBuffer2.create(640, 480);
+	activateBackBuffer1();
 }
 
 } // End of namespace Tattoo


Commit: 024f79d282bd30bf11e30aee46b77669c05f60ea
    https://github.com/scummvm/scummvm/commit/024f79d282bd30bf11e30aee46b77669c05f60ea
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-03-21T20:20:47-04:00

Commit Message:
Merge branch 'sherlock-setpixels'

Changed paths:
    engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp
    engines/sherlock/scalpel/scalpel_inventory.cpp
    engines/sherlock/scalpel/scalpel_scene.cpp
    engines/sherlock/scalpel/scalpel_screen.cpp
    engines/sherlock/scalpel/scalpel_talk.cpp
    engines/sherlock/scalpel/scalpel_user_interface.cpp
    engines/sherlock/screen.cpp
    engines/sherlock/screen.h
    engines/sherlock/surface.cpp
    engines/sherlock/surface.h
    engines/sherlock/tattoo/tattoo_map.cpp
    engines/sherlock/tattoo/tattoo_screen.cpp
    graphics/screen.cpp









More information about the Scummvm-git-logs mailing list