diff --git a/include/wx/dcsvg.h b/include/wx/dcsvg.h index 8a368f102d..9398a48b6e 100644 --- a/include/wx/dcsvg.h +++ b/include/wx/dcsvg.h @@ -81,10 +81,7 @@ public: return -1; } - virtual void Clear() wxOVERRIDE - { - wxFAIL_MSG(wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?")); - } + virtual void Clear() wxOVERRIDE; virtual void DestroyClippingRegion() wxOVERRIDE; diff --git a/interface/wx/dcsvg.h b/interface/wx/dcsvg.h index ffaa3d82ae..f28c81af29 100644 --- a/interface/wx/dcsvg.h +++ b/interface/wx/dcsvg.h @@ -60,7 +60,7 @@ public: void EndPage(); /** - This makes no sense in wxSVGFileDC and does nothing. + Draws a rectangle the size of the SVG using the wxDC::SetBackground() brush. */ void Clear(); diff --git a/src/common/dcsvg.cpp b/src/common/dcsvg.cpp index 2ce4912543..69ef562f14 100644 --- a/src/common/dcsvg.cpp +++ b/src/common/dcsvg.cpp @@ -305,6 +305,17 @@ wxSize wxSVGFileDCImpl::GetPPI() const return wxSize( wxRound(m_dpi), wxRound(m_dpi) ); } +void wxSVGFileDCImpl::Clear() +{ + { + wxDCBrushChanger setBackground(*GetOwner(), m_backgroundBrush); + wxDCPenChanger setTransp(*GetOwner(), *wxTRANSPARENT_PEN); + DoDrawRectangle(0, 0, m_width, m_height); + } + + NewGraphicsIfNeeded(); +} + void wxSVGFileDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) { NewGraphicsIfNeeded();