Skip to content

Commit

Permalink
Fix some more off by ones with imgui 2D renderer
Browse files Browse the repository at this point in the history
thanks GDI+
  • Loading branch information
CasualPokePlayer committed Jun 2, 2024
1 parent 1f41f5f commit 1d5a9e5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/BizHawk.Client.Common/Api/Classes/GuiApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ public void DrawEllipse(int x, int y, int width, int height, Color? line = null,
{
var r = Get2DRenderer(surfaceID);
var bg = background ?? _defaultBackground;
// GDI+ had an off by one here, we increment width and height to preserve backwards compatibility
width++; height++;
if (bg != null) r.FillEllipse(bg.Value, x, y, width, height);
r.CompositingMode = _compositingMode;
r.DrawEllipse(line ?? _defaultForeground, x, y, width, height);
Expand Down Expand Up @@ -333,6 +335,8 @@ public void DrawPie(int x, int y, int width, int height, int startangle, int swe
var r = Get2DRenderer(surfaceID);
r.CompositingMode = _compositingMode;
var bg = background ?? _defaultBackground;
// GDI+ had an off by one here, we increment width and height to preserve backwards compatibility
width++; height++;
if (bg != null) r.FillPie(bg.Value, x, y, width, height, startangle, sweepangle);
r.DrawPie(line ?? _defaultForeground, x + 1, y + 1, width - 1, height - 1, startangle, sweepangle);
}
Expand Down

0 comments on commit 1d5a9e5

Please sign in to comment.