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:
@@ -260,12 +260,10 @@ private:
|
||||
class wxGDIPlusPenData : public wxGraphicsObjectRefData
|
||||
{
|
||||
public:
|
||||
wxGDIPlusPenData( wxGraphicsRenderer* renderer, const wxPen &pen );
|
||||
wxGDIPlusPenData( wxGraphicsRenderer* renderer, const wxGraphicsPenInfo &info );
|
||||
~wxGDIPlusPenData();
|
||||
|
||||
void Init();
|
||||
void InitFromPenInfo( const wxGraphicsPenInfo &info );
|
||||
|
||||
virtual wxDouble GetWidth() { return m_width; }
|
||||
virtual Pen* GetGDIPlusPen() { return m_pen; }
|
||||
@@ -575,8 +573,6 @@ public :
|
||||
wxDouble tx=0.0, wxDouble ty=0.0) wxOVERRIDE;
|
||||
|
||||
|
||||
virtual wxGraphicsPen CreatePen(const wxPen& pen) wxOVERRIDE;
|
||||
|
||||
virtual wxGraphicsPen CreatePen(const wxGraphicsPenInfo& pen) wxOVERRIDE;
|
||||
|
||||
virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) wxOVERRIDE;
|
||||
@@ -647,20 +643,9 @@ void wxGDIPlusPenData::Init()
|
||||
m_penBrush = NULL;
|
||||
}
|
||||
|
||||
wxGDIPlusPenData::wxGDIPlusPenData( wxGraphicsRenderer* renderer, const wxPen &pen )
|
||||
: wxGraphicsObjectRefData(renderer)
|
||||
{
|
||||
InitFromPenInfo(wxGraphicsPenInfo::CreateFromPen(pen));
|
||||
}
|
||||
|
||||
wxGDIPlusPenData::wxGDIPlusPenData( wxGraphicsRenderer* renderer,
|
||||
const wxGraphicsPenInfo &info )
|
||||
: wxGraphicsObjectRefData(renderer)
|
||||
{
|
||||
InitFromPenInfo(info);
|
||||
}
|
||||
|
||||
void wxGDIPlusPenData::InitFromPenInfo( const wxGraphicsPenInfo &info )
|
||||
{
|
||||
Init();
|
||||
m_width = info.GetWidth();
|
||||
@@ -2464,19 +2449,6 @@ wxGraphicsMatrix wxGDIPlusRenderer::CreateMatrix( wxDouble a, wxDouble b, wxDoub
|
||||
return m;
|
||||
}
|
||||
|
||||
wxGraphicsPen wxGDIPlusRenderer::CreatePen(const wxPen& pen)
|
||||
{
|
||||
ENSURE_LOADED_OR_RETURN(wxNullGraphicsPen);
|
||||
if ( !pen.IsOk() || pen.GetStyle() == wxPENSTYLE_TRANSPARENT )
|
||||
return wxNullGraphicsPen;
|
||||
else
|
||||
{
|
||||
wxGraphicsPen p;
|
||||
p.SetRefData(new wxGDIPlusPenData( this, pen ));
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
wxGraphicsPen wxGDIPlusRenderer::CreatePen(const wxGraphicsPenInfo& info)
|
||||
{
|
||||
ENSURE_LOADED_OR_RETURN(wxNullGraphicsPen);
|
||||
|
Reference in New Issue
Block a user