Iterate over wxPointList with STL syntax in wxPostScriptDC::DoDrawSpline
STL syntax is more readable than notation with legacy API
This commit is contained in:
@@ -1447,17 +1447,17 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
|
wxCHECK_RET( m_ok, wxT("invalid postscript 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?");
|
||||||
|
|
||||||
SetPen( m_pen );
|
SetPen( m_pen );
|
||||||
|
|
||||||
wxPointList::compatibility_iterator node = points->GetFirst();
|
wxPointList::const_iterator itPt = points->begin();
|
||||||
wxPoint* p = node->GetData();
|
|
||||||
wxPoint2DDouble p1(*p);
|
|
||||||
|
|
||||||
node = node->GetNext();
|
const wxPoint* pt = *itPt; ++itPt;
|
||||||
p = node->GetData();
|
wxPoint2DDouble p1(*pt);
|
||||||
wxPoint2DDouble p2(*p);
|
|
||||||
|
pt = *itPt; ++itPt;
|
||||||
|
wxPoint2DDouble p2(*pt);
|
||||||
wxPoint2DDouble p3 = (p1 + p2) / 2.0;
|
wxPoint2DDouble p3 = (p1 + p2) / 2.0;
|
||||||
|
|
||||||
wxString buffer;
|
wxString buffer;
|
||||||
@@ -1472,14 +1472,13 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points )
|
|||||||
CalcBoundingBox( (wxCoord)p1.m_x, (wxCoord)p1.m_y );
|
CalcBoundingBox( (wxCoord)p1.m_x, (wxCoord)p1.m_y );
|
||||||
CalcBoundingBox( (wxCoord)p3.m_x, (wxCoord)p3.m_y );
|
CalcBoundingBox( (wxCoord)p3.m_x, (wxCoord)p3.m_y );
|
||||||
|
|
||||||
node = node->GetNext();
|
while ( itPt != points->end() )
|
||||||
while (node)
|
|
||||||
{
|
{
|
||||||
p = node->GetData();
|
pt = *itPt; ++itPt;
|
||||||
|
|
||||||
wxPoint2DDouble p0 = p3;
|
wxPoint2DDouble p0 = p3;
|
||||||
p1 = p2;
|
p1 = p2;
|
||||||
p2 = *p;
|
p2 = *pt;
|
||||||
p3 = (p1 + p2) / 2.0;
|
p3 = (p1 + p2) / 2.0;
|
||||||
|
|
||||||
// Calculate using degree elevation to a cubic bezier
|
// Calculate using degree elevation to a cubic bezier
|
||||||
@@ -1495,8 +1494,6 @@ void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points )
|
|||||||
|
|
||||||
CalcBoundingBox( (wxCoord)p0.m_x, (wxCoord)p0.m_y );
|
CalcBoundingBox( (wxCoord)p0.m_x, (wxCoord)p0.m_y );
|
||||||
CalcBoundingBox( (wxCoord)p3.m_x, (wxCoord)p3.m_y );
|
CalcBoundingBox( (wxCoord)p3.m_x, (wxCoord)p3.m_y );
|
||||||
|
|
||||||
node = node->GetNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user