make x11 dc could get cairo context, so the graphic module could use in x11. This use cairo xlib backend.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77853 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -108,6 +108,8 @@ public:
|
|||||||
|
|
||||||
virtual void ComputeScaleAndOrigin();
|
virtual void ComputeScaleAndOrigin();
|
||||||
|
|
||||||
|
virtual void* GetCairoContext() const wxOVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// implementation
|
// implementation
|
||||||
// --------------
|
// --------------
|
||||||
|
@@ -1744,6 +1744,12 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC&
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WXX11__
|
||||||
|
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
|
||||||
|
if ( cr )
|
||||||
|
Init(cairo_reference(cr));
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
CGContextRef cgcontext = (CGContextRef)dc.GetWindow()->MacGetCGContextRef();
|
CGContextRef cgcontext = (CGContextRef)dc.GetWindow()->MacGetCGContextRef();
|
||||||
cairo_surface_t* surface = cairo_quartz_surface_create_for_cg_context(cgcontext, width, height);
|
cairo_surface_t* surface = cairo_quartz_surface_create_for_cg_context(cgcontext, width, height);
|
||||||
|
@@ -28,6 +28,8 @@
|
|||||||
#include "wx/x11/dcclient.h"
|
#include "wx/x11/dcclient.h"
|
||||||
#include "wx/x11/dcmemory.h"
|
#include "wx/x11/dcmemory.h"
|
||||||
|
|
||||||
|
#include "cairo-xlib.h"
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
#include "glib.h"
|
#include "glib.h"
|
||||||
#include "pango/pangoxft.h"
|
#include "pango/pangoxft.h"
|
||||||
@@ -343,6 +345,17 @@ void wxWindowDCImpl::SetUpDC()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* wxWindowDCImpl::GetCairoContext() const
|
||||||
|
{
|
||||||
|
int width, height;
|
||||||
|
DoGetSize(&width, &height);
|
||||||
|
cairo_surface_t *surface;
|
||||||
|
surface = cairo_xlib_surface_create((Display*) m_display, (Drawable) m_x11window,
|
||||||
|
DefaultVisual((Display*) m_display, 0), width, height);
|
||||||
|
cairo_t *cr = cairo_create(surface);
|
||||||
|
return cr;
|
||||||
|
}
|
||||||
|
|
||||||
void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
|
void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_window, wxT("GetSize() doesn't work without window") );
|
wxCHECK_RET( m_window, wxT("GetSize() doesn't work without window") );
|
||||||
|
Reference in New Issue
Block a user