X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/12bdd77c85888f29ed94e23ba28d31d99a522598..73fe67bd60b57f95dc63809f7843ed2a15928436:/src/common/dcbase.cpp diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 73653ffc7d..88612bfdb1 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 count[], + wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle) +{ + if ( n == 1 ) + { + DoDrawPolygon(count[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 += count[i]; + } + pts = new wxPoint[j+n-1]; + for (i = 0; i < j; i++) + pts[i] = points[i]; + for (i = 2; i <= n; i++) + { + lastOfs -= count[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(count[i], pts+j, xoffset, yoffset); + j += count[i]; + } + delete[] pts; +} + // ---------------------------------------------------------------------------- // splines // ---------------------------------------------------------------------------- @@ -322,6 +365,36 @@ void wxDCBase::DoDrawSpline( wxList *points ) #endif // wxUSE_SPLINES +// ---------------------------------------------------------------------------- +// Partial Text Extents +// ---------------------------------------------------------------------------- + + +// Each element of the array will be the width of the string up to and +// including the coresoponding character in text. This is the generic +// implementation, the port-specific classes should do this with native APIs +// if available. + +bool wxDCBase::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const +{ + int totalWidth = 0; + size_t i; + + widths.Empty(); + widths.Add(0, text.Length()); + + // Calculate the position of each character based on the widths of + // the previous characters + for (i=0; i