Add wxGraphicsRenderer::CreateContextFromUnknownDC()
It seems wrong to have this function in wxGraphicsContext only and not in wxGraphicsRenderer, as this makes it impossible to create a context associated with a non-default renderer while it doesn't cost us anything to allow doing this.
This commit is contained in:
@@ -988,22 +988,27 @@ wxGraphicsBitmap wxGraphicsContext::CreateSubBitmap( const wxGraphicsBitmap &bmp
|
||||
#endif
|
||||
|
||||
wxGraphicsContext* wxGraphicsContext::CreateFromUnknownDC(const wxDC& dc)
|
||||
{
|
||||
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContextFromUnknownDC(dc);
|
||||
}
|
||||
|
||||
wxGraphicsContext* wxGraphicsRenderer::CreateContextFromUnknownDC(const wxDC& dc)
|
||||
{
|
||||
if ( const wxWindowDC *windc = wxDynamicCast(&dc, wxWindowDC) )
|
||||
return Create(*windc);
|
||||
return CreateContext(*windc);
|
||||
|
||||
if ( const wxMemoryDC *memdc = wxDynamicCast(&dc, wxMemoryDC) )
|
||||
return Create(*memdc);
|
||||
return CreateContext(*memdc);
|
||||
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
if ( const wxPrinterDC *printdc = wxDynamicCast(&dc, wxPrinterDC) )
|
||||
return Create(*printdc);
|
||||
return CreateContext(*printdc);
|
||||
#endif
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#if wxUSE_ENH_METAFILE
|
||||
if ( const wxEnhMetaFileDC *mfdc = wxDynamicCast(&dc, wxEnhMetaFileDC) )
|
||||
return Create(*mfdc);
|
||||
return CreateContext(*mfdc);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user