Optimize calculating position of the right edge of the last cell
Cell widths are invariant during the drawing so calculation can be done once, not on every loop.
This commit is contained in:
@@ -2182,6 +2182,11 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
|
|||||||
|
|
||||||
int gridWidth = state->GetVirtualWidth();
|
int gridWidth = state->GetVirtualWidth();
|
||||||
|
|
||||||
|
// Calculate position of the right edge of the last cell
|
||||||
|
int cellX = x + 1;
|
||||||
|
for (wxVector<int>::const_iterator cit = colWidths.begin(); cit != colWidths.end(); ++cit)
|
||||||
|
cellX += *cit;
|
||||||
|
|
||||||
y = firstItemTopY;
|
y = firstItemTopY;
|
||||||
for ( unsigned int arrInd=1;
|
for ( unsigned int arrInd=1;
|
||||||
nextP && y <= lastItemBottomY;
|
nextP && y <= lastItemBottomY;
|
||||||
@@ -2377,16 +2382,12 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
|
|||||||
int firstCellX = cellRect.x;
|
int firstCellX = cellRect.x;
|
||||||
|
|
||||||
// Calculate cellRect.x for the last cell
|
// Calculate cellRect.x for the last cell
|
||||||
unsigned int ci = 0;
|
|
||||||
int cellX = x + 1;
|
|
||||||
for ( ci = 0; ci < colCount; ci++ )
|
|
||||||
cellX += colWidths[ci];
|
|
||||||
cellRect.x = cellX;
|
cellRect.x = cellX;
|
||||||
|
|
||||||
// Draw cells from back to front so that we can easily tell if the
|
// Draw cells from back to front so that we can easily tell if the
|
||||||
// cell on the right was empty from text
|
// cell on the right was empty from text
|
||||||
bool prevFilled = true;
|
bool prevFilled = true;
|
||||||
ci = colCount;
|
unsigned int ci = colCount;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ci--;
|
ci--;
|
||||||
|
Reference in New Issue
Block a user