From 8bad0e494f70ed1d62580f2b2cbbe767853f62b9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 10 Sep 2017 01:53:02 +0200 Subject: [PATCH] Get rid of wxGraphicsPenInfo::CreateFromPen() This is a helper method used only in wxWidgets itself and only once, so just inline it at the point of use to avoid exporting an unnecessary function in the public API. --- include/wx/graphics.h | 7 +------ src/common/graphcmn.cpp | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/include/wx/graphics.h b/include/wx/graphics.h index 0374f62885..7cbe1bc52f 100644 --- a/include/wx/graphics.h +++ b/include/wx/graphics.h @@ -157,10 +157,6 @@ public: wxDouble GetWidth() const { return m_width; } - // This is a helper used by wxWidgets itself, it doesn't make much sense to - // use it outside of the library. - static wxGraphicsPenInfo CreateFromPen(const wxPen& pen); - private: wxDouble m_width; }; @@ -512,8 +508,7 @@ public: wxGraphicsPath CreatePath() const; - wxGraphicsPen CreatePen(const wxPen& pen) const - { return DoCreatePen(wxGraphicsPenInfo::CreateFromPen(pen)); } + wxGraphicsPen CreatePen(const wxPen& pen) const; wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) const { return DoCreatePen(info); } diff --git a/src/common/graphcmn.cpp b/src/common/graphcmn.cpp index afb24ca689..5f88faf950 100644 --- a/src/common/graphcmn.cpp +++ b/src/common/graphcmn.cpp @@ -117,24 +117,6 @@ WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush) wxNullGraphicsBrush; WXDLLIMPEXP_DATA_CORE(wxGraphicsFont) wxNullGraphicsFont; WXDLLIMPEXP_DATA_CORE(wxGraphicsBitmap) wxNullGraphicsBitmap; -/* static */ -wxGraphicsPenInfo wxGraphicsPenInfo::CreateFromPen(const wxPen& pen) -{ - if ( !pen.IsOk() ) - return wxGraphicsPenInfo().Style(wxPENSTYLE_TRANSPARENT); - - wxDash *dashes; - int nb_dashes = pen.GetDashes(&dashes); - return wxGraphicsPenInfo() - .Colour(pen.GetColour()) - .Width(pen.GetWidth()) - .Style(pen.GetStyle()) - .Stipple(*pen.GetStipple()) - .Dashes(nb_dashes, dashes) - .Join(pen.GetJoin()) - .Cap(pen.GetCap()); -} - //----------------------------------------------------------------------------- // matrix //----------------------------------------------------------------------------- @@ -841,6 +823,24 @@ wxGraphicsPath wxGraphicsContext::CreatePath() const return GetRenderer()->CreatePath(); } +wxGraphicsPen wxGraphicsContext::CreatePen(const wxPen& pen) const +{ + if ( !pen.IsOk() ) + return wxGraphicsPen(); + + wxDash *dashes; + int nb_dashes = pen.GetDashes(&dashes); + + return DoCreatePen(wxGraphicsPenInfo() + .Colour(pen.GetColour()) + .Width(pen.GetWidth()) + .Style(pen.GetStyle()) + .Stipple(*pen.GetStipple()) + .Dashes(nb_dashes, dashes) + .Join(pen.GetJoin()) + .Cap(pen.GetCap())); +} + wxGraphicsPen wxGraphicsContext::DoCreatePen(const wxGraphicsPenInfo& info) const { return GetRenderer()->CreatePen(info);