[Scummvm-git-logs] scummvm master -> 16fb34f4792e078edeb06bd4c6212a1c4ffea63c

lephilousophe noreply at scummvm.org
Thu Jan 16 12:41:20 UTC 2025


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:
16fb34f479 FREESCAPE: Refactor TinyGL's clear method


Commit: 16fb34f4792e078edeb06bd4c6212a1c4ffea63c
    https://github.com/scummvm/scummvm/commit/16fb34f4792e078edeb06bd4c6212a1c4ffea63c
Author: cmd05 (splendid.snippet670 at slmail.me)
Date: 2025-01-16T13:41:16+01:00

Commit Message:
FREESCAPE: Refactor TinyGL's clear method

Instead of resizing the viewport and drawing a quad, directly draw a viewport sized quad.

Changed paths:
    engines/freescape/gfx_tinygl.cpp


diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index bf224e7d76e..c78a0284778 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -538,15 +538,14 @@ void TinyGLRenderer::clear(uint8 r, uint8 g, uint8 b, bool ignoreViewport) {
 		tglClearColor(r / 255., g / 255., b / 255., 1.0);
 		tglClear(TGL_COLOR_BUFFER_BIT);
 	} else {
-		// Disable viewport
-		tglViewport(0, 0, g_system->getWidth(), g_system->getHeight());
+		// Create a viewport sized quad and color it
 		useColor(r, g, b);
 
 		tglMatrixMode(TGL_PROJECTION);
 		tglPushMatrix();
 		tglLoadIdentity();
 
-		tglOrtho(0, _screenW, _screenH, 0, 0, 1);
+		tglOrtho(0, _viewport.width(), _viewport.height(), 0, 0, 1);
 		tglMatrixMode(TGL_MODELVIEW);
 		tglPushMatrix();
 		tglLoadIdentity();
@@ -555,13 +554,13 @@ void TinyGLRenderer::clear(uint8 r, uint8 g, uint8 b, bool ignoreViewport) {
 		tglDepthMask(TGL_FALSE);
 
 		tglEnableClientState(TGL_VERTEX_ARRAY);
-		copyToVertexArray(0, Math::Vector3d(_viewport.left, _viewport.top, 0));
-		copyToVertexArray(1, Math::Vector3d(_viewport.left, _viewport.bottom, 0));
-		copyToVertexArray(2, Math::Vector3d(_viewport.right, _viewport.bottom, 0));
+		copyToVertexArray(0, Math::Vector3d(0, 0, 0));
+		copyToVertexArray(1, Math::Vector3d(0, _viewport.height(), 0));
+		copyToVertexArray(2, Math::Vector3d(_viewport.width(), _viewport.height(), 0));
 
-		copyToVertexArray(3, Math::Vector3d(_viewport.left, _viewport.top, 0));
-		copyToVertexArray(4, Math::Vector3d(_viewport.right, _viewport.top, 0));
-		copyToVertexArray(5, Math::Vector3d(_viewport.right, _viewport.bottom, 0));
+		copyToVertexArray(3, Math::Vector3d(0, 0, 0));
+		copyToVertexArray(4, Math::Vector3d(_viewport.width(), 0, 0));
+		copyToVertexArray(5, Math::Vector3d(_viewport.width(), _viewport.height(), 0));
 
 		tglVertexPointer(3, TGL_FLOAT, 0, _verts);
 		tglDrawArrays(TGL_TRIANGLES, 0, 6);
@@ -573,9 +572,6 @@ void TinyGLRenderer::clear(uint8 r, uint8 g, uint8 b, bool ignoreViewport) {
 		tglPopMatrix();
 		tglMatrixMode(TGL_PROJECTION);
 		tglPopMatrix();
-
-		// Restore viewport
-		tglViewport(_viewport.left, g_system->getHeight() - _viewport.bottom, _viewport.width(), _viewport.height());
 	}
 }
 




More information about the Scummvm-git-logs mailing list