Remove uses of state-mutating Rectangle.Offset and Intersect.
This commit is contained in:
@@ -214,7 +214,7 @@ namespace OpenRA
|
||||
{
|
||||
// Must remain inside the current scissor rect
|
||||
if (scissorState.Any())
|
||||
rect.Intersect(scissorState.Peek());
|
||||
rect = Rectangle.Intersect(rect, scissorState.Peek());
|
||||
|
||||
Flush();
|
||||
Context.EnableScissor(rect.Left, rect.Top, rect.Width, rect.Height);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
using System;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
@@ -212,10 +213,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
// Hide the logo and center just the text
|
||||
if (title != null)
|
||||
title.Bounds.Offset(logo.Bounds.Left - title.Bounds.Left, 0);
|
||||
title.Bounds.X = logo.Bounds.Left;
|
||||
|
||||
if (version != null)
|
||||
version.Bounds.Offset(logo.Bounds.Left - version.Bounds.Left, 0);
|
||||
version.Bounds.X = logo.Bounds.X;
|
||||
|
||||
width -= logo.Bounds.Width;
|
||||
}
|
||||
@@ -228,7 +229,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var container = panel.GetOrNull("MOD_CONTAINER");
|
||||
if (container != null)
|
||||
{
|
||||
container.Bounds.Offset((container.Bounds.Width - width) / 2, 0);
|
||||
container.Bounds.X += (container.Bounds.Width - width) / 2;
|
||||
container.Bounds.Width = width;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user