Fix wxX11 build with --disable-graphics_ctx build option.

Add missing #if wxUSE_CAIRO checks.

Closes https://github.com/wxWidgets/wxWidgets/pull/1472
This commit is contained in:
georgp24
2019-08-07 19:27:00 +02:00
committed by Vadim Zeitlin
parent 5a394deba4
commit 8e41677989
2 changed files with 10 additions and 1 deletions

View File

@@ -107,8 +107,9 @@ public:
WXWindow GetX11Window() const { return m_x11window; }
virtual void ComputeScaleAndOrigin();
#if wxUSE_CAIRO
virtual void* GetCairoContext() const wxOVERRIDE;
#endif
protected:
// implementation

View File

@@ -28,7 +28,9 @@
#include "wx/x11/dcclient.h"
#include "wx/x11/dcmemory.h"
#if wxUSE_CAIRO
#include "cairo-xlib.h"
#endif
#if wxUSE_UNICODE
#include "glib.h"
@@ -345,6 +347,7 @@ void wxWindowDCImpl::SetUpDC()
}
}
#if wxUSE_CAIRO
void* wxWindowDCImpl::GetCairoContext() const
{
int width, height;
@@ -355,6 +358,7 @@ void* wxWindowDCImpl::GetCairoContext() const
cairo_t *cr = cairo_create(surface);
return cr;
}
#endif
void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
{
@@ -1664,6 +1668,7 @@ void wxWindowDCImpl::DoDrawRotatedText(const wxString& text,
wxCoord x, wxCoord y,
double angle)
{
#if wxUSE_CAIRO
// use cairo to draw rotated text
cairo_surface_t *surface = cairo_xlib_surface_create((Display*) m_display,
(Drawable) m_x11window,
@@ -1682,6 +1687,9 @@ void wxWindowDCImpl::DoDrawRotatedText(const wxString& text,
cairo_show_text(cr, text.utf8_str());
cairo_restore(cr);
cairo_destroy(cr);
#else
#warning "Drawing rotated text is not implemented without Cairo"
#endif
}
void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,