From: Vadim Zeitlin Date: Sat, 7 Feb 2004 16:54:04 +0000 (+0000) Subject: added wxDC::DrawPolyPolygon() (patch 882189) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/63b9e659ef655526cd9ed69113280e864f7e2210?ds=inline added wxDC::DrawPolyPolygon() (patch 882189) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25571 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 73653ffc7d..75b4c6ac79 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -106,6 +106,49 @@ void wxDCBase::DrawPolygon(const wxList *list, delete [] points; } +void +wxDCBase::DoDrawPolyPolygon(int n, + int start[], + wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle) +{ + if ( n == 1 ) + { + DoDrawPolygon(start[0], points, xoffset, yoffset, fillStyle); + return; + } + + int i, j, lastOfs; + wxPoint* pts; + wxPen pen; + + for (i = j = lastOfs = 0; i < n; i++) + { + lastOfs = j; + j += start[i]; + } + pts = new wxPoint[j+n-1]; + for (i = 0; i < j; i++) + pts[i] = points[i]; + for (i = 2; i <= n; i++) + { + lastOfs -= start[n-i]; + pts[j++] = pts[lastOfs]; + } + + pen = GetPen(); + SetPen(wxPen(*wxBLACK, 0, wxTRANSPARENT)); + DoDrawPolygon(j, pts, xoffset, yoffset, fillStyle); + SetPen(pen); + for (i = j = 0; i < n; i++) + { + DoDrawLines(start[i], pts+j, xoffset, yoffset); + j += start[i]; + } + delete pts; +} + // ---------------------------------------------------------------------------- // splines // ---------------------------------------------------------------------------- @@ -617,7 +660,7 @@ void wxDCBase::DoDrawEllipticArcRot( wxCoord x, wxCoord y, } // first draw the pie without pen, if necessary - if( GetBrush() != *wxTRANSPARENT_BRUSH ) + if( GetBrush() != *wxTRANSPARENT_BRUSH ) { wxPen tempPen( GetPen() ); SetPen( *wxTRANSPARENT_PEN ); @@ -626,7 +669,7 @@ void wxDCBase::DoDrawEllipticArcRot( wxCoord x, wxCoord y, } // then draw the arc without brush, if necessary - if( GetPen() != *wxTRANSPARENT_PEN ) + if( GetPen() != *wxTRANSPARENT_PEN ) { // without center DoDrawLines( n-1, points, 0, 0 );