From 1441d9b2f16ae56d5012c60581830e8131ee373e Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 11 Apr 2010 15:18:43 +1200 Subject: [PATCH] Fix tooltip batches --- OpenRA.Game/Widgets/WidgetUtils.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/OpenRA.Game/Widgets/WidgetUtils.cs b/OpenRA.Game/Widgets/WidgetUtils.cs index 09e6606762..da2c745970 100644 --- a/OpenRA.Game/Widgets/WidgetUtils.cs +++ b/OpenRA.Game/Widgets/WidgetUtils.cs @@ -93,13 +93,18 @@ namespace OpenRA.Widgets public static void FillRectWithSprite(Rectangle r, Sprite s) { - Game.chrome.renderer.Device.EnableScissor(r.Left, r.Top, r.Width, r.Height); for (var x = r.Left; x < r.Right; x += (int)s.size.X) for (var y = r.Top; y < r.Bottom; y += (int)s.size.Y) - DrawRGBA(s, new float2(x, y)); - - Game.chrome.rgbaRenderer.Flush(); - Game.chrome.renderer.Device.DisableScissor(); + { + var ss = s; + var left = new int2(r.Right - x, r.Bottom - y); + if (left.X < (int)s.size.X || left.Y < (int)s.size.Y) + { + Rectangle rr = new Rectangle(s.bounds.Left,s.bounds.Top,Math.Min(left.X,(int)s.size.X),Math.Min(left.Y,(int)s.size.Y)); + ss = new Sprite(s.sheet,rr,s.channel); + } + DrawRGBA(ss, new float2(x, y)); + } } public static void DrawRightTooltip(string collection, int2 tl, int2 m, int2 br, Action a)