1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 12:58:33 +01:00

fixed the panel updating its render target too often

This commit is contained in:
Ellpeck 2019-11-05 13:42:39 +01:00
parent f28e234392
commit f1c9ba5517

View file

@ -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);
}
}
}