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:
@@ -2458,11 +2458,9 @@ wxBrushStyle wxConvertPenStyleToBrushStyle(wxPenStyle penStyle)
|
||||
class wxD2DPenData : public wxGraphicsObjectRefData, public wxD2DManagedGraphicsData
|
||||
{
|
||||
public:
|
||||
wxD2DPenData(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, const wxPen& pen);
|
||||
|
||||
wxD2DPenData(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, const wxGraphicsPenInfo& info);
|
||||
|
||||
void Init(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory);
|
||||
wxD2DPenData(wxGraphicsRenderer* renderer,
|
||||
ID2D1Factory* direct2dFactory,
|
||||
const wxGraphicsPenInfo& info);
|
||||
|
||||
void CreateStrokeStyle(ID2D1Factory* const direct2dfactory);
|
||||
|
||||
@@ -2497,17 +2495,6 @@ private:
|
||||
// wxD2DPenData implementation
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
wxD2DPenData::wxD2DPenData(
|
||||
wxGraphicsRenderer* renderer,
|
||||
ID2D1Factory* direct2dFactory,
|
||||
const wxPen& pen)
|
||||
: wxGraphicsObjectRefData(renderer),
|
||||
m_penInfo(wxGraphicsPenInfo::CreateFromPen(pen)),
|
||||
m_width(pen.GetWidth())
|
||||
{
|
||||
Init(renderer, direct2dFactory);
|
||||
}
|
||||
|
||||
wxD2DPenData::wxD2DPenData(
|
||||
wxGraphicsRenderer* renderer,
|
||||
ID2D1Factory* direct2dFactory,
|
||||
@@ -2515,13 +2502,6 @@ wxD2DPenData::wxD2DPenData(
|
||||
: wxGraphicsObjectRefData(renderer),
|
||||
m_penInfo(info),
|
||||
m_width(info.GetWidth())
|
||||
{
|
||||
Init(renderer, direct2dFactory);
|
||||
}
|
||||
|
||||
void wxD2DPenData::Init(
|
||||
wxGraphicsRenderer* renderer,
|
||||
ID2D1Factory* direct2dFactory)
|
||||
{
|
||||
CreateStrokeStyle(direct2dFactory);
|
||||
|
||||
@@ -4408,8 +4388,6 @@ public :
|
||||
wxDouble a = 1.0, wxDouble b = 0.0, wxDouble c = 0.0, wxDouble d = 1.0,
|
||||
wxDouble tx = 0.0, wxDouble ty = 0.0) wxOVERRIDE;
|
||||
|
||||
wxGraphicsPen CreatePen(const wxPen& pen) wxOVERRIDE;
|
||||
|
||||
wxGraphicsPen CreatePen(const wxGraphicsPenInfo& info) wxOVERRIDE;
|
||||
|
||||
wxGraphicsBrush CreateBrush(const wxBrush& brush) wxOVERRIDE;
|
||||
@@ -4579,21 +4557,6 @@ wxGraphicsMatrix wxD2DRenderer::CreateMatrix(
|
||||
return matrix;
|
||||
}
|
||||
|
||||
wxGraphicsPen wxD2DRenderer::CreatePen(const wxPen& pen)
|
||||
{
|
||||
if ( !pen.IsOk() || pen.GetStyle() == wxPENSTYLE_TRANSPARENT )
|
||||
{
|
||||
return wxNullGraphicsPen;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxGraphicsPen p;
|
||||
wxD2DPenData* penData = new wxD2DPenData(this, m_direct2dFactory, pen);
|
||||
p.SetRefData(penData);
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
wxGraphicsPen wxD2DRenderer::CreatePen(const wxGraphicsPenInfo& info)
|
||||
{
|
||||
if ( info.GetStyle() == wxPENSTYLE_TRANSPARENT )
|
||||
|
Reference in New Issue
Block a user