IControlRenderer - simplify api

This commit is contained in:
adelikat 2019-12-06 21:56:34 -06:00
parent 21a0b65305
commit bcfdd79f2a
4 changed files with 5 additions and 5 deletions

View File

@ -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();

View File

@ -8,7 +8,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
/// <summary>
/// Required to use before calling drawing methods
/// </summary>
IDisposable LockGraphics(Graphics g, int width, int height);
IDisposable LockGraphics(Graphics g);
/// <summary>
/// Measure the width and height of string <paramref name="str"/> when drawn

View File

@ -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);

View File

@ -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);