diff options
author | Benjamin Reed <rangerrick@befunk.com> | 2008-04-25 13:46:06 -0400 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@gnome.org> | 2008-04-25 23:28:04 -0500 |
commit | 76caea26870b2c4c9b503c3748f3a810be43e907 (patch) | |
tree | 8bc393bc2e3fa9e63b01e948155992cb0048b537 | |
parent | ea1d7b9d61cf353a19901f9d2bc787d8f58d1771 (diff) |
separate calls to possibly-conflicting surface calls
On Mac OS X, if you have both the xlib and quartz backends
enabled in cairo, cairomm fails to build with conflicting headers:
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -DPNG_NO_MMX_CODE -I/sw/lib/freetype219/include/freetype2 -I/sw/lib/freetype219/include -I/sw/lib/fontconfig2/include -I/sw/include/pixman-1 -I/sw/include/libpng12 -I/sw/include -I/sw/include/cairo -I/usr/X11R6/include -I/usr/X11/include -I/sw/lib/freetype219/include -I/sw/lib/freetype219/include/freetype2 -I/sw/lib/fontconfig2/include -I/sw/include -I/usr/X11R6/include -g -O2 -c -o context.lo context.cc
g++ -DHAVE_CONFIG_H -I. -I.. -DPNG_NO_MMX_CODE -I/sw/lib/freetype219/include/freetype2 -I/sw/lib/freetype219/include -I/sw/lib/fontconfig2/include -I/sw/include/pixman-1 -I/sw/include/libpng12 -I/sw/include -I/sw/include/cairo -I/usr/X11R6/include -I/usr/X11/include -I/sw/lib/freetype219/include -I/sw/lib/freetype219/include/freetype2 -I/sw/lib/fontconfig2/include -I/sw/include -I/usr/X11R6/include -g -O2 -c context.cc -fno-common -DPIC -o .libs/context.o
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:255: error: declaration does not declare anything
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/QuickdrawTypes.h:264: error: using typedef-name 'Cursor' after 'struct'
/usr/X11R6/include/X11/X.h:108: error: 'Cursor' has a previous declaration here
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/QuickdrawTypes.h:269: error: using typedef-name 'Cursor' after 'struct'
/usr/X11R6/include/X11/X.h:108: error: 'Cursor' has a previous declaration here
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/QuickdrawTypes.h:269: error: invalid type in declaration before ';' token
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/QuickdrawTypes.h:269: error: conflicting declaration 'typedef int Cursor'
/usr/X11R6/include/X11/X.h:108: error: 'Cursor' has a previous declaration as 'typedef XID Cursor'
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/QuickdrawTypes.h:296: error: using typedef-name 'Picture' after 'struct'
/usr/X11R6/include/X11/extensions/render.h:31: error: 'Picture' has a previous declaration here
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/QuickdrawTypes.h:300: error: using typedef-name 'Picture' after 'struct'
/usr/X11R6/include/X11/extensions/render.h:31: error: 'Picture' has a previous declaration here
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/QuickdrawTypes.h:300: error: invalid type in declaration before ';' token
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/QuickdrawTypes.h:300: error: conflicting declaration 'typedef int Picture'
/usr/X11R6/include/X11/extensions/render.h:31: error: 'Picture' has a previous declaration as 'typedef XID Picture'
This patch fixes this by separating out the calls in the get_surface_wrapper
call to individual .cc files which are then compiled with only the headers
they need.
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | cairomm/Makefile.am | 4 | ||||
-rw-r--r-- | cairomm/context.cc | 12 | ||||
-rw-r--r-- | cairomm/context.h | 4 | ||||
-rw-r--r-- | cairomm/context_private.h | 41 | ||||
-rw-r--r-- | cairomm/context_surface_quartz.cc | 42 | ||||
-rw-r--r-- | cairomm/context_surface_win32.cc | 42 | ||||
-rw-r--r-- | cairomm/context_surface_xlib.cc | 42 |
8 files changed, 183 insertions, 8 deletions
@@ -33,3 +33,7 @@ examples/ps-surface/example_ps_file examples/svg-surface/example_svg_file examples/text-rotate/text_rotate tests/test-context +cairomm/cairommconfig.h* +cairomm/stamp-* +m4/libtool.m4 +m4/lt*.m4 diff --git a/cairomm/Makefile.am b/cairomm/Makefile.am index ad2b535..cb476cc 100644 --- a/cairomm/Makefile.am +++ b/cairomm/Makefile.am @@ -3,9 +3,9 @@ SUBDIRS = INCLUDES = -I$(top_srcdir) @CAIROMM_CFLAGS@ h_sources_public = cairomm.h context.h enums.h fontface.h fontoptions.h path.h pattern.h quartz_surface.h surface.h xlib_surface.h win32_surface.h exception.h refptr.h scaledfont.h cairommconfig.h -h_sources_private = private.h +h_sources_private = private.h context_private.h cc_sources = context.cc fontface.cc fontoptions.cc path.cc pattern.cc quartz_surface.cc surface.cc xlib_surface.cc win32_surface.cc exception.cc scaledfont.cc -cc_sources_private = private.cc +cc_sources_private = private.cc context_surface_quartz.cc context_surface_win32.cc context_surface_xlib.cc # Support for DLL on cygwin/mingw using libtool > 1.4 if PLATFORM_WIN32 diff --git a/cairomm/context.cc b/cairomm/context.cc index 8964dd5..f5f17f6 100644 --- a/cairomm/context.cc +++ b/cairomm/context.cc @@ -18,11 +18,9 @@ #include <cairomm/cairommconfig.h> #include <cairomm/context.h> +#include <cairomm/context_private.h> #include <cairomm/private.h> #include <cairomm/surface.h> -#include <cairomm/win32_surface.h> -#include <cairomm/xlib_surface.h> -#include <cairomm/quartz_surface.h> /* M_PI is defined in math.h in the case of Microsoft Visual C++ */ #if defined(_MSC_VER) @@ -34,6 +32,8 @@ # include <math.h> #endif +using namespace Cairo::Private; + namespace Cairo { @@ -684,7 +684,7 @@ RefPtr<Surface> get_surface_wrapper (cairo_surface_t* surface) #endif #if CAIRO_HAS_XLIB_SURFACE case CAIRO_SURFACE_TYPE_XLIB: - return RefPtr<XlibSurface>(new XlibSurface(surface, false /* does not have reference */)); + return wrap_surface_xlib(surface); break; #endif #if CAIRO_HAS_GLITZ_SURFACE @@ -694,12 +694,12 @@ RefPtr<Surface> get_surface_wrapper (cairo_surface_t* surface) #endif #if CAIRO_HAS_QUARTZ_SURFACE case CAIRO_SURFACE_TYPE_QUARTZ: - return RefPtr<QuartzSurface>(new QuartzSurface(surface, false /* does not have reference */)); + return wrap_surface_quartz(surface); break; #endif #if CAIRO_HAS_WIN32_SURFACE case CAIRO_SURFACE_TYPE_WIN32: - return RefPtr<Win32Surface>(new Win32Surface(surface, false /* does not have reference */)); + return wrap_surface_win32(surface); break; #endif #if CAIRO_HAS_SVG_SURFACE diff --git a/cairomm/context.h b/cairomm/context.h index 711309e..ceac161 100644 --- a/cairomm/context.h +++ b/cairomm/context.h @@ -1003,6 +1003,10 @@ protected: cobject* m_cobject; }; + RefPtr<Surface> get_surface_quartz(cairo_surface_t*); + RefPtr<Surface> get_surface_win32(cairo_surface_t*); + RefPtr<Surface> get_surface_xlib(cairo_surface_t*); + } // namespace Cairo #endif //__CAIROMM_CONTEXT_H diff --git a/cairomm/context_private.h b/cairomm/context_private.h new file mode 100644 index 0000000..3081dca --- /dev/null +++ b/cairomm/context_private.h @@ -0,0 +1,41 @@ +/* Copyright (C) 2008 The cairomm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#ifndef __CAIROMM_CONTEXT_PRIVATE_H +#define __CAIROMM_CONTEXT_PRIVATE_H + +#include <cairomm/refptr.h> +#include <cairomm/surface.h> + +namespace Cairo +{ + +namespace Private +{ + +RefPtr<Surface> wrap_surface_quartz(cairo_surface_t*); +RefPtr<Surface> wrap_surface_win32(cairo_surface_t*); +RefPtr<Surface> wrap_surface_xlib(cairo_surface_t*); + +} // namespace Private + +} // namespace Cairo + +#endif // __CAIROMM_CONTEXT_PRIVATE_H + +// vim: ts=2 sw=2 et diff --git a/cairomm/context_surface_quartz.cc b/cairomm/context_surface_quartz.cc new file mode 100644 index 0000000..540dca3 --- /dev/null +++ b/cairomm/context_surface_quartz.cc @@ -0,0 +1,42 @@ +/* Copyright (C) 2008 The cairomm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include <cairomm/cairommconfig.h> +#include <cairomm/context_private.h> +#include <cairomm/quartz_surface.h> + +namespace Cairo +{ + +namespace Private +{ + +RefPtr<Surface> wrap_surface_quartz(cairo_surface_t* surface) +{ +#if CAIRO_HAS_QUARTZ_SURFACE + return RefPtr<QuartzSurface>(new QuartzSurface(surface, false /* does not have reference */)); +#else + return RefPtr<Surface>(new Surface(surface, false /* does not have reference */)); +#endif +} + +} // namespace Private + +} // namespace Cairo + +// vim: ts=2 sw=2 et diff --git a/cairomm/context_surface_win32.cc b/cairomm/context_surface_win32.cc new file mode 100644 index 0000000..61837bd --- /dev/null +++ b/cairomm/context_surface_win32.cc @@ -0,0 +1,42 @@ +/* Copyright (C) 2008 The cairomm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include <cairomm/cairommconfig.h> +#include <cairomm/context_private.h> +#include <cairomm/win32_surface.h> + +namespace Cairo +{ + +namespace Private +{ + +RefPtr<Surface> wrap_surface_win32(cairo_surface_t* surface) +{ +#if CAIRO_HAS_WIN32_SURFACE + return RefPtr<Win32Surface>(new Win32Surface(surface, false /* does not have reference */)); +#else + return RefPtr<Surface>(new Surface(surface, false /* does not have reference */)); +#endif +} + +} // namespace Private + +} // namespace Cairo + +// vim: ts=2 sw=2 et diff --git a/cairomm/context_surface_xlib.cc b/cairomm/context_surface_xlib.cc new file mode 100644 index 0000000..0f57bc7 --- /dev/null +++ b/cairomm/context_surface_xlib.cc @@ -0,0 +1,42 @@ +/* Copyright (C) 2008 The cairomm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include <cairomm/cairommconfig.h> +#include <cairomm/context_private.h> +#include <cairomm/xlib_surface.h> + +namespace Cairo +{ + +namespace Private +{ + +RefPtr<Surface> wrap_surface_xlib(cairo_surface_t* surface) +{ +#if CAIRO_HAS_WIN32_SURFACE + return RefPtr<XlibSurface>(new XlibSurface(surface, false /* does not have reference */)); +#else + return RefPtr<Surface>(new Surface(surface, false /* does not have reference */)); +#endif +} + +} // namespace Private + +} // namespace Cairo + +// vim: ts=2 sw=2 et |