Allow creating wxGraphicsContext from cairo_t object (wxMSW).
Input void* parameter of wxCairoRenderer::CreateContextFromNativeContext can represent either DC handle or pointer to cairo_t object. It can be checked if it is a real HDC or not and proper wxCairoContext ctor can be invoked. Closes #16991.
This commit is contained in:
committed by
Artur Wieczorek
parent
c3a2994931
commit
46df3a1794
@@ -1908,6 +1908,9 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, HDC handle )
|
|||||||
wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, cairo_t *context )
|
wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, cairo_t *context )
|
||||||
: wxGraphicsContext(renderer)
|
: wxGraphicsContext(renderer)
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
m_mswSurface = NULL;
|
||||||
|
#endif // __WXMSW__
|
||||||
Init( context );
|
Init( context );
|
||||||
m_width =
|
m_width =
|
||||||
m_height = 0;
|
m_height = 0;
|
||||||
@@ -2532,11 +2535,15 @@ wxGraphicsContext * wxCairoRenderer::CreateContext( const wxEnhMetaFileDC& WXUNU
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext( void * context )
|
wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext(void * context)
|
||||||
{
|
{
|
||||||
ENSURE_LOADED_OR_RETURN(NULL);
|
ENSURE_LOADED_OR_RETURN(NULL);
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
return new wxCairoContext(this,(HDC)context);
|
if (::GetObjectType((HGDIOBJ)context) == OBJ_DC)
|
||||||
|
{
|
||||||
|
return new wxCairoContext(this, (HDC)context);
|
||||||
|
}
|
||||||
|
return new wxCairoContext(this, (cairo_t*)context);
|
||||||
#else
|
#else
|
||||||
return new wxCairoContext(this,(cairo_t*)context);
|
return new wxCairoContext(this,(cairo_t*)context);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user