[Scummvm-git-logs] scummvm master -> 98da66b735b2d1c597d081606ead511c08fbd0fd

aquadran noreply at scummvm.org
Sun Dec 5 19:28:52 UTC 2021


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

Summary:
98da66b735 MYST3: Fix the viewport used by the TinyGL renderer for 2D drawing


Commit: 98da66b735b2d1c597d081606ead511c08fbd0fd
    https://github.com/scummvm/scummvm/commit/98da66b735b2d1c597d081606ead511c08fbd0fd
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2021-12-05T20:28:49+01:00

Commit Message:
MYST3: Fix the viewport used by the TinyGL renderer for 2D drawing

Changed paths:
    engines/myst3/gfx_tinygl.cpp
    engines/myst3/gfx_tinygl.h


diff --git a/engines/myst3/gfx_tinygl.cpp b/engines/myst3/gfx_tinygl.cpp
index c50479dfc4..aef87aebc3 100644
--- a/engines/myst3/gfx_tinygl.cpp
+++ b/engines/myst3/gfx_tinygl.cpp
@@ -87,17 +87,16 @@ void TinyGLRenderer::selectTargetWindow(Window *window, bool is3D, bool scaled)
 		// No window found ...
 		if (scaled) {
 			// ... in scaled mode draw in the original game screen area
-			Common::Rect vp = viewport();
-			tglViewport(vp.left, _system->getHeight() - vp.top - vp.height(), vp.width(), vp.height());
+			_viewport = viewport();
 		} else {
 			// ... otherwise, draw on the whole screen
-			tglViewport(0, 0, _system->getWidth(), _system->getHeight());
+			_viewport = Common::Rect(_system->getWidth(), _system->getHeight());
 		}
 	} else {
 		// Found a window, draw inside it
-		Common::Rect vp = window->getPosition();
-		tglViewport(vp.left, _system->getHeight() - vp.top - vp.height(), vp.width(), vp.height());
+		_viewport = window->getPosition();
 	}
+	tglViewport(_viewport.left, _system->getHeight() - _viewport.top - _viewport.height(), _viewport.width(), _viewport.height());
 
 	if (is3D) {
 		tglMatrixMode(TGL_PROJECTION);
@@ -169,14 +168,11 @@ void TinyGLRenderer::drawTexturedRect2D(const Common::Rect &screenRect, const Co
 		transparency = 1.0;
 	}
 
-	// HACK: tglBlit is not affected by the viewport, so we offset the draw coordinates here
-	int viewPort[4];
-	tglGetIntegerv(TGL_VIEWPORT, viewPort);
-
 	tglEnable(TGL_TEXTURE_2D);
 	tglDepthMask(TGL_FALSE);
 
-	Graphics::BlitTransform transform(sLeft + viewPort[0], sTop + viewPort[1]);
+	// HACK: tglBlit is not affected by the viewport, so we offset the draw coordinates here
+	Graphics::BlitTransform transform(sLeft + _viewport.left, sTop + _viewport.top);
 	transform.sourceRectangle(textureRect.left, textureRect.top, sWidth, sHeight);
 	transform.tint(transparency);
 	tglBlit(glTexture->getBlitTexture(), transform);
diff --git a/engines/myst3/gfx_tinygl.h b/engines/myst3/gfx_tinygl.h
index 9caceb26e9..da6fc4f7da 100644
--- a/engines/myst3/gfx_tinygl.h
+++ b/engines/myst3/gfx_tinygl.h
@@ -62,6 +62,7 @@ private:
 	void drawFace(uint face, Texture *texture);
 
 	TinyGL::FrameBuffer *_fb;
+	Common::Rect _viewport;
 };
 
 } // End of namespace Myst3




More information about the Scummvm-git-logs mailing list