diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs index c1fef9f6ae..a62197ce3a 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs @@ -459,7 +459,7 @@ namespace BizHawk.Client.EmuHawk { if (QueryItemBkColor != null) { - DoBackGroundCallback(visibleColumns, firstVisibleRow, lastVisibleRow); + DoBackGroundCallback(visibleColumns, rect, firstVisibleRow, lastVisibleRow); } if (GridLines) @@ -510,11 +510,11 @@ namespace BizHawk.Client.EmuHawk if (_selectedItems.Any()) { - DoSelectionBG(visibleColumns); + DoSelectionBG(visibleColumns, rect); } } - private void DoSelectionBG(List visibleColumns) + private void DoSelectionBG(List visibleColumns, Rectangle rect) { Color rowColor = Color.White; int firstVisibleRow = FirstVisibleRow; @@ -557,12 +557,12 @@ namespace BizHawk.Client.EmuHawk cellColor = Color.FromArgb(cellColor.R - (int)((cellColor.R - SystemColors.Highlight.R) * alpha), cellColor.G - (int)((cellColor.G - SystemColors.Highlight.G) * alpha), cellColor.B - (int)((cellColor.B - SystemColors.Highlight.B) * alpha)); - DrawCellBG(cellColor, relativeCell, visibleColumns); + DrawCellBG(cellColor, relativeCell, visibleColumns, rect); } } // Given a cell with RowIndex in between 0 and VisibleRows, it draws the background color specified. Do not call with absolute row indices. - private void DrawCellBG(Color color, Cell cell, List visibleColumns) + private void DrawCellBG(Color color, Cell cell, List visibleColumns, Rectangle rect) { int x, y, w, h; @@ -592,18 +592,12 @@ namespace BizHawk.Client.EmuHawk h = CellHeight - 1; } - // Don't draw if off screen. - if (x > _drawWidth || y > _drawHeight) - { - return; - } - _renderer.SetBrush(color); _renderer.FillRectangle(new Rectangle(x, y, w, h)); } // Calls QueryItemBkColor callback for all visible cells and fills in the background of those cells. - private void DoBackGroundCallback(List visibleColumns, int firstVisibleRow, int lastVisibleRow) + private void DoBackGroundCallback(List visibleColumns, Rectangle rect, int firstVisibleRow, int lastVisibleRow) { if (!visibleColumns.Any()) { @@ -643,7 +637,7 @@ namespace BizHawk.Client.EmuHawk Column = column, RowIndex = i }; - DrawCellBG(itemColor, cell, visibleColumns); + DrawCellBG(itemColor, cell, visibleColumns, rect); } } } diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs index a71f74929d..ca8decf9be 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs @@ -1920,7 +1920,7 @@ namespace BizHawk.Client.EmuHawk return 0; } - return index < _horizontalColumnTops.Length + return index >= 0 && index < _horizontalColumnTops.Length ? _horizontalColumnTops[index] : _horizontalColumnTops.Last() + CellHeight; }