Calculate bounding box in more wxSVGFileDC drawing functions

This commit is contained in:
Maarten Bent
2025-09-09 21:45:40 +02:00
parent 04841732fa
commit d9b9473650
+12
View File
@@ -1023,6 +1023,12 @@ void wxSVGFileDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
GetRenderMode(m_renderingMode), GetPenPattern(m_pen));
write(s);
if ( AreAutomaticBoundingBoxUpdatesEnabled() )
{
double r = wxMax(r1, r2);
CalcBoundingBox(xc - r, yc - r, xc + r, yc + r);
}
}
void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea)
@@ -1117,6 +1123,9 @@ void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord
wxString arcLine = wxString::Format(wxS("%s\" %s %s/>\n"),
arcPath, GetRenderMode(m_renderingMode), GetPenPattern(m_pen));
write(arcLine);
if ( AreAutomaticBoundingBoxUpdatesEnabled() )
CalcBoundingBox(x, y, x + w, y + h);
}
void wxSVGFileDCImpl::DoGradientFillLinear(const wxRect& rect,
@@ -1429,6 +1438,9 @@ void wxSVGFileDCImpl::DoDrawBitmap(const wxBitmap& bmp, wxCoord x, wxCoord y,
{
NewGraphicsIfNeeded();
if ( AreAutomaticBoundingBoxUpdatesEnabled() )
CalcBoundingBox(x, y, x + bmp.GetWidth(), y + bmp.GetHeight());
// If we don't have any bitmap handler yet, use the default one.
if ( !m_bmp_handler )
m_bmp_handler.reset(new wxSVGBitmapFileHandler(m_filename));