From 9ab8458121e4f87be319671742293db40b660201 Mon Sep 17 00:00:00 2001 From: Someone Somewhere Date: Thu, 3 Oct 2024 10:20:03 +0100 Subject: [PATCH] Fix incorrect clipping due to stale viewport dimensions --- Include/RmlUi/Core/RenderManager.h | 2 +- Source/Core/Context.cpp | 2 +- Source/Core/RenderManager.cpp | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Include/RmlUi/Core/RenderManager.h b/Include/RmlUi/Core/RenderManager.h index 374e0f134..a03caa311 100644 --- a/Include/RmlUi/Core/RenderManager.h +++ b/Include/RmlUi/Core/RenderManager.h @@ -76,7 +76,7 @@ class RMLUICORE_API RenderManager : NonCopyMoveable { RenderManager(RenderInterface* render_interface); ~RenderManager(); - void PrepareRender(); + void PrepareRender(Vector2i dimensions); void SetViewport(Vector2i dimensions); Vector2i GetViewport() const; diff --git a/Source/Core/Context.cpp b/Source/Core/Context.cpp index d742ba0c0..7706da6ee 100644 --- a/Source/Core/Context.cpp +++ b/Source/Core/Context.cpp @@ -216,7 +216,7 @@ bool Context::Render() { RMLUI_ZoneScoped; - render_manager->PrepareRender(); + render_manager->PrepareRender(dimensions); root->Render(); diff --git a/Source/Core/RenderManager.cpp b/Source/Core/RenderManager.cpp index 6da9a6fea..a5d889db2 100644 --- a/Source/Core/RenderManager.cpp +++ b/Source/Core/RenderManager.cpp @@ -68,7 +68,7 @@ RenderManager::~RenderManager() ReleaseAllTextures(); } -void RenderManager::PrepareRender() +void RenderManager::PrepareRender(Vector2i dimensions) { #ifdef RMLUI_DEBUG const RenderState default_state; @@ -77,6 +77,8 @@ void RenderManager::PrepareRender() RMLUI_ASSERT(state.transform == default_state.transform); RMLUI_ASSERTMSG(render_stack.empty(), "Unbalanced render stack detected, ensure every PushLayer call has a corresponding call to PopLayer."); #endif + + SetViewport(dimensions); } void RenderManager::SetViewport(Vector2i dimensions)