}
#endif
+wxGCDC::wxGCDC(wxGraphicsContext* context) :
+ wxDC( new wxGCDCImpl( this ) )
+{
+ SetGraphicsContext(context);
+}
+
wxGCDC::wxGCDC() :
wxDC( new wxGCDCImpl( this ) )
{
{
Init();
wxGraphicsContext* context;
-#if wxUSE_CAIRO
- wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetCairoRenderer();
- context = renderer->CreateContext(dc);
-#else
context = wxGraphicsContext::Create(dc);
-#endif
-
SetGraphicsContext( context );
}
{
wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::SetTextForeground - invalid DC") );
- if ( col != m_textForegroundColour )
+ // don't set m_textForegroundColour to an invalid colour as we'd crash
+ // later then (we use m_textForegroundColour.GetColor() without checking
+ // in a few places)
+ if ( col.IsOk() && col != m_textForegroundColour )
{
m_textForegroundColour = col;
m_graphicContext->SetFont( m_font, m_textForegroundColour );