fix confusion with (Do)DrawSplines() overloads; don't allocate points on the heap unnecessarily when we can just do it on the stack
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53490 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -469,8 +469,12 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
#if wxUSE_SPLINES
|
#if wxUSE_SPLINES
|
||||||
virtual void DoDrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3);
|
void DrawSpline(wxCoord x1, wxCoord y1,
|
||||||
virtual void DoDrawSpline(int n, wxPoint points[]);
|
wxCoord x2, wxCoord y2,
|
||||||
|
wxCoord x3, wxCoord y3);
|
||||||
|
void DrawSpline(int n, wxPoint points[]);
|
||||||
|
void DrawSpline(const wxPointList *points) { DoDrawSpline(points); }
|
||||||
|
|
||||||
virtual void DoDrawSpline(const wxPointList *points);
|
virtual void DoDrawSpline(const wxPointList *points);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1077,11 +1081,11 @@ public:
|
|||||||
void DrawSpline(wxCoord x1, wxCoord y1,
|
void DrawSpline(wxCoord x1, wxCoord y1,
|
||||||
wxCoord x2, wxCoord y2,
|
wxCoord x2, wxCoord y2,
|
||||||
wxCoord x3, wxCoord y3)
|
wxCoord x3, wxCoord y3)
|
||||||
{ m_pimpl->DoDrawSpline(x1,y1,x2,y2,x3,y3); }
|
{ m_pimpl->DrawSpline(x1,y1,x2,y2,x3,y3); }
|
||||||
void DrawSpline(int n, wxPoint points[])
|
void DrawSpline(int n, wxPoint points[])
|
||||||
{ m_pimpl->DoDrawSpline(n,points); }
|
{ m_pimpl->DrawSpline(n,points); }
|
||||||
void DrawSpline(const wxPointList *points)
|
void DrawSpline(const wxPointList *points)
|
||||||
{ m_pimpl->DoDrawSpline(points); }
|
{ m_pimpl->DrawSpline(points); }
|
||||||
#endif // wxUSE_SPLINES
|
#endif // wxUSE_SPLINES
|
||||||
|
|
||||||
|
|
||||||
|
@@ -758,38 +758,21 @@ wxDCImpl::DoDrawPolyPolygon(int n,
|
|||||||
|
|
||||||
#if wxUSE_SPLINES
|
#if wxUSE_SPLINES
|
||||||
|
|
||||||
void wxDCImpl::DoDrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3)
|
void wxDCImpl::DrawSpline(wxCoord x1, wxCoord y1,
|
||||||
|
wxCoord x2, wxCoord y2,
|
||||||
|
wxCoord x3, wxCoord y3)
|
||||||
{
|
{
|
||||||
wxPointList point_list;
|
wxPoint points[] = { wxPoint(x1, y1), wxPoint(x2, y2), wxPoint(x3, y3) };
|
||||||
|
DrawSpline(WXSIZEOF(points), points);
|
||||||
wxPoint *point1 = new wxPoint;
|
|
||||||
point1->x = x1; point1->y = y1;
|
|
||||||
point_list.Append( point1 );
|
|
||||||
|
|
||||||
wxPoint *point2 = new wxPoint;
|
|
||||||
point2->x = x2; point2->y = y2;
|
|
||||||
point_list.Append( point2 );
|
|
||||||
|
|
||||||
wxPoint *point3 = new wxPoint;
|
|
||||||
point3->x = x3; point3->y = y3;
|
|
||||||
point_list.Append( point3 );
|
|
||||||
|
|
||||||
DoDrawSpline(&point_list);
|
|
||||||
|
|
||||||
for( wxPointList::compatibility_iterator node = point_list.GetFirst(); node; node = node->GetNext() )
|
|
||||||
{
|
|
||||||
wxPoint *p = node->GetData();
|
|
||||||
delete p;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDCImpl::DoDrawSpline(int n, wxPoint points[])
|
void wxDCImpl::DrawSpline(int n, wxPoint points[])
|
||||||
{
|
{
|
||||||
wxPointList list;
|
wxPointList list;
|
||||||
for (int i =0; i < n; i++)
|
for ( int i = 0; i < n; i++ )
|
||||||
list.Append( &points[i] );
|
list.Append(&points[i]);
|
||||||
|
|
||||||
DoDrawSpline(&list);
|
DrawSpline(&list);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------- spline code ----------------------------------------
|
// ----------------------------------- spline code ----------------------------------------
|
||||||
|
Reference in New Issue
Block a user