#pragma hdrstop
#endif
-#include "wx/cairo.h"
+#if wxUSE_GRAPHICS_CONTEXT
+
#include "wx/graphics.h"
-#if wxUSE_GRAPHICS_CONTEXT && wxUSE_CAIRO
+#if wxUSE_CAIRO
+
+#include "wx/cairo.h"
#ifndef WX_PRECOMP
#include "wx/bitmap.h"
{
wxCHECK_RET( bmp.IsOk(), wxT("Invalid bitmap in wxCairoContext::DrawBitmap"));
- int bw = bmp.GetWidth();
- int bh = bmp.GetHeight();
+ int bw = m_width = bmp.GetWidth();
+ int bh = m_height = bmp.GetHeight();
wxBitmap bmpSource = bmp; // we need a non-const instance
m_buffer = new unsigned char[bw*bh*4];
wxUint32* data = (wxUint32*)m_buffer;
extern wxGraphicsRenderer* gCairoRenderer;
wxGraphicsRenderer* gCairoRenderer = &gs_cairoGraphicsRenderer;
-#ifdef __WXGTK__
-wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer()
-{
- return &gs_cairoGraphicsRenderer;
-}
-#endif
-
wxGraphicsContext * wxCairoRenderer::CreateContext( const wxWindowDC& dc)
{
return new wxCairoContext(this,dc);
wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext( void * context )
{
-#if __WXMSW__
+#ifdef __WXMSW__
return new wxCairoContext(this,(HDC)context);
#endif
-#if __WXGTK__
+#ifdef __WXGTK__
return new wxCairoContext(this,(cairo_t*)context);
#endif
}
return wxNullGraphicsBitmap;
}
-#endif // wxUSE_GRAPHICS_CONTEXT && wxUSE_CAIRO
-
-#if wxUSE_GRAPHICS_CONTEXT
wxGraphicsRenderer* wxGraphicsRenderer::GetCairoRenderer()
{
-#if wxUSE_CAIRO
return &gs_cairoGraphicsRenderer;
-#else
+}
+
+#else // !wxUSE_CAIRO
+
+wxGraphicsRenderer* wxGraphicsRenderer::GetCairoRenderer()
+{
return NULL;
-#endif
}
-#endif
+
+#endif // wxUSE_CAIRO/!wxUSE_CAIRO
+
+// MSW and OS X have their own native default renderers, but the other ports
+// use Cairo by default
+#if !(defined(__WXMSW__) || defined(__WXOSX__))
+wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer()
+{
+ return GetCairoRenderer();
+}
+#endif // !(__WXMSW__ || __WXOSX__)
+
+#endif // wxUSE_GRAPHICS_CONTEXT