Leave only wxGraphicsRenderer::CreatePen(wxGraphicsPenInfo) overload

It doesn't make much sense to require all the graphics backends to
create wxGraphicsPen from either wxPen or wxGraphicsPenInfo when the
former can be handled just once in the common code.

So do just this, leaving CreatePen() overload taking wxGraphicsPenInfo
where the real pen construction takes place and implementing
wxGraphicsPen creation from wxPen in the common wxGraphicsContext code.

This is not 100% backwards-compatible as any code inheriting from
wxGraphicsRenderer and overriding its CreatePen() will now be broken,
however this should be extremely rare (there is no good reason to
inherit from this class in the user code) and result in compile errors
if it does happen.
This commit is contained in:
Vadim Zeitlin
2017-09-10 01:48:30 +02:00
parent af3581758b
commit 76fd05b147
8 changed files with 29 additions and 134 deletions

View File

@@ -677,13 +677,19 @@ public:
/**
Creates a native pen from a wxPen.
Prefer to use the overload taking wxGraphicsPenInfo unless you already
have a wxPen as constructing one only to pass it to this method is
wasteful.
*/
virtual wxGraphicsPen CreatePen(const wxPen& pen) const;
wxGraphicsPen CreatePen(const wxPen& pen) const;
/**
Creates a native pen from a wxGraphicsPenInfo.
@since 3.1.1
*/
virtual wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) const;
wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) const;
/**
Sets the pen used for stroking.
@@ -1420,9 +1426,11 @@ public:
virtual wxGraphicsPath CreatePath() = 0;
/**
Creates a native pen from a wxPen.
Creates a native pen from its description.
@since 3.1.1
*/
virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0;
virtual wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) = 0;
/**
Creates a native brush with a radial gradient.