Remove uses of state-mutating Rectangle.Offset and Intersect.

This commit is contained in:
Paul Chote
2018-12-30 16:24:11 +00:00
parent 0b641c20df
commit 015316e909
3 changed files with 10 additions and 5 deletions

View File

@@ -178,7 +178,11 @@ namespace OpenRA.Mods.Common.Widgets
var drawBounds = backgroundRect.InflateBy(-BorderWidth, -BorderWidth, -BorderWidth, -BorderWidth);
Game.Renderer.EnableScissor(drawBounds);
drawBounds.Offset(-ChildOrigin);
// ChildOrigin enumerates the widget tree, so only evaluate it once
var co = ChildOrigin;
drawBounds.X -= co.X;
drawBounds.Y -= co.Y;
foreach (var child in Children)
if (child.Bounds.IntersectsWith(drawBounds))
child.DrawOuter();