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:
@@ -284,12 +284,10 @@ private:
|
||||
class WXDLLIMPEXP_CORE wxCairoPenData : public wxCairoPenBrushBaseData
|
||||
{
|
||||
public:
|
||||
wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen );
|
||||
wxCairoPenData( wxGraphicsRenderer* renderer, const wxGraphicsPenInfo &info );
|
||||
~wxCairoPenData();
|
||||
|
||||
void Init();
|
||||
void InitFromPenInfo( const wxGraphicsPenInfo& info );
|
||||
|
||||
virtual void Apply( wxGraphicsContext* context ) wxOVERRIDE;
|
||||
virtual wxDouble GetWidth() { return m_width; }
|
||||
@@ -735,19 +733,8 @@ void wxCairoPenData::Init()
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
wxCairoPenData::wxCairoPenData( wxGraphicsRenderer* renderer, const wxPen &pen )
|
||||
: wxCairoPenBrushBaseData(renderer, pen.GetColour(), pen.IsTransparent())
|
||||
{
|
||||
InitFromPenInfo(wxGraphicsPenInfo::CreateFromPen(pen));
|
||||
}
|
||||
|
||||
wxCairoPenData::wxCairoPenData( wxGraphicsRenderer* renderer, const wxGraphicsPenInfo &info )
|
||||
: wxCairoPenBrushBaseData(renderer, info.GetColour(), info.IsTransparent())
|
||||
{
|
||||
InitFromPenInfo(info);
|
||||
}
|
||||
|
||||
void wxCairoPenData::InitFromPenInfo( const wxGraphicsPenInfo &info )
|
||||
{
|
||||
Init();
|
||||
m_width = info.GetWidth();
|
||||
@@ -2916,7 +2903,6 @@ public :
|
||||
wxDouble tx=0.0, wxDouble ty=0.0) wxOVERRIDE;
|
||||
|
||||
|
||||
virtual wxGraphicsPen CreatePen(const wxPen& pen) wxOVERRIDE ;
|
||||
virtual wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) wxOVERRIDE ;
|
||||
|
||||
virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) wxOVERRIDE ;
|
||||
@@ -3093,17 +3079,6 @@ wxGraphicsMatrix wxCairoRenderer::CreateMatrix( wxDouble a, wxDouble b, wxDouble
|
||||
return m;
|
||||
}
|
||||
|
||||
wxGraphicsPen wxCairoRenderer::CreatePen(const wxPen& pen)
|
||||
{
|
||||
wxGraphicsPen p;
|
||||
ENSURE_LOADED_OR_RETURN(p);
|
||||
if (pen.IsOk() && pen.GetStyle() != wxPENSTYLE_TRANSPARENT)
|
||||
{
|
||||
p.SetRefData(new wxCairoPenData( this, pen ));
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
wxGraphicsPen wxCairoRenderer::CreatePen(const wxGraphicsPenInfo& info)
|
||||
{
|
||||
wxGraphicsPen p;
|
||||
|
Reference in New Issue
Block a user