[Scummvm-git-logs] scummvm master -> 8e4697946e4bb1cbb42897f9b052ec040be5dd06

bgK bastien.bouclet at gmail.com
Sat Aug 5 08:38:41 CEST 2017


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

Summary:
cd6a4423ef MOHAWK: Myst: Display every second fireplace button animation frame
d6de8e52c3 MOHAWK: Myst: Set the clicked resource only if the active resource was updated
8e4697946e OPENGL: Always clear the whole backbuffer


Commit: cd6a4423ef9b8fd04de977c757ce801b6565306e
    https://github.com/scummvm/scummvm/commit/cd6a4423ef9b8fd04de977c757ce801b6565306e
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-08-05T08:36:32+02:00

Commit Message:
MOHAWK: Myst: Display every second fireplace button animation frame

The animation is too slow when displaying each frame at 60 fps.

Fixes #10053

Changed paths:
    engines/mohawk/myst_stacks/myst.cpp


diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index e72d4e5..3ef0a99 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -844,16 +844,19 @@ void Myst::o_fireplaceToggleButton(uint16 var, const ArgumentsArray &args) {
 	uint16 bitmask = args[0];
 	uint16 line = _fireplaceLines[var - 17];
 
+	// The animations are too slow when playing each animation image at 60fps.
+	// Only play every second image.
+
 	if (line & bitmask) {
 		// Unset button
-		for (uint i = 4795; i >= 4779; i--) {
+		for (uint i = 4795; i >= 4779; i -= 2) {
 			_vm->_gfx->copyImageToScreen(i, getInvokingResource<MystArea>()->getRect());
 			_vm->doFrame();
 		}
 		_fireplaceLines[var - 17] &= ~bitmask;
 	} else {
 		// Set button
-		for (uint i = 4779; i <= 4795; i++) {
+		for (uint i = 4779; i <= 4795; i += 2) {
 			_vm->_gfx->copyImageToScreen(i, getInvokingResource<MystArea>()->getRect());
 			_vm->doFrame();
 		}


Commit: d6de8e52c3e6b8d53608e08eb3dec31a4dd6b172
    https://github.com/scummvm/scummvm/commit/d6de8e52c3e6b8d53608e08eb3dec31a4dd6b172
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-08-05T08:36:32+02:00

Commit Message:
MOHAWK: Myst: Set the clicked resource only if the active resource was updated

Fixes #10053.

Changed paths:
    engines/mohawk/myst.cpp


diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index bd4af66..505d284 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -734,15 +734,11 @@ void MohawkEngine_Myst::checkCurrentResource() {
 			_clickedResource->handleMouseUp();
 		}
 		_clickedResource = nullptr;
-	}
-
-	if (_mouseMoved && _clickedResource) {
+	} else if (_mouseMoved && _clickedResource) {
 		if (_clickedResource->isEnabled()) {
 			_clickedResource->handleMouseDrag();
 		}
-	}
-
-	if (_mouseClicked && !_clickedResource) {
+	} else if (_mouseClicked && !_clickedResource) {
 		if (_activeResource && _activeResource->isEnabled()) {
 			_clickedResource = _activeResource;
 			_clickedResource->handleMouseDown();


Commit: 8e4697946e4bb1cbb42897f9b052ec040be5dd06
    https://github.com/scummvm/scummvm/commit/8e4697946e4bb1cbb42897f9b052ec040be5dd06
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-08-05T08:36:32+02:00

Commit Message:
OPENGL: Always clear the whole backbuffer

Previously we were clearing the whole backbuffer for 3 frames after a
window size change, and then only clearing the game area. This assumes
the OpenGL driver uses at most 3 render buffer and uses them in
sequential order. This does not seem to be the case on Linux when using
an Intel integrated GPU.
Instead we now clear the whole backbuffer on each frame to make sure
there are no leftovers remaining on the screen. All semi-recent GPUs
should have hardware clear anyway so this should not impact negatively
performance.

Possibly fixes #10025.

Changed paths:
    backends/graphics/opengl/opengl-graphics.cpp
    backends/graphics/opengl/opengl-graphics.h


diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index fc27270..28ca110 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -60,7 +60,7 @@ OpenGLGraphicsManager::OpenGLGraphicsManager()
       _cursorX(0), _cursorY(0), _cursorDisplayX(0),_cursorDisplayY(0), _cursorHotspotX(0), _cursorHotspotY(0),
       _cursorHotspotXScaled(0), _cursorHotspotYScaled(0), _cursorWidthScaled(0), _cursorHeightScaled(0),
       _cursorKeyColor(0), _cursorVisible(false), _cursorDontScale(false), _cursorPaletteEnabled(false),
-      _forceRedraw(false), _scissorOverride(3)
+      _forceRedraw(false)
 #ifdef USE_OSD
       , _osdMessageChangeRequest(false), _osdMessageAlpha(0), _osdMessageFadeStartTime(0), _osdMessageSurface(nullptr),
       _osdIconSurface(nullptr)
@@ -381,10 +381,8 @@ void OpenGLGraphicsManager::updateScreen() {
 	}
 
 #ifdef USE_OSD
-	{
-		if (_osdMessageChangeRequest) {
-			osdMessageUpdateSurface();
-		}
+	if (_osdMessageChangeRequest) {
+		osdMessageUpdateSurface();
 	}
 
 	if (_osdIconSurface) {
@@ -413,18 +411,13 @@ void OpenGLGraphicsManager::updateScreen() {
 	_overlay->updateGLTexture();
 
 	// Clear the screen buffer.
-	if (_scissorOverride && !_overlayVisible) {
-		// In certain cases we need to assure that the whole screen area is
-		// cleared. For example, when switching from overlay visible to
-		// invisible, we need to assure that all contents are cleared to
-		// properly remove all overlay contents.
-		_backBuffer.enableScissorTest(false);
-		GL_CALL(glClear(GL_COLOR_BUFFER_BIT));
-		_backBuffer.enableScissorTest(true);
+	GL_CALL(glClear(GL_COLOR_BUFFER_BIT));
 
-		--_scissorOverride;
-	} else {
-		GL_CALL(glClear(GL_COLOR_BUFFER_BIT));
+	if (!_overlayVisible) {
+		// The scissor test is enabled to:
+		// - Clip the cursor to the game screen
+		// - Clip the game screen when the shake offset is non-zero
+		_backBuffer.enableScissorTest(true);
 	}
 
 	const GLfloat shakeOffset = _gameScreenShakeOffset * (GLfloat)_displayHeight / _gameScreen->getHeight();
@@ -449,6 +442,10 @@ void OpenGLGraphicsManager::updateScreen() {
 		                         _cursorWidthScaled, _cursorHeightScaled);
 	}
 
+	if (!_overlayVisible) {
+		_backBuffer.enableScissorTest(false);
+	}
+
 #ifdef USE_OSD
 	// Fourth step: Draw the OSD.
 	if (_osdMessageSurface) {
@@ -530,9 +527,6 @@ void OpenGLGraphicsManager::showOverlay() {
 	_overlayVisible = true;
 	_forceRedraw = true;
 
-	// Allow drawing inside full screen area.
-	_backBuffer.enableScissorTest(false);
-
 	// Update cursor position.
 	setMousePosition(_cursorX, _cursorY);
 }
@@ -541,10 +535,6 @@ void OpenGLGraphicsManager::hideOverlay() {
 	_overlayVisible = false;
 	_forceRedraw = true;
 
-	// Limit drawing to screen area.
-	_backBuffer.enableScissorTest(true);
-	_scissorOverride = 3;
-
 	// Update cursor position.
 	setMousePosition(_cursorX, _cursorY);
 }
@@ -961,15 +951,9 @@ void OpenGLGraphicsManager::notifyContextCreate(const Graphics::PixelFormat &def
 	_backBuffer.setClearColor(0.0f, 0.0f, 0.0f, 0.0f);
 	// Setup alpha blend (for overlay and cursor).
 	_backBuffer.enableBlend(true);
-	// Setup scissor state accordingly.
-	_backBuffer.enableScissorTest(!_overlayVisible);
 
 	g_context.getActivePipeline()->setFramebuffer(&_backBuffer);
 
-	// Clear the whole screen for the first three frames to assure any
-	// leftovers are cleared.
-	_scissorOverride = 3;
-
 	// We use a "pack" alignment (when reading from textures) to 4 here,
 	// since the only place where we really use it is the BMP screenshot
 	// code and that requires the same alignment too.
@@ -1246,14 +1230,12 @@ void OpenGLGraphicsManager::recalculateDisplayArea() {
 	_displayY = (_outputScreenHeight - _displayHeight) / 2;
 
 	// Setup drawing limitation for game graphics.
-	// This invovles some trickery because OpenGL's viewport coordinate system
+	// This involves some trickery because OpenGL's viewport coordinate system
 	// is upside down compared to ours.
 	_backBuffer.setScissorBox(_displayX,
 	                          _outputScreenHeight - _displayHeight - _displayY,
 	                          _displayWidth,
 	                          _displayHeight);
-	// Clear the whole screen for the first three frames to remove leftovers.
-	_scissorOverride = 3;
 
 	// Update the cursor position to adjust for new display area.
 	setMousePosition(_cursorX, _cursorY);
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index f5f4cab..e02137b 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -533,11 +533,6 @@ private:
 	 */
 	bool _forceRedraw;
 
-	/**
-	 * Number of frames glClear shall ignore scissor testing.
-	 */
-	uint _scissorOverride;
-
 #ifdef USE_OSD
 	//
 	// OSD





More information about the Scummvm-git-logs mailing list