InputRoll - tiny optimization - don't calculate lastvisiblecolumnindex during a for loop
This commit is contained in:
parent
0e11ae4316
commit
fceb4487c9
|
@ -544,20 +544,27 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
int startIndex = FirstVisibleRow;
|
int startIndex = FirstVisibleRow;
|
||||||
int range = Math.Min(LastVisibleRow, RowCount - 1) - startIndex + 1;
|
int range = Math.Min(LastVisibleRow, RowCount - 1) - startIndex + 1;
|
||||||
|
int lastVisible = LastVisibleColumnIndex;
|
||||||
|
|
||||||
for (int i = 0, f = 0; f < range; i++, f++)
|
for (int i = 0, f = 0; f < range; i++, f++)
|
||||||
{
|
{
|
||||||
f += lagFrames[i];
|
f += lagFrames[i];
|
||||||
int LastVisible = LastVisibleColumnIndex;
|
|
||||||
Color rowColor = Color.White;
|
Color rowColor = Color.White;
|
||||||
if (QueryRowBkColor != null)
|
if (QueryRowBkColor != null)
|
||||||
|
{
|
||||||
QueryRowBkColor(f + startIndex, ref rowColor);
|
QueryRowBkColor(f + startIndex, ref rowColor);
|
||||||
for (int j = FirstVisibleColumn; j <= LastVisible; j++) // TODO: Don't query all columns
|
}
|
||||||
|
|
||||||
|
for (int j = FirstVisibleColumn; j <= lastVisible; j++)
|
||||||
{
|
{
|
||||||
Color itemColor = Color.White;
|
Color itemColor = Color.White;
|
||||||
QueryItemBkColor(f + startIndex, columns[j], ref itemColor);
|
QueryItemBkColor(f + startIndex, columns[j], ref itemColor);
|
||||||
if (itemColor == Color.White)
|
if (itemColor == Color.White)
|
||||||
|
{
|
||||||
itemColor = rowColor;
|
itemColor = rowColor;
|
||||||
|
}
|
||||||
|
|
||||||
else if (itemColor.A != 255 && itemColor.A != 0)
|
else if (itemColor.A != 255 && itemColor.A != 0)
|
||||||
{
|
{
|
||||||
float alpha = (float)itemColor.A / 255;
|
float alpha = (float)itemColor.A / 255;
|
||||||
|
@ -568,7 +575,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (itemColor != Color.White) // An easy optimization, don't draw unless the user specified something other than the default
|
if (itemColor != Color.White) // An easy optimization, don't draw unless the user specified something other than the default
|
||||||
{
|
{
|
||||||
var cell = new Cell()
|
var cell = new Cell
|
||||||
{
|
{
|
||||||
Column = columns[j],
|
Column = columns[j],
|
||||||
RowIndex = i
|
RowIndex = i
|
||||||
|
@ -582,20 +589,26 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
int startRow = FirstVisibleRow;
|
int startRow = FirstVisibleRow;
|
||||||
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
||||||
|
int lastVisible = LastVisibleColumnIndex;
|
||||||
|
|
||||||
for (int i = 0, f = 0; f < range; i++, f++) // Vertical
|
for (int i = 0, f = 0; f < range; i++, f++) // Vertical
|
||||||
{
|
{
|
||||||
f += lagFrames[i];
|
f += lagFrames[i];
|
||||||
int LastVisible = LastVisibleColumnIndex;
|
|
||||||
Color rowColor = Color.White;
|
Color rowColor = Color.White;
|
||||||
if (QueryRowBkColor != null)
|
if (QueryRowBkColor != null)
|
||||||
|
{
|
||||||
QueryRowBkColor(f + startRow, ref rowColor);
|
QueryRowBkColor(f + startRow, ref rowColor);
|
||||||
for (int j = FirstVisibleColumn; j <= LastVisible; j++) // Horizontal
|
}
|
||||||
|
|
||||||
|
for (int j = FirstVisibleColumn; j <= lastVisible; j++) // Horizontal
|
||||||
{
|
{
|
||||||
Color itemColor = Color.White;
|
Color itemColor = Color.White;
|
||||||
QueryItemBkColor(f + startRow, columns[j], ref itemColor);
|
QueryItemBkColor(f + startRow, columns[j], ref itemColor);
|
||||||
if (itemColor == Color.White)
|
if (itemColor == Color.White)
|
||||||
|
{
|
||||||
itemColor = rowColor;
|
itemColor = rowColor;
|
||||||
|
}
|
||||||
else if (itemColor.A != 255 && itemColor.A != 0)
|
else if (itemColor.A != 255 && itemColor.A != 0)
|
||||||
{
|
{
|
||||||
float alpha = (float)itemColor.A / 255;
|
float alpha = (float)itemColor.A / 255;
|
||||||
|
|
Loading…
Reference in New Issue