Initial support for Cairo on MSW
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@60190 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -281,7 +281,15 @@
|
||||
<set var="UNICOWS_LIB">
|
||||
<if cond="MSLU=='1'">unicows</if>
|
||||
</set>
|
||||
|
||||
<set var="CAIRO_LIB">
|
||||
<if cond="USE_CAIRO=='1'">cairo</if>
|
||||
</set>
|
||||
<set var="CAIRO_LIBDIR">
|
||||
<if cond="USE_CAIRO=='1'">$(DOLLAR)(CAIRO_ROOT)/lib</if>
|
||||
</set>
|
||||
<set var="CAIRO_INCLUDEDIR">
|
||||
<if cond="USE_CAIRO=='1'">$(DOLLAR)(CAIRO_ROOT)/include/cairo</if>
|
||||
</set>
|
||||
<if cond="FORMAT!='autoconf'">
|
||||
<set var="GDIPLUS_LIB">
|
||||
<if cond="USE_GDIPLUS=='1'">gdiplus</if>
|
||||
@@ -485,6 +493,7 @@ $(TAB)$(VC_COMPILER) /EP /nologo "$(DOLLAR)(InputPath)" > "$(SETUPHDIR)\wx\msw\r
|
||||
<if cond="FORMAT!='autoconf'"><define>$(GFXCTX_DEFINE)</define></if>
|
||||
<include cond="FORMAT!='autoconf'">$(SETUPHDIR)</include>
|
||||
<include cond="FORMAT!='autoconf'">$(TOP_SRCDIR)include</include>
|
||||
<include cond="FORMAT!='autoconf'">$(CAIRO_INCLUDEDIR)</include>
|
||||
<lib-path>$(LIBDIRNAME)</lib-path>
|
||||
<if cond="TOOLKIT=='MGL' and FORMAT=='watcom'">
|
||||
<lib-path>$(MGLLIBPATH)</lib-path>
|
||||
@@ -530,6 +539,8 @@ $(TAB)$(VC_COMPILER) /EP /nologo "$(DOLLAR)(InputPath)" > "$(SETUPHDIR)\wx\msw\r
|
||||
<if cond="FORMAT!='autoconf' and PLATFORM_WIN32=='1'">
|
||||
<sys-lib>$(UNICOWS_LIB)</sys-lib>
|
||||
<sys-lib>$(GDIPLUS_LIB)</sys-lib>
|
||||
<sys-lib>$(CAIRO_LIB)</sys-lib>
|
||||
<lib-path>$(CAIRO_LIBDIR)</lib-path>
|
||||
<if cond="FORMAT=='borland'">
|
||||
<sys-lib>ole2w32</sys-lib>
|
||||
</if>
|
||||
|
@@ -266,6 +266,14 @@ Acts according to BUILD by default.
|
||||
</description>
|
||||
</option>
|
||||
|
||||
<option name="USE_CAIRO">
|
||||
<values>0,1</values>
|
||||
<default-value>0</default-value>
|
||||
<description>
|
||||
Enable wxCairoContext for platforms other than Linux/GTK.
|
||||
</description>
|
||||
</option>
|
||||
|
||||
<if cond="FORMAT!='autoconf'">
|
||||
<option name="USE_GDIPLUS">
|
||||
<values>0,1</values>
|
||||
@@ -453,6 +461,7 @@ Set the version of your Mingw installation here.
|
||||
<set var="USE_EXCEPTIONS">1</set>
|
||||
<set var="USE_RTTI">1</set>
|
||||
<set var="USE_THREADS">1</set>
|
||||
<set var="USE_CAIRO">0</set>
|
||||
<if cond="FORMAT!='autoconf'"><set var="USE_GDIPLUS">0</set></if>
|
||||
<set var="DEBUG_INFO">$(DEBUG_INFO_DEFAULT)</set>
|
||||
<set var="DEBUG_FLAG">default</set>
|
||||
|
@@ -666,6 +666,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
src/generic/dragimgg.cpp
|
||||
src/generic/filepickerg.cpp
|
||||
src/generic/fontpickerg.cpp
|
||||
src/generic/graphicc.cpp
|
||||
src/generic/listbkg.cpp
|
||||
src/generic/logg.cpp
|
||||
src/generic/numdlgg.cpp
|
||||
@@ -980,7 +981,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
src/generic/dirdlgg.cpp
|
||||
src/generic/fdrepdlg.cpp
|
||||
src/generic/filedlgg.cpp
|
||||
src/generic/graphicc.cpp
|
||||
src/generic/listctrl.cpp
|
||||
src/generic/msgdlgg.cpp
|
||||
src/generic/prntdlgg.cpp
|
||||
|
@@ -676,6 +676,9 @@ public :
|
||||
|
||||
static wxGraphicsRenderer* GetDefaultRenderer();
|
||||
|
||||
#if wxABI_VERSION >= 20811
|
||||
static wxGraphicsRenderer* GetCairoRenderer();
|
||||
#endif
|
||||
// Context
|
||||
|
||||
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0 ;
|
||||
|
@@ -579,6 +579,18 @@
|
||||
#define wxUSE_GRAPHICS_CONTEXT 0
|
||||
#endif
|
||||
|
||||
// Enable the new wxCairoContext classes for an advanced
|
||||
// 2D drawing API. (Still somewhat experimental)
|
||||
//
|
||||
// Please note that you will need to link with Cairo for this to work.
|
||||
//
|
||||
// Default is 0
|
||||
//
|
||||
// Recommended setting: 1
|
||||
#ifndef wxUSE_CAIRO
|
||||
#define wxUSE_CAIRO 0
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Individual GUI controls
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -552,6 +552,12 @@
|
||||
#define wxUSE_RICHEDIT2 0
|
||||
#endif
|
||||
|
||||
#if !defined(__WIN32__)
|
||||
#define wxUSE_CAIRO 1
|
||||
#else
|
||||
#define wxUSE_CAIRO 0
|
||||
#endif
|
||||
|
||||
#define wxUSE_INKEDIT 0
|
||||
|
||||
#define wxUSE_UNICODE_MSLU 0
|
||||
|
@@ -79,7 +79,15 @@ void wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx )
|
||||
wxGCDC::wxGCDC(const wxWindowDC& dc)
|
||||
{
|
||||
Init();
|
||||
SetGraphicsContext( wxGraphicsContext::Create(dc) );
|
||||
wxGraphicsContext* context;
|
||||
#if wxUSE_CAIRO
|
||||
wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetCairoRenderer();
|
||||
context = renderer->CreateContext(dc);
|
||||
#else
|
||||
context = wxGraphicsContext::Create(dc);
|
||||
#endif
|
||||
|
||||
SetGraphicsContext( context );
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
@@ -39,7 +39,7 @@
|
||||
#include "wx/graphics.h"
|
||||
#include "wx/rawbmp.h"
|
||||
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
#if wxUSE_GRAPHICS_CONTEXT && wxUSE_CAIRO
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -100,6 +100,10 @@ static inline double RadToDeg(double deg)
|
||||
#endif
|
||||
|
||||
#include <cairo.h>
|
||||
#ifdef __WXMSW__
|
||||
#include <cairo-win32.h>
|
||||
#endif
|
||||
|
||||
#ifdef __WXGTK__
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
@@ -324,6 +328,9 @@ class WXDLLIMPEXP_CORE wxCairoContext : public wxGraphicsContext
|
||||
|
||||
public:
|
||||
wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc );
|
||||
#ifdef __WXMSW__
|
||||
wxCairoContext( wxGraphicsRenderer* renderer, HDC context );
|
||||
#endif
|
||||
#ifdef __WXGTK__
|
||||
wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawable );
|
||||
#endif
|
||||
@@ -371,6 +378,9 @@ public:
|
||||
|
||||
private:
|
||||
cairo_t* m_context;
|
||||
#ifdef __WXMSW__
|
||||
cairo_surface_t* m_mswSurface;
|
||||
#endif
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1087,6 +1097,18 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawa
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __WXMSW__
|
||||
wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, HDC handle )
|
||||
: wxGraphicsContext(renderer)
|
||||
{
|
||||
m_mswSurface = cairo_win32_surface_create(handle);
|
||||
m_context = cairo_create(m_mswSurface);
|
||||
PushState();
|
||||
PushState();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, cairo_t *context )
|
||||
: wxGraphicsContext(renderer)
|
||||
{
|
||||
@@ -1117,6 +1139,10 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window)
|
||||
GtkPizza *pizza = GTK_PIZZA( widget );
|
||||
GdkDrawable* drawable = pizza->bin_window;
|
||||
m_context = gdk_cairo_create( drawable ) ;
|
||||
#endif
|
||||
#ifdef __WXMSW__
|
||||
m_mswSurface = cairo_win32_surface_create((HDC)window->GetHandle());
|
||||
m_context = cairo_create(m_mswSurface);
|
||||
#endif
|
||||
PushState();
|
||||
PushState();
|
||||
@@ -1130,6 +1156,10 @@ wxCairoContext::~wxCairoContext()
|
||||
PopState();
|
||||
cairo_destroy(m_context);
|
||||
}
|
||||
#ifdef __WXMSW__
|
||||
if ( m_mswSurface )
|
||||
cairo_surface_destroy(m_mswSurface);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1449,7 +1479,12 @@ wxGraphicsContext * wxCairoRenderer::CreateContext( const wxMemoryDC& dc)
|
||||
|
||||
wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext( void * context )
|
||||
{
|
||||
#if __WXMSW__
|
||||
return new wxCairoContext(this,(HDC)context);
|
||||
#endif
|
||||
#if __WXGTK__
|
||||
return new wxCairoContext(this,(cairo_t*)context);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1571,4 +1606,15 @@ wxGraphicsBitmap wxGraphicsRenderer::CreateBitmap( const wxBitmap& bmp )
|
||||
return wxNullGraphicsBitmap;
|
||||
}
|
||||
|
||||
#endif // wxUSE_GRAPHICS_CONTEXT
|
||||
#endif // wxUSE_GRAPHICS_CONTEXT && wxUSE_CAIRO
|
||||
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
wxGraphicsRenderer* wxGraphicsRenderer::GetCairoRenderer()
|
||||
{
|
||||
#if wxUSE_CAIRO
|
||||
return &gs_cairoGraphicsRenderer;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@@ -26,6 +26,7 @@
|
||||
# public symbols added in 2.8.10 (please keep in alphabetical order):
|
||||
@WX_VERSION_TAG@.11 {
|
||||
*wxDC*SetDeviceClippingRegion*;
|
||||
*wxGraphicsContext*GetCairoRenderer*;
|
||||
*wxShowEvent*IsShown*;
|
||||
*wxIconizeEvent*IsIconized*;
|
||||
*wxXmlNode*Attribute*;
|
||||
|
Reference in New Issue
Block a user