Avoid creating wxGraphicsContext in the drawing sample unnecessarily.
This is not only wasteful, but creating a Direct2D surface associated with a wxDC makes it impossible to paint on the DC using GDI functions, so this completely broke the initial display in the sample. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1550,28 +1550,31 @@ void MyCanvas::Draw(wxDC& pdc)
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
wxGraphicsContext* context;
|
if ( m_useContext )
|
||||||
if ( wxPaintDC *paintdc = wxDynamicCast(&pdc, wxPaintDC) )
|
|
||||||
{
|
{
|
||||||
context = renderer->CreateContext(*paintdc);
|
wxGraphicsContext* context;
|
||||||
}
|
if ( wxPaintDC *paintdc = wxDynamicCast(&pdc, wxPaintDC) )
|
||||||
else if ( wxMemoryDC *memdc = wxDynamicCast(&pdc, wxMemoryDC) )
|
{
|
||||||
{
|
context = renderer->CreateContext(*paintdc);
|
||||||
context = renderer->CreateContext(*memdc);
|
}
|
||||||
}
|
else if ( wxMemoryDC *memdc = wxDynamicCast(&pdc, wxMemoryDC) )
|
||||||
|
{
|
||||||
|
context = renderer->CreateContext(*memdc);
|
||||||
|
}
|
||||||
#if wxUSE_METAFILE && defined(wxMETAFILE_IS_ENH)
|
#if wxUSE_METAFILE && defined(wxMETAFILE_IS_ENH)
|
||||||
else if ( wxMetafileDC *metadc = wxDynamicCast(&pdc, wxMetafileDC) )
|
else if ( wxMetafileDC *metadc = wxDynamicCast(&pdc, wxMetafileDC) )
|
||||||
{
|
{
|
||||||
context = renderer->CreateContext(*metadc);
|
context = renderer->CreateContext(*metadc);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( "Unknown wxDC kind" );
|
wxFAIL_MSG( "Unknown wxDC kind" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdc.SetGraphicsContext(context);
|
gdc.SetGraphicsContext(context);
|
||||||
|
}
|
||||||
|
|
||||||
wxDC &dc = m_useContext ? (wxDC&) gdc : (wxDC&) pdc ;
|
wxDC &dc = m_useContext ? (wxDC&) gdc : (wxDC&) pdc ;
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user