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