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:
Vadim Zeitlin 2014-09-14 00:59:56 +00:00
parent c2e18d75e5
commit 6cea553fa3

View File

@ -1550,6 +1550,8 @@ void MyCanvas::Draw(wxDC& pdc)
#endif
;
if ( m_useContext )
{
wxGraphicsContext* context;
if ( wxPaintDC *paintdc = wxDynamicCast(&pdc, wxPaintDC) )
{
@ -1572,6 +1574,7 @@ void MyCanvas::Draw(wxDC& pdc)
}
gdc.SetGraphicsContext(context);
}
wxDC &dc = m_useContext ? (wxDC&) gdc : (wxDC&) pdc ;
#else