[Scummvm-git-logs] scummvm master -> a395700d1f51663eb7afc2269765cfdb908a4aaa

aquadran noreply at scummvm.org
Thu Dec 9 11:38:51 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:
a395700d1f TINYGL: Put debug dirty rects code into runtime condition


Commit: a395700d1f51663eb7afc2269765cfdb908a4aaa
    https://github.com/scummvm/scummvm/commit/a395700d1f51663eb7afc2269765cfdb908a4aaa
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-12-09T12:38:41+01:00

Commit Message:
TINYGL: Put debug dirty rects code into runtime condition

Changed paths:
    graphics/tinygl/init.cpp
    graphics/tinygl/zdirtyrect.cpp
    graphics/tinygl/zgl.h


diff --git a/graphics/tinygl/init.cpp b/graphics/tinygl/init.cpp
index fcf5c8d251..5a92844634 100644
--- a/graphics/tinygl/init.cpp
+++ b/graphics/tinygl/init.cpp
@@ -238,6 +238,7 @@ void GLContext::init(int screenW, int screenH, Graphics::PixelFormat pixelFormat
 	_drawCallAllocator[0].initialize(kDrawCallMemory);
 	_drawCallAllocator[1].initialize(kDrawCallMemory);
 	_enableDirtyRectangles = true;
+	_debugRectsEnabled = false;
 
 	TinyGL::Internal::tglBlitResetScissorRect();
 }
diff --git a/graphics/tinygl/zdirtyrect.cpp b/graphics/tinygl/zdirtyrect.cpp
index 548450296b..b22f7814ca 100644
--- a/graphics/tinygl/zdirtyrect.cpp
+++ b/graphics/tinygl/zdirtyrect.cpp
@@ -35,7 +35,6 @@ void GLContext::issueDrawCall(DrawCall *drawCall) {
 	_drawCallsQueue.push_back(drawCall);
 }
 
-#if TGL_DIRTY_RECT_SHOW
 static void debugDrawRectangle(Common::Rect rect, int r, int g, int b) {
 	GLContext *c = gl_get_context();
 	int fbWidth = c->fb->getPixelBufferWidth();
@@ -58,7 +57,6 @@ static void debugDrawRectangle(Common::Rect rect, int r, int g, int b) {
 		c->fb->writePixel(y * fbWidth + rect.right - 1, 255, r, g, b);
 	}
 }
-#endif
 
 struct DirtyRectangle {
 	Common::Rect rectangle;
@@ -92,7 +90,7 @@ void GLContext::disposeResources() {
 
 	} while (allDisposed == false);
 
-	TinyGL::Internal::tglCleanupImages();
+	Internal::tglCleanupImages();
 }
 
 void GLContext::disposeDrawCallLists() {
@@ -198,22 +196,23 @@ void GLContext::presentBufferDirtyRects() {
 				}
 			}
 		}
-#if TGL_DIRTY_RECT_SHOW
-		// Draw debug rectangles.
-		// Note: white rectangles are rectangle that contained other rectangles
-		// blue rectangles are rectangle merged from other rectangles
-		// red rectangles are original dirty rects
 
-		fb->enableBlending(false);
-		fb->enableAlphaTest(false);
+		if (_debugRectsEnabled) {
+			// Draw debug rectangles.
+			// Note: white rectangles are rectangle that contained other rectangles
+			// blue rectangles are rectangle merged from other rectangles
+			// red rectangles are original dirty rects
 
-		for (RectangleIterator it = rectangles.begin(); it != rectangles.end(); ++it) {
-			debugDrawRectangle((*it).rectangle, (*it).r, (*it).g, (*it).b);
-		}
+			fb->enableBlending(false);
+			fb->enableAlphaTest(false);
+
+			for (RectangleIterator it = rectangles.begin(); it != rectangles.end(); ++it) {
+				debugDrawRectangle((*it).rectangle, (*it).r, (*it).g, (*it).b);
+			}
 
-		fb->enableBlending(blending_enabled);
-		fb->enableAlphaTest(alpha_test_enabled);
-#endif
+			fb->enableBlending(blending_enabled);
+			fb->enableAlphaTest(alpha_test_enabled);
+		}
 	}
 
 	// Dispose not necessary draw calls.
diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h
index 2fa60c502e..78cd9aa8f6 100644
--- a/graphics/tinygl/zgl.h
+++ b/graphics/tinygl/zgl.h
@@ -428,6 +428,7 @@ struct GLContext {
 	Common::List<DrawCall *> _previousFrameDrawCallsQueue;
 	int _currentAllocatorIndex;
 	LinearAllocator _drawCallAllocator[2];
+	bool _debugRectsEnabled;
 
 public:
 	// The glob* functions exposed to public, however they are only for internal use.




More information about the Scummvm-git-logs mailing list