IControlRenderer - Simplify API

This commit is contained in:
adelikat 2019-12-02 19:48:57 -06:00
parent cb9b28514c
commit 230cc676c3
3 changed files with 5 additions and 8 deletions

View File

@ -40,11 +40,9 @@ namespace BizHawk.Client.EmuHawk.CustomControls
_graphics.DrawImage(bitmap, point);
}
public void DrawRectangle(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
public void DrawRectangle(Rectangle rect)
{
_graphics.DrawRectangle(
_currentPen,
new Rectangle(nLeftRect, nTopRect, nRightRect - nLeftRect, nBottomRect - nTopRect));
_graphics.DrawRectangle(_currentPen, rect);
}
public void DrawString(string str, Rectangle rect)

View File

@ -27,7 +27,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
/// </summary>
void DrawString(string str, Rectangle rect);
void DrawRectangle(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
void DrawRectangle(Rectangle rect);
void FillRectangle(int x, int y, int w, int h);
/// <summary>

View File

@ -105,10 +105,9 @@ namespace BizHawk.Client.EmuHawk
columnWidth = ColumnWidth;
columnHeight = GetHColHeight(columnIndex);
}
int x1 = _currentX.Value - (columnWidth / 2);
int y1 = _currentY.Value - (columnHeight / 2);
int x2 = x1 + columnWidth;
int y2 = y1 + columnHeight;
int textOffsetY = CellHeightPadding;
if (HorizontalOrientation)
{
@ -117,7 +116,7 @@ namespace BizHawk.Client.EmuHawk
}
_renderer.SetSolidPen(_backColor);
_renderer.DrawRectangle(x1, y1, x2, y2);
_renderer.DrawRectangle(new Rectangle(x1, y1, columnWidth, columnHeight));
_renderer.PrepDrawString(Font, _foreColor);
_renderer.DrawString(_columnDown.Text, new Rectangle(x1 + CellWidthPadding, y1 + textOffsetY, columnWidth, columnHeight));
}