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:
@@ -120,6 +120,9 @@ 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()
|
||||
@@ -838,12 +841,7 @@ wxGraphicsPath wxGraphicsContext::CreatePath() const
|
||||
return GetRenderer()->CreatePath();
|
||||
}
|
||||
|
||||
wxGraphicsPen wxGraphicsContext::CreatePen(const wxPen& pen) const
|
||||
{
|
||||
return GetRenderer()->CreatePen(pen);
|
||||
}
|
||||
|
||||
wxGraphicsPen wxGraphicsContext::CreatePen(const wxGraphicsPenInfo& info) const
|
||||
wxGraphicsPen wxGraphicsContext::DoCreatePen(const wxGraphicsPenInfo& info) const
|
||||
{
|
||||
return GetRenderer()->CreatePen(info);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user