From bcfdd79f2a523047af1fe2995a48d369a159a24f Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 6 Dec 2019 21:56:34 -0600 Subject: [PATCH] IControlRenderer - simplify api --- .../CustomControls/ControlRenderer/GdiPlusRenderer.cs | 2 +- .../CustomControls/ControlRenderer/IControlRenderer.cs | 2 +- .../CustomControls/InputRoll/InputRoll.Drawing.cs | 2 +- BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GdiPlusRenderer.cs b/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GdiPlusRenderer.cs index 3f3627786d..401b9805c4 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GdiPlusRenderer.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GdiPlusRenderer.cs @@ -70,7 +70,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls _graphics.DrawLine(_currentPen, x1, y1, x2, y2); } - public IDisposable LockGraphics(Graphics g, int width, int height) + public IDisposable LockGraphics(Graphics g) { _graphics = g; return new GdiPlusGraphicsLock(); diff --git a/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/IControlRenderer.cs b/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/IControlRenderer.cs index f456661347..fb78f4f6e3 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/IControlRenderer.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/IControlRenderer.cs @@ -8,7 +8,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls /// /// Required to use before calling drawing methods /// - IDisposable LockGraphics(Graphics g, int width, int height); + IDisposable LockGraphics(Graphics g); /// /// Measure the width and height of string when drawn diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs index d66a280372..7abd4ace37 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs @@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk { protected override void OnPaint(PaintEventArgs e) { - using (_renderer.LockGraphics(e.Graphics, Width, Height)) + using (_renderer.LockGraphics(e.Graphics)) { // White Background _renderer.SetBrush(Color.White); diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs index 3b672cb088..33e1072b50 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs @@ -132,7 +132,7 @@ namespace BizHawk.Client.EmuHawk if (column != null) { using var g = CreateGraphics(); - using (_renderer.LockGraphics(g, Width, Height)) + using (_renderer.LockGraphics(g)) { var strLength = (int)_renderer.MeasureString(text, Font).Width + (CellWidthPadding * 2); if (column.Width < strLength) @@ -1951,7 +1951,7 @@ namespace BizHawk.Client.EmuHawk private void UpdateCellSize() { using (var g = CreateGraphics()) - using (_renderer.LockGraphics(g, Width, Height)) + using (_renderer.LockGraphics(g)) { // Measure width change to ignore extra padding at start/end var size1 = _renderer.MeasureString("A", Font);