From 1b6411f664cfd4b0b0a884db4a8df9bae3e6ca22 Mon Sep 17 00:00:00 2001 From: Someone Somewhere Date: Thu, 3 Oct 2024 19:50:17 +0100 Subject: [PATCH] Fix incorrect clipping due to stale viewport dimensions (#680) --- 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)