Calculate splitter positions once

Column widths are the same for all rows so there is no need to calculate splitters positions for each drawn row.
This commit is contained in:
Artur Wieczorek
2018-12-26 11:23:11 +01:00
parent c112c20d5f
commit a57aacd5af

View File

@@ -2182,10 +2182,17 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
int gridWidth = state->GetVirtualWidth();
// Calculate position of the right edge of the last cell
int cellX = x + 1;
// Calculate splitters positions
wxVector<int> splitterPos;
splitterPos.reserve(colCount);
int sx = x;
for (wxVector<int>::const_iterator cit = colWidths.begin(); cit != colWidths.end(); ++cit)
cellX += *cit;
{
sx += *cit;
splitterPos.push_back(sx);
}
// Calculate position of the right edge of the last cell
int cellX = sx + 1;
y = firstItemTopY;
for ( unsigned int arrInd=1;
@@ -2244,12 +2251,10 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
}
// Splitters
int sx = x;
for ( unsigned int si = 0; si < colCount; si++ )
for (wxVector<int>::const_iterator spit = splitterPos.begin(); spit != splitterPos.end(); ++spit)
{
sx += colWidths[si];
dc.DrawLine( sx, y, sx, y2 );
int spx = *spit;
dc.DrawLine(spx, y, spx, y2);
}
// Horizontal Line, below