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.
This commit is contained in:
Vadim Zeitlin
2017-09-10 01:53:02 +02:00
parent 76fd05b147
commit 8bad0e494f
2 changed files with 19 additions and 24 deletions

View File

@@ -157,10 +157,6 @@ public:
wxDouble GetWidth() const { return m_width; } 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: private:
wxDouble m_width; wxDouble m_width;
}; };
@@ -512,8 +508,7 @@ public:
wxGraphicsPath CreatePath() const; wxGraphicsPath CreatePath() const;
wxGraphicsPen CreatePen(const wxPen& pen) const wxGraphicsPen CreatePen(const wxPen& pen) const;
{ return DoCreatePen(wxGraphicsPenInfo::CreateFromPen(pen)); }
wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) const wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) const
{ return DoCreatePen(info); } { return DoCreatePen(info); }

View File

@@ -117,24 +117,6 @@ WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush) wxNullGraphicsBrush;
WXDLLIMPEXP_DATA_CORE(wxGraphicsFont) wxNullGraphicsFont; WXDLLIMPEXP_DATA_CORE(wxGraphicsFont) wxNullGraphicsFont;
WXDLLIMPEXP_DATA_CORE(wxGraphicsBitmap) wxNullGraphicsBitmap; 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 // matrix
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -841,6 +823,24 @@ wxGraphicsPath wxGraphicsContext::CreatePath() const
return GetRenderer()->CreatePath(); 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 wxGraphicsPen wxGraphicsContext::DoCreatePen(const wxGraphicsPenInfo& info) const
{ {
return GetRenderer()->CreatePen(info); return GetRenderer()->CreatePen(info);