Iterate over wxPointList with STL syntax in wxDC::DoDrawSpline
STL syntax is more readable than notation with legacy API.
This commit is contained in:
@@ -902,46 +902,37 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
|
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
|
||||||
wxCHECK_RET(points, "NULL pointer to spline points?");
|
wxCHECK_RET(points, "NULL pointer to spline points?");
|
||||||
wxCHECK_RET(points->GetCount() >= 2, "incomplete list of spline points?");
|
wxCHECK_RET(points->size() >= 2, "incomplete list of spline points?");
|
||||||
|
|
||||||
const wxPoint *p;
|
const wxPoint *p;
|
||||||
double cx1, cy1, cx2, cy2;
|
|
||||||
double x1, y1, x2, y2;
|
double x1, y1, x2, y2;
|
||||||
|
|
||||||
wxPointList::compatibility_iterator node = points->GetFirst();
|
wxPointList::const_iterator itPt= points->begin();
|
||||||
p = node->GetData();
|
p = *itPt; ++itPt;
|
||||||
|
|
||||||
x1 = p->x;
|
x1 = p->x;
|
||||||
y1 = p->y;
|
y1 = p->y;
|
||||||
|
|
||||||
node = node->GetNext();
|
p = *itPt; ++itPt;
|
||||||
p = node->GetData();
|
|
||||||
|
|
||||||
x2 = p->x;
|
x2 = p->x;
|
||||||
y2 = p->y;
|
y2 = p->y;
|
||||||
cx1 = (double)((x1 + x2) / 2);
|
double cx1 = (double)((x1 + x2) / 2);
|
||||||
cy1 = (double)((y1 + y2) / 2);
|
double cy1 = (double)((y1 + y2) / 2);
|
||||||
cx2 = (double)((cx1 + x2) / 2);
|
double cx2 = (double)((cx1 + x2) / 2);
|
||||||
cy2 = (double)((cy1 + y2) / 2);
|
double cy2 = (double)((cy1 + y2) / 2);
|
||||||
|
|
||||||
wx_spline_add_point(x1, y1);
|
wx_spline_add_point(x1, y1);
|
||||||
|
|
||||||
while ((node = node->GetNext())
|
while ( itPt != points->end() )
|
||||||
#if !wxUSE_STD_CONTAINERS
|
|
||||||
!= NULL
|
|
||||||
#endif // !wxUSE_STD_CONTAINERS
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
double cx3, cy3, cx4, cy4;
|
|
||||||
p = node->GetData();
|
|
||||||
x1 = x2;
|
x1 = x2;
|
||||||
y1 = y2;
|
y1 = y2;
|
||||||
|
p = *itPt; ++itPt;
|
||||||
x2 = p->x;
|
x2 = p->x;
|
||||||
y2 = p->y;
|
y2 = p->y;
|
||||||
cx4 = (double)(x1 + x2) / 2;
|
double cx4 = (double)(x1 + x2) / 2;
|
||||||
cy4 = (double)(y1 + y2) / 2;
|
double cy4 = (double)(y1 + y2) / 2;
|
||||||
cx3 = (double)(x1 + cx4) / 2;
|
double cx3 = (double)(x1 + cx4) / 2;
|
||||||
cy3 = (double)(y1 + cy4) / 2;
|
double cy3 = (double)(y1 + cy4) / 2;
|
||||||
|
|
||||||
wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4);
|
wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user