Don't use template member function in drawing sample to placate VC6.
VC6 can't instantiate member template functions so get rid of it and use ugly dynamic casts in the non-template function to construct wxGCDC correctly. See #13327. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68311 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -149,7 +149,7 @@ public:
|
|||||||
#if wxUSE_GRAPHICS_CONTEXT
|
#if wxUSE_GRAPHICS_CONTEXT
|
||||||
void UseGraphicContext(bool use) { m_useContext = use; Refresh(); }
|
void UseGraphicContext(bool use) { m_useContext = use; Refresh(); }
|
||||||
#endif
|
#endif
|
||||||
template <typename T> void Draw(T& dc);
|
void Draw(wxDC& dc);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum DrawMode
|
enum DrawMode
|
||||||
@@ -1487,26 +1487,47 @@ void MyCanvas::DrawRegionsHelper(wxDC& dc, wxCoord x, bool firstTime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_CAIRO_EVERYWHERE
|
|
||||||
extern wxGraphicsRenderer* gCairoRenderer;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event))
|
void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxPaintDC pdc(this);
|
wxPaintDC pdc(this);
|
||||||
Draw(pdc);
|
Draw(pdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
void MyCanvas::Draw(wxDC& pdc)
|
||||||
void MyCanvas::Draw(T& pdc)
|
|
||||||
{
|
{
|
||||||
#if wxUSE_GRAPHICS_CONTEXT
|
#if wxUSE_GRAPHICS_CONTEXT
|
||||||
#if TEST_CAIRO_EVERYWHERE
|
|
||||||
wxGCDC gdc;
|
wxGCDC gdc;
|
||||||
gdc.SetGraphicsContext( gCairoRenderer->CreateContext( pdc ) );
|
wxGraphicsRenderer* const renderer = wxGraphicsRenderer::
|
||||||
|
#if TEST_CAIRO_EVERYWHERE
|
||||||
|
GetCairoRenderer()
|
||||||
#else
|
#else
|
||||||
wxGCDC gdc( pdc ) ;
|
GetDefaultRenderer()
|
||||||
#endif
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
wxGraphicsContext* context;
|
||||||
|
if ( wxPaintDC *paintdc = wxDynamicCast(&pdc, wxPaintDC) )
|
||||||
|
{
|
||||||
|
context = renderer->CreateContext(*paintdc);
|
||||||
|
}
|
||||||
|
else if ( wxMemoryDC *memdc = wxDynamicCast(&pdc, wxMemoryDC) )
|
||||||
|
{
|
||||||
|
context = renderer->CreateContext(*memdc);
|
||||||
|
}
|
||||||
|
#if wxUSE_METAFILE && defined(wxMETAFILE_IS_ENH)
|
||||||
|
else if ( wxMetafileDC *metadc = wxDynamicCast(&pdc, wxMetafileDC) )
|
||||||
|
{
|
||||||
|
context = renderer->CreateContext(*metadc);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( "Unknown wxDC kind" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdc.SetGraphicsContext(context);
|
||||||
|
|
||||||
wxDC &dc = m_useContext ? (wxDC&) gdc : (wxDC&) pdc ;
|
wxDC &dc = m_useContext ? (wxDC&) gdc : (wxDC&) pdc ;
|
||||||
#else
|
#else
|
||||||
wxDC &dc = pdc ;
|
wxDC &dc = pdc ;
|
||||||
|
Reference in New Issue
Block a user