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:
@@ -304,12 +304,10 @@ protected :
|
||||
class wxMacCoreGraphicsPenData : public wxGraphicsObjectRefData
|
||||
{
|
||||
public:
|
||||
wxMacCoreGraphicsPenData( wxGraphicsRenderer* renderer, const wxPen &pen );
|
||||
wxMacCoreGraphicsPenData( wxGraphicsRenderer* renderer, const wxGraphicsPenInfo& info );
|
||||
~wxMacCoreGraphicsPenData();
|
||||
|
||||
void Init();
|
||||
void InitFromPenInfo( const wxGraphicsPenInfo& info );
|
||||
virtual void Apply( wxGraphicsContext* context );
|
||||
virtual wxDouble GetWidth() { return m_width; }
|
||||
|
||||
@@ -331,20 +329,9 @@ protected :
|
||||
CGFloat* m_patternColorComponents;
|
||||
};
|
||||
|
||||
wxMacCoreGraphicsPenData::wxMacCoreGraphicsPenData( wxGraphicsRenderer* renderer, const wxPen &pen ) :
|
||||
wxGraphicsObjectRefData( renderer )
|
||||
{
|
||||
InitFromPenInfo(wxGraphicsPenInfo::CreateFromPen(pen));
|
||||
}
|
||||
|
||||
wxMacCoreGraphicsPenData::wxMacCoreGraphicsPenData( wxGraphicsRenderer* renderer,
|
||||
const wxGraphicsPenInfo& info )
|
||||
: wxGraphicsObjectRefData( renderer )
|
||||
{
|
||||
InitFromPenInfo(info);
|
||||
}
|
||||
|
||||
void wxMacCoreGraphicsPenData::InitFromPenInfo( const wxGraphicsPenInfo& info )
|
||||
{
|
||||
Init();
|
||||
|
||||
@@ -2550,8 +2537,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 ;
|
||||
@@ -2721,18 +2706,6 @@ wxGraphicsMatrix wxMacCoreGraphicsRenderer::CreateMatrix( wxDouble a, wxDouble b
|
||||
return m;
|
||||
}
|
||||
|
||||
wxGraphicsPen wxMacCoreGraphicsRenderer::CreatePen(const wxPen& pen)
|
||||
{
|
||||
if ( !pen.IsOk() || pen.GetStyle() == wxPENSTYLE_TRANSPARENT )
|
||||
return wxNullGraphicsPen;
|
||||
else
|
||||
{
|
||||
wxGraphicsPen p;
|
||||
p.SetRefData(new wxMacCoreGraphicsPenData( this, pen ));
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
wxGraphicsPen wxMacCoreGraphicsRenderer::CreatePen(const wxGraphicsPenInfo& info)
|
||||
{
|
||||
if ( info.IsTransparent() )
|
||||
|
Reference in New Issue
Block a user