Iterate over wxPointList with STL syntax in wxMSWDC::DoDrawSpline
STL syntax is more readable than notation with legacy API.
This commit is contained in:
@@ -1160,7 +1160,7 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
|
||||
|
||||
wxCHECK_RET( points, "NULL pointer to spline points?" );
|
||||
|
||||
const size_t n_points = points->GetCount();
|
||||
const size_t n_points = points->size();
|
||||
wxCHECK_RET( n_points >= 2 , "incomplete list of spline points?" );
|
||||
|
||||
const size_t n_bezier_points = n_points * 3 + 1;
|
||||
@@ -1168,8 +1168,8 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
|
||||
size_t bezier_pos = 0;
|
||||
wxCoord x1, y1, x2, y2, cx1, cy1;
|
||||
|
||||
wxPointList::compatibility_iterator node = points->GetFirst();
|
||||
wxPoint *p = node->GetData();
|
||||
wxPointList::const_iterator itPt = points->begin();
|
||||
wxPoint* p = *itPt; ++itPt;
|
||||
lppt[ bezier_pos ].x = x1 = p->x;
|
||||
lppt[ bezier_pos ].y = y1 = p->y;
|
||||
bezier_pos++;
|
||||
@@ -1177,9 +1177,7 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
|
||||
bezier_pos++;
|
||||
CalcBoundingBox(x1, y1);
|
||||
|
||||
node = node->GetNext();
|
||||
p = node->GetData();
|
||||
|
||||
p = *itPt; ++itPt;
|
||||
x2 = p->x;
|
||||
y2 = p->y;
|
||||
cx1 = ( x1 + x2 ) / 2;
|
||||
@@ -1191,20 +1189,15 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
|
||||
bezier_pos++;
|
||||
CalcBoundingBox(x2, y2);
|
||||
|
||||
#if !wxUSE_STD_CONTAINERS
|
||||
while ((node = node->GetNext()) != NULL)
|
||||
#else
|
||||
while ((node = node->GetNext()))
|
||||
#endif // !wxUSE_STD_CONTAINERS
|
||||
while ( itPt != points->end() )
|
||||
{
|
||||
int cx4, cy4;
|
||||
p = (wxPoint *)node->GetData();
|
||||
p = *itPt; ++itPt;
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
x2 = p->x;
|
||||
y2 = p->y;
|
||||
cx4 = (x1 + x2) / 2;
|
||||
cy4 = (y1 + y2) / 2;
|
||||
int cx4 = (x1 + x2) / 2;
|
||||
int cy4 = (y1 + y2) / 2;
|
||||
// B0 is B3 of previous segment
|
||||
// B1:
|
||||
lppt[ bezier_pos ].x = XLOG2DEV((x1*2+cx1)/3);
|
||||
|
Reference in New Issue
Block a user