Support nested scissor rectangles.
This commit is contained in:
@@ -38,7 +38,7 @@ namespace OpenRA.Widgets
|
||||
var chatpos = new int2(chatLogArea.X + 5, chatLogArea.Bottom - 5);
|
||||
|
||||
var font = Game.Renderer.Fonts["Regular"];
|
||||
Game.Renderer.EnableScissor(chatLogArea.Left, chatLogArea.Top, chatLogArea.Width, chatLogArea.Height);
|
||||
Game.Renderer.EnableScissor(chatLogArea);
|
||||
|
||||
foreach (var line in recentLines.AsEnumerable().Reverse())
|
||||
{
|
||||
|
||||
@@ -124,8 +124,8 @@ namespace OpenRA.Widgets
|
||||
// Scissor when the text overflows
|
||||
if (textSize.X > Bounds.Width - LeftMargin - RightMargin)
|
||||
{
|
||||
Game.Renderer.EnableScissor(pos.X + LeftMargin, pos.Y,
|
||||
Bounds.Width - LeftMargin - RightMargin, Bounds.Bottom);
|
||||
Game.Renderer.EnableScissor(new Rectangle(pos.X + LeftMargin, pos.Y,
|
||||
Bounds.Width - LeftMargin - RightMargin, Bounds.Bottom));
|
||||
}
|
||||
|
||||
var color = disabled ? DisabledColor : TextColor;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace OpenRA.Widgets
|
||||
WidgetUtils.DrawRGBA(ChromeProvider.GetImage("scrollbar", DownPressed || downDisabled ? "down_pressed" : "down_arrow"),
|
||||
new float2(downButtonRect.Left + downOffset, downButtonRect.Top + downOffset));
|
||||
|
||||
Game.Renderer.EnableScissor(backgroundRect.X + 1, backgroundRect.Y + 1, backgroundRect.Width - 2, backgroundRect.Height - 2);
|
||||
Game.Renderer.EnableScissor(backgroundRect.InflateBy(-1, -1, -1, -1));
|
||||
|
||||
foreach (var child in Children)
|
||||
child.DrawOuter();
|
||||
|
||||
@@ -216,8 +216,8 @@ namespace OpenRA.Widgets
|
||||
if (HasKeyboardFocus)
|
||||
textPos += new int2(Bounds.Width - LeftMargin - RightMargin - textSize.X, 0);
|
||||
|
||||
Game.Renderer.EnableScissor(pos.X + LeftMargin, pos.Y,
|
||||
Bounds.Width - LeftMargin - RightMargin, Bounds.Bottom);
|
||||
Game.Renderer.EnableScissor(new Rectangle(pos.X + LeftMargin, pos.Y,
|
||||
Bounds.Width - LeftMargin - RightMargin, Bounds.Bottom));
|
||||
}
|
||||
|
||||
var color = disabled ? DisabledColor : TextColor;
|
||||
|
||||
Reference in New Issue
Block a user