From 3cc4d51c9b9a40c10ef770c2c43d3d247d8b1e3c Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 15 Mar 2016 22:12:13 +0100 Subject: [PATCH] Implemented Clear in wxSVGFileDC. Draw a rectangle with the background colour and a transparent pen. Closes #15788. --- include/wx/dcsvg.h | 5 +---- interface/wx/dcsvg.h | 2 +- src/common/dcsvg.cpp | 11 +++++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) 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();