use const arrays for wxDC array parameters, closes #10712

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73382 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett 2013-01-18 17:27:51 +00:00
parent 4ed85025f3
commit 4787c92d39
30 changed files with 114 additions and 112 deletions

View File

@ -165,9 +165,9 @@ protected:
virtual void DoGetSize(int *width, int *height) const;
virtual void DoGetSizeMM(int* width, int* height) const;
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset);
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
};

View File

@ -604,15 +604,15 @@ public:
{ return wxNullBitmap; }
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset ) = 0;
virtual void DrawLines(const wxPointList *list,
wxCoord xoffset, wxCoord yoffset );
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) = 0;
virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle);
void DrawPolygon(const wxPointList *list,
@ -624,7 +624,7 @@ public:
void DrawSpline(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord x3, wxCoord y3);
void DrawSpline(int n, wxPoint points[]);
void DrawSpline(int n, const wxPoint points[]);
void DrawSpline(const wxPointList *points) { DoDrawSpline(points); }
virtual void DoDrawSpline(const wxPointList *points);
@ -1139,7 +1139,7 @@ public:
void DrawPoint(const wxPoint& pt)
{ m_pimpl->DoDrawPoint(pt.x, pt.y); }
void DrawLines(int n, wxPoint points[],
void DrawLines(int n, const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0)
{ m_pimpl->DoDrawLines(n, points, xoffset, yoffset); }
void DrawLines(const wxPointList *list,
@ -1150,7 +1150,7 @@ public:
wxCoord xoffset = 0, wxCoord yoffset = 0) );
#endif // WXWIN_COMPATIBILITY_2_8
void DrawPolygon(int n, wxPoint points[],
void DrawPolygon(int n, const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
@ -1158,7 +1158,7 @@ public:
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); }
void DrawPolyPolygon(int n, int count[], wxPoint points[],
void DrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); }
@ -1281,7 +1281,7 @@ public:
wxCoord x2, wxCoord y2,
wxCoord x3, wxCoord y3)
{ m_pimpl->DrawSpline(x1,y1,x2,y2,x3,y3); }
void DrawSpline(int n, wxPoint points[])
void DrawSpline(int n, const wxPoint points[])
{ m_pimpl->DrawSpline(n,points); }
void DrawSpline(const wxPointList *points)
{ m_pimpl->DrawSpline(points); }

View File

@ -177,12 +177,12 @@ public:
virtual void DoGetSize(int *,int *) const;
virtual void DoGetSizeMM(int* width, int* height) const;
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset);
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle);

View File

@ -82,27 +82,23 @@ protected:
wxCoord *GetX(wxCoord *x, wxCoord *y) const { return m_mirror ? y : x; }
wxCoord *GetY(wxCoord *x, wxCoord *y) const { return m_mirror ? x : y; }
// exchange x and y unconditionally
static void Swap(wxCoord& x, wxCoord& y)
{
wxCoord t = x;
x = y;
y = t;
}
// exchange x and y components of all points in the array if necessary
void Mirror(int n, wxPoint points[]) const
wxPoint* Mirror(int n, const wxPoint*& points) const
{
wxPoint* points_alloc = NULL;
if ( m_mirror )
{
points_alloc = new wxPoint[n];
for ( int i = 0; i < n; i++ )
{
Swap(points[i].x, points[i].y);
points_alloc[i].x = points[i].y;
points_alloc[i].y = points[i].x;
}
points = points_alloc;
}
return points_alloc;
}
// wxDCBase functions
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
wxFloodFillStyle style = wxFLOOD_SURFACE)
@ -226,28 +222,28 @@ protected:
m_dc.DoGetSizeMM(GetX(w, h), GetY(w, h));
}
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset)
{
Mirror(n, points);
wxPoint* points_alloc = Mirror(n, points);
m_dc.DoDrawLines(n, points,
GetX(xoffset, yoffset), GetY(xoffset, yoffset));
Mirror(n, points);
delete[] points_alloc;
}
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE)
{
Mirror(n, points);
wxPoint* points_alloc = Mirror(n, points);
m_dc.DoDrawPolygon(n, points,
GetX(xoffset, yoffset), GetY(xoffset, yoffset),
fillStyle);
Mirror(n, points);
delete[] points_alloc;
}
virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region))

View File

@ -126,12 +126,12 @@ private:
virtual void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0);
virtual void DoDrawPoint(wxCoord, wxCoord);
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle);

View File

@ -132,9 +132,9 @@ protected:
virtual void DoGetSize(int *width, int *height) const;
virtual void DoGetSizeMM(int* width, int* height) const;
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset);
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);

View File

@ -105,11 +105,11 @@ protected:
void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
void DoDrawPoint(wxCoord x, wxCoord y);
void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
void DoDrawPolygon(int n, wxPoint points[],
void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);

View File

@ -40,9 +40,9 @@ public:
double sa, double ea );
virtual void DoDrawPoint( wxCoord x, wxCoord y );
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset);
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);

View File

@ -258,9 +258,9 @@ protected:
void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
void DoDrawPoint(wxCoord x, wxCoord y);
void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);

View File

@ -266,9 +266,9 @@ protected:
void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
void DoDrawPoint(wxCoord x, wxCoord y);
void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);

View File

@ -49,9 +49,9 @@ protected:
double sa, double ea );
virtual void DoDrawPoint( wxCoord x, wxCoord y );
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset);
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);

View File

@ -121,9 +121,9 @@ protected:
wxCoord width, wxCoord height);
virtual void DoSetDeviceClippingRegion(const wxRegion& region);
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset);
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);

View File

@ -249,12 +249,12 @@ public:
virtual void DoGetSizeMM(int* width, int* height) const;
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset);
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const

View File

@ -336,12 +336,12 @@ public:
) const;
virtual void DoDrawLines( int n
,wxPoint vaPoints[]
,const wxPoint vaPoints[]
,wxCoord vXoffset
,wxCoord yYoffset
);
virtual void DoDrawPolygon( int n
,wxPoint vaPoints[]
,const wxPoint vaPoints[]
,wxCoord vXoffset
,wxCoord vYoffset
,wxPolygonFillMode nFillStyle = wxODDEVEN_RULE

View File

@ -77,9 +77,9 @@ protected:
wxCoord width, wxCoord height);
virtual void DoSetDeviceClippingRegion(const wxRegion& region);
virtual void DoDrawLines(int n, wxPoint points[],
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset);
virtual void DoDrawPolygon(int n, wxPoint points[],
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);

View File

@ -413,7 +413,7 @@ public:
Not supported by wxPerl.
@endWxPerlOnly
*/
void DrawLines(int n, wxPoint points[], wxCoord xoffset = 0,
void DrawLines(int n, const wxPoint points[], wxCoord xoffset = 0,
wxCoord yoffset = 0);
/**
This method uses a list of wxPoints, adding the optional offset
@ -455,7 +455,7 @@ public:
Not supported by wxPerl.
@endWxPerlOnly
*/
void DrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0,
void DrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0,
wxCoord yoffset = 0,
wxPolygonFillMode fill_style = wxODDEVEN_RULE);
/**
@ -504,7 +504,7 @@ public:
the DrawPolygon() member function, the polygons created by this
method are not closed automatically.
*/
void DrawPolyPolygon(int n, int count[], wxPoint points[],
void DrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
wxPolygonFillMode fill_style = wxODDEVEN_RULE);
@ -579,7 +579,7 @@ public:
Not supported by wxPerl.
@endWxPerlOnly
*/
void DrawSpline(int n, wxPoint points[]);
void DrawSpline(int n, const wxPoint points[]);
/**
@overload

View File

@ -362,11 +362,11 @@ void wxCocoaDCImpl::DoDrawPoint( int x, int y )
{
};
void wxCocoaDCImpl::DoDrawPolygon( int, wxPoint *, int, int, wxPolygonFillMode)
void wxCocoaDCImpl::DoDrawPolygon( int, const wxPoint *, int, int, wxPolygonFillMode)
{
};
void wxCocoaDCImpl::DoDrawLines( int, wxPoint *, int, int )
void wxCocoaDCImpl::DoDrawLines( int, const wxPoint *, int, int )
{
}

View File

@ -622,8 +622,8 @@ void wxDCImpl::DrawPolygon(const wxPointList *list,
void
wxDCImpl::DoDrawPolyPolygon(int n,
int count[],
wxPoint points[],
const int count[],
const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle)
{
@ -673,11 +673,11 @@ void wxDCImpl::DrawSpline(wxCoord x1, wxCoord y1,
DrawSpline(WXSIZEOF(points), points);
}
void wxDCImpl::DrawSpline(int n, wxPoint points[])
void wxDCImpl::DrawSpline(int n, const wxPoint points[])
{
wxPointList list;
for ( int i = 0; i < n; i++ )
list.Append(&points[i]);
list.Append(const_cast<wxPoint*>(&points[i]));
DrawSpline(&list);
}
@ -799,7 +799,7 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
wxPoint *p;
const wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
double x1, y1, x2, y2;
@ -808,7 +808,7 @@ void wxDCImpl::DoDrawSpline( const wxPointList *points )
// empty list
return;
p = (wxPoint *)node->GetData();
p = node->GetData();
x1 = p->x;
y1 = p->y;

View File

@ -608,7 +608,7 @@ void wxGCDCImpl::DoDrawPoint( wxCoord x, wxCoord y )
DoDrawLine( x , y , x + 1 , y + 1 );
}
void wxGCDCImpl::DoDrawLines(int n, wxPoint points[],
void wxGCDCImpl::DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset)
{
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawLines - invalid DC") );
@ -642,7 +642,7 @@ void wxGCDCImpl::DoDrawSpline(const wxPointList *points)
// empty list
return;
wxPoint *p = node->GetData();
const wxPoint *p = node->GetData();
wxCoord x1 = p->x;
wxCoord y1 = p->y;
@ -686,7 +686,7 @@ void wxGCDCImpl::DoDrawSpline(const wxPointList *points)
}
#endif // wxUSE_SPLINES
void wxGCDCImpl::DoDrawPolygon( int n, wxPoint points[],
void wxGCDCImpl::DoDrawPolygon( int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle )
{
@ -715,8 +715,8 @@ void wxGCDCImpl::DoDrawPolygon( int n, wxPoint points[],
}
void wxGCDCImpl::DoDrawPolyPolygon(int n,
int count[],
wxPoint points[],
const int count[],
const wxPoint points[],
wxCoord xoffset,
wxCoord yoffset,
wxPolygonFillMode fillStyle)

View File

@ -209,7 +209,7 @@ void wxSVGFileDCImpl::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2
CalcBoundingBox(x2, y2);
}
void wxSVGFileDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset , wxCoord yoffset )
void wxSVGFileDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset , wxCoord yoffset )
{
for ( int i = 1; i < n; i++ )
{
@ -322,7 +322,7 @@ void wxSVGFileDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width
CalcBoundingBox(x + width, y + height);
}
void wxSVGFileDCImpl::DoDrawPolygon(int n, wxPoint points[],
void wxSVGFileDCImpl::DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle)
{

View File

@ -239,7 +239,7 @@ void wxDFBDCImpl::DoDrawPoint(wxCoord x, wxCoord y)
// FIXME_DFB: implement special cases for common formats (RGB24,RGBA/RGB32)
}
void wxDFBDCImpl::DoDrawPolygon(int WXUNUSED(n), wxPoint WXUNUSED(points)[],
void wxDFBDCImpl::DoDrawPolygon(int WXUNUSED(n), const wxPoint WXUNUSED(points)[],
wxCoord WXUNUSED(xoffset), wxCoord WXUNUSED(yoffset),
wxPolygonFillMode WXUNUSED(fillStyle))
{
@ -248,7 +248,7 @@ void wxDFBDCImpl::DoDrawPolygon(int WXUNUSED(n), wxPoint WXUNUSED(points)[],
wxFAIL_MSG( "DrawPolygon not implemented" );
}
void wxDFBDCImpl::DoDrawLines(int WXUNUSED(n), wxPoint WXUNUSED(points)[],
void wxDFBDCImpl::DoDrawLines(int WXUNUSED(n), const wxPoint WXUNUSED(points)[],
wxCoord WXUNUSED(xoffset), wxCoord WXUNUSED(yoffset))
{
wxCHECK_RET( IsOk(), wxT("invalid dc") );

View File

@ -597,7 +597,7 @@ void wxPostScriptDCImpl::DoDrawPoint (wxCoord x, wxCoord y)
CalcBoundingBox( x, y );
}
void wxPostScriptDCImpl::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle)
void wxPostScriptDCImpl::DoDrawPolygon (int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
@ -667,7 +667,7 @@ void wxPostScriptDCImpl::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset
}
}
void wxPostScriptDCImpl::DoDrawPolyPolygon (int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle)
void wxPostScriptDCImpl::DoDrawPolyPolygon (int n, const int count[], const wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
@ -743,7 +743,7 @@ void wxPostScriptDCImpl::DoDrawPolyPolygon (int n, int count[], wxPoint points[]
}
}
void wxPostScriptDCImpl::DoDrawLines (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
void wxPostScriptDCImpl::DoDrawLines (int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );

View File

@ -697,7 +697,7 @@ void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y )
CalcBoundingBox (x, y);
}
void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset )
void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
@ -711,17 +711,21 @@ void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCo
xoffset != 0 || yoffset != 0 || XLOG2DEV(10) != 10 || YLOG2DEV(10) != 10;
// GdkPoint and wxPoint have the same memory layout, so we can cast one to the other
GdkPoint* gpts = reinterpret_cast<GdkPoint*>(points);
const GdkPoint* gpts = reinterpret_cast<const GdkPoint*>(points);
GdkPoint* gpts_alloc = NULL;
if (doScale)
gpts = new GdkPoint[n];
{
gpts_alloc = new GdkPoint[n];
gpts = gpts_alloc;
}
for (int i = 0; i < n; i++)
{
if (doScale)
{
gpts[i].x = XLOG2DEV(points[i].x + xoffset);
gpts[i].y = YLOG2DEV(points[i].y + yoffset);
gpts_alloc[i].x = XLOG2DEV(points[i].x + xoffset);
gpts_alloc[i].y = YLOG2DEV(points[i].y + yoffset);
}
CalcBoundingBox(points[i].x + xoffset, points[i].y + yoffset);
}
@ -729,11 +733,10 @@ void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCo
if (m_gdkwindow)
gdk_draw_lines( m_gdkwindow, m_penGC, gpts, n);
if (doScale)
delete[] gpts;
delete[] gpts_alloc;
}
void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[],
void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode WXUNUSED(fillStyle) )
{
@ -746,18 +749,22 @@ void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[],
xoffset != 0 || yoffset != 0 || XLOG2DEV(10) != 10 || YLOG2DEV(10) != 10;
// GdkPoint and wxPoint have the same memory layout, so we can cast one to the other
GdkPoint* gdkpoints = reinterpret_cast<GdkPoint*>(points);
const GdkPoint* gdkpoints = reinterpret_cast<const GdkPoint*>(points);
GdkPoint* gdkpoints_alloc = NULL;
if (doScale)
gdkpoints = new GdkPoint[n];
{
gdkpoints_alloc = new GdkPoint[n];
gdkpoints = gdkpoints_alloc;
}
int i;
for (i = 0 ; i < n ; i++)
{
if (doScale)
{
gdkpoints[i].x = XLOG2DEV(points[i].x + xoffset);
gdkpoints[i].y = YLOG2DEV(points[i].y + yoffset);
gdkpoints_alloc[i].x = XLOG2DEV(points[i].x + xoffset);
gdkpoints_alloc[i].y = YLOG2DEV(points[i].y + yoffset);
}
CalcBoundingBox(points[i].x + xoffset, points[i].y + yoffset);
}
@ -793,8 +800,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[],
}
}
if (doScale)
delete[] gdkpoints;
delete[] gdkpoints_alloc;
}
void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )

View File

@ -1189,7 +1189,7 @@ void wxGnomePrinterDCImpl::DoDrawPoint(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
{
}
void wxGnomePrinterDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
void wxGnomePrinterDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset)
{
if (n <= 0) return;
@ -1210,7 +1210,7 @@ void wxGnomePrinterDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset,
gs_libGnomePrint->gnome_print_stroke ( m_gpc);
}
void wxGnomePrinterDCImpl::DoDrawPolygon(int n, wxPoint points[],
void wxGnomePrinterDCImpl::DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode WXUNUSED(fillStyle))
{
@ -1258,7 +1258,7 @@ void wxGnomePrinterDCImpl::DoDrawPolygon(int n, wxPoint points[],
}
}
void wxGnomePrinterDCImpl::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle)
void wxGnomePrinterDCImpl::DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle)
{
#if wxUSE_NEW_DC
wxDCImpl::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle );

View File

@ -1457,7 +1457,7 @@ void wxGtkPrinterDCImpl::DoDrawPoint(wxCoord x, wxCoord y)
CalcBoundingBox( x, y );
}
void wxGtkPrinterDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
void wxGtkPrinterDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset)
{
if ( m_pen.IsTransparent() )
return;
@ -1479,7 +1479,7 @@ void wxGtkPrinterDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, w
cairo_stroke ( m_cairo);
}
void wxGtkPrinterDCImpl::DoDrawPolygon(int n, wxPoint points[],
void wxGtkPrinterDCImpl::DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle)
{
@ -1515,7 +1515,7 @@ void wxGtkPrinterDCImpl::DoDrawPolygon(int n, wxPoint points[],
cairo_restore(m_cairo);
}
void wxGtkPrinterDCImpl::DoDrawPolyPolygon(int n, int count[], wxPoint points[],
void wxGtkPrinterDCImpl::DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle)
{

View File

@ -649,7 +649,7 @@ void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y )
CalcBoundingBox (x, y);
}
void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset )
void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
@ -680,7 +680,7 @@ void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCo
delete[] gpts;
}
void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode WXUNUSED(fillStyle) )
void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode WXUNUSED(fillStyle) )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );

View File

@ -438,7 +438,7 @@ void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y )
CalcBoundingBox (x, y);
}
void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset )
void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset )
{
wxCHECK_RET( IsOk(), "invalid dc" );
@ -470,7 +470,7 @@ void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCo
}
}
void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[],
void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle )
{
wxCHECK_RET( IsOk(), "invalid dc" );

View File

@ -881,7 +881,7 @@ void wxMSWDCImpl::DoDrawPoint(wxCoord x, wxCoord y)
}
void wxMSWDCImpl::DoDrawPolygon(int n,
wxPoint points[],
const wxPoint points[],
wxCoord xoffset,
wxCoord yoffset,
wxPolygonFillMode WXUNUSED_IN_WINCE(fillStyle))
@ -929,8 +929,8 @@ void wxMSWDCImpl::DoDrawPolygon(int n,
void
wxMSWDCImpl::DoDrawPolyPolygon(int n,
int count[],
wxPoint points[],
const int count[],
const wxPoint points[],
wxCoord xoffset,
wxCoord yoffset,
wxPolygonFillMode fillStyle)
@ -982,7 +982,7 @@ wxMSWDCImpl::DoDrawPolyPolygon(int n,
// __WXWINCE__
}
void wxMSWDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
void wxMSWDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset)
{
WXMICROWIN_CHECK_HDC

View File

@ -836,7 +836,7 @@ void wxPMDCImpl::DoDrawPoint(
} // end of wxPMDCImpl::DoDrawPoint
void wxPMDCImpl::DoDrawPolygon( int n,
wxPoint vPoints[],
const wxPoint vPoints[],
wxCoord vXoffset,
wxCoord vYoffset,
wxPolygonFillMode nFillStyle )
@ -903,7 +903,7 @@ void wxPMDCImpl::DoDrawPolygon( int n,
void wxPMDCImpl::DoDrawLines(
int n
, wxPoint vPoints[]
, const wxPoint vPoints[]
, wxCoord vXoffset
, wxCoord vYoffset
)

View File

@ -621,7 +621,7 @@ void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y )
CalcBoundingBox (x, y);
}
void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset )
void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
@ -641,7 +641,7 @@ void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCo
delete[] xpoints;
}
void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[],
void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode WXUNUSED(fillStyle) )
{