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?" );
|
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?" );
|
wxCHECK_RET( n_points >= 2 , "incomplete list of spline points?" );
|
||||||
|
|
||||||
const size_t n_bezier_points = n_points * 3 + 1;
|
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;
|
size_t bezier_pos = 0;
|
||||||
wxCoord x1, y1, x2, y2, cx1, cy1;
|
wxCoord x1, y1, x2, y2, cx1, cy1;
|
||||||
|
|
||||||
wxPointList::compatibility_iterator node = points->GetFirst();
|
wxPointList::const_iterator itPt = points->begin();
|
||||||
wxPoint *p = node->GetData();
|
wxPoint* p = *itPt; ++itPt;
|
||||||
lppt[ bezier_pos ].x = x1 = p->x;
|
lppt[ bezier_pos ].x = x1 = p->x;
|
||||||
lppt[ bezier_pos ].y = y1 = p->y;
|
lppt[ bezier_pos ].y = y1 = p->y;
|
||||||
bezier_pos++;
|
bezier_pos++;
|
||||||
@@ -1177,9 +1177,7 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
|
|||||||
bezier_pos++;
|
bezier_pos++;
|
||||||
CalcBoundingBox(x1, y1);
|
CalcBoundingBox(x1, y1);
|
||||||
|
|
||||||
node = node->GetNext();
|
p = *itPt; ++itPt;
|
||||||
p = node->GetData();
|
|
||||||
|
|
||||||
x2 = p->x;
|
x2 = p->x;
|
||||||
y2 = p->y;
|
y2 = p->y;
|
||||||
cx1 = ( x1 + x2 ) / 2;
|
cx1 = ( x1 + x2 ) / 2;
|
||||||
@@ -1191,20 +1189,15 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
|
|||||||
bezier_pos++;
|
bezier_pos++;
|
||||||
CalcBoundingBox(x2, y2);
|
CalcBoundingBox(x2, y2);
|
||||||
|
|
||||||
#if !wxUSE_STD_CONTAINERS
|
while ( itPt != points->end() )
|
||||||
while ((node = node->GetNext()) != NULL)
|
|
||||||
#else
|
|
||||||
while ((node = node->GetNext()))
|
|
||||||
#endif // !wxUSE_STD_CONTAINERS
|
|
||||||
{
|
{
|
||||||
int cx4, cy4;
|
p = *itPt; ++itPt;
|
||||||
p = (wxPoint *)node->GetData();
|
|
||||||
x1 = x2;
|
x1 = x2;
|
||||||
y1 = y2;
|
y1 = y2;
|
||||||
x2 = p->x;
|
x2 = p->x;
|
||||||
y2 = p->y;
|
y2 = p->y;
|
||||||
cx4 = (x1 + x2) / 2;
|
int cx4 = (x1 + x2) / 2;
|
||||||
cy4 = (y1 + y2) / 2;
|
int cy4 = (y1 + y2) / 2;
|
||||||
// B0 is B3 of previous segment
|
// B0 is B3 of previous segment
|
||||||
// B1:
|
// B1:
|
||||||
lppt[ bezier_pos ].x = XLOG2DEV((x1*2+cx1)/3);
|
lppt[ bezier_pos ].x = XLOG2DEV((x1*2+cx1)/3);
|
||||||
|
Reference in New Issue
Block a user