Factor out wxGCDCImpl::CommonInit()

No real changes, just a small refactoring that will allow reusing the
new CommonInit() method in the next commit.
This commit is contained in:
Vadim Zeitlin
2018-12-15 16:51:49 +01:00
committed by Vadim Zeitlin
parent b192b4f676
commit 0338ad5124
2 changed files with 18 additions and 6 deletions

View File

@@ -234,6 +234,12 @@ protected:
bool m_isClipBoxValid; bool m_isClipBoxValid;
private: private:
// This method only initializes trivial fields.
void CommonInit();
// This method initializes all fields (including those initialized by
// CommonInit() as it calls it) and the given context, if non-null, which
// is assumed to be newly created.
void Init(wxGraphicsContext*); void Init(wxGraphicsContext*);
wxDECLARE_CLASS(wxGCDCImpl); wxDECLARE_CLASS(wxGCDCImpl);

View File

@@ -185,23 +185,29 @@ wxGCDCImpl::wxGCDCImpl(wxDC* owner, int)
Init(NULL); Init(NULL);
} }
void wxGCDCImpl::Init(wxGraphicsContext* ctx) void wxGCDCImpl::CommonInit()
{ {
m_ok = false;
m_mm_to_pix_x = mm2pt; m_mm_to_pix_x = mm2pt;
m_mm_to_pix_y = mm2pt; m_mm_to_pix_y = mm2pt;
m_isClipBoxValid = false;
m_logicalFunctionSupported = true;
}
void wxGCDCImpl::Init(wxGraphicsContext* ctx)
{
CommonInit();
m_ok = false;
m_pen = *wxBLACK_PEN; m_pen = *wxBLACK_PEN;
m_font = *wxNORMAL_FONT; m_font = *wxNORMAL_FONT;
m_brush = *wxWHITE_BRUSH; m_brush = *wxWHITE_BRUSH;
m_isClipBoxValid = false;
m_graphicContext = NULL; m_graphicContext = NULL;
if (ctx) if (ctx)
SetGraphicsContext(ctx); SetGraphicsContext(ctx);
m_logicalFunctionSupported = true;
} }
wxGCDCImpl::~wxGCDCImpl() wxGCDCImpl::~wxGCDCImpl()