From f1c9ba551766bf4e7fc5b6f7349568f0791e0e8a Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 5 Nov 2019 13:42:39 +0100 Subject: [PATCH] fixed the panel updating its render target too often --- MLEM.Ui/Elements/Panel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs index 137a37c..48cb0c4 100644 --- a/MLEM.Ui/Elements/Panel.cs +++ b/MLEM.Ui/Elements/Panel.cs @@ -79,11 +79,11 @@ namespace MLEM.Ui.Elements { this.ScrollBar.MaxValue = (childrenHeight - this.Area.Height) / this.Scale + this.ChildPadding.Y * 2; // update the render target - var targetArea = this.GetRenderTargetArea(); + var targetArea = (Rectangle) this.GetRenderTargetArea(); if (this.renderTarget == null || targetArea.Width != this.renderTarget.Width || targetArea.Height != this.renderTarget.Height) { if (this.renderTarget != null) this.renderTarget.Dispose(); - this.renderTarget = targetArea.IsEmpty ? null : new RenderTarget2D(this.System.GraphicsDevice, targetArea.Width.Ceil(), targetArea.Height.Ceil()); + this.renderTarget = targetArea.IsEmpty ? null : new RenderTarget2D(this.System.GraphicsDevice, targetArea.Width, targetArea.Height); } } }