Correctly draw poly-polygons in wxSVGFileDC.
Each polygon in the poly-polygon needs to end with the start-point. The implementation is similar to the wxDCImpl implementation, except for the extra end points that are inserted.
This commit is contained in:
@@ -169,6 +169,10 @@ private:
|
||||
wxCoord xoffset, wxCoord yoffset,
|
||||
wxPolygonFillMode fillStyle) wxOVERRIDE;
|
||||
|
||||
virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
|
||||
wxCoord xoffset, wxCoord yoffset,
|
||||
wxPolygonFillMode fillStyle) wxOVERRIDE;
|
||||
|
||||
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) wxOVERRIDE;
|
||||
|
||||
virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "wx/wfstream.h"
|
||||
#include "wx/filename.h"
|
||||
#include "wx/mstream.h"
|
||||
#include "wx/scopedarray.h"
|
||||
|
||||
#include "wx/private/markupparser.h"
|
||||
|
||||
@@ -496,6 +497,48 @@ void wxSVGFileDCImpl::DoDrawPolygon(int n, const wxPoint points[],
|
||||
write(s);
|
||||
}
|
||||
|
||||
void wxSVGFileDCImpl::DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
|
||||
wxCoord xoffset, wxCoord yoffset,
|
||||
wxPolygonFillMode fillStyle)
|
||||
{
|
||||
if (n == 1)
|
||||
{
|
||||
DoDrawPolygon(count[0], points, xoffset, yoffset, fillStyle);
|
||||
return;
|
||||
}
|
||||
|
||||
int i, j;
|
||||
int totalPts = 0;
|
||||
for (j = 0; j < n; ++j)
|
||||
totalPts += count[j];
|
||||
|
||||
wxScopedArray<wxPoint> pts(totalPts + n);
|
||||
|
||||
int polyCounter = 0, polyIndex = 0;
|
||||
for (i = j = 0; i < totalPts; ++i)
|
||||
{
|
||||
pts[j++] = points[i];
|
||||
++polyCounter;
|
||||
if (polyCounter == count[polyIndex])
|
||||
{
|
||||
pts[j++] = points[i - count[polyIndex] + 1];
|
||||
++polyIndex;
|
||||
polyCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
wxDCPenChanger setTransp(*GetOwner(), *wxTRANSPARENT_PEN);
|
||||
DoDrawPolygon(j, pts.get(), xoffset, yoffset, fillStyle);
|
||||
}
|
||||
|
||||
for (i = j = 0; i < n; i++)
|
||||
{
|
||||
DoDrawLines(count[i] + 1, pts.get() + j, xoffset, yoffset);
|
||||
j += count[i] + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void wxSVGFileDCImpl::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
||||
|
||||
{
|
||||
|
Reference in New Issue
Block a user