From 75756616f6ca8316595efc6be2655a3ef341091a Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Thu, 13 Feb 2014 02:10:08 +0200 Subject: [PATCH 4/7] Wrap XCB device and XCB surface APIs --- cairomm/context.cc | 9 ++- cairomm/filelist.am | 4 ++ cairomm/surface.cc | 6 ++ cairomm/xcb_device.cc | 64 ++++++++++++++++++ cairomm/xcb_device.h | 112 ++++++++++++++++++++++++++++++ cairomm/xcb_surface.cc | 86 +++++++++++++++++++++++ cairomm/xcb_surface.h | 180 +++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 460 insertions(+), 1 deletion(-) create mode 100644 cairomm/xcb_device.cc create mode 100644 cairomm/xcb_device.h create mode 100644 cairomm/xcb_surface.cc create mode 100644 cairomm/xcb_surface.h diff --git a/cairomm/context.cc b/cairomm/context.cc index bf70ef4..c9d1411 100644 --- a/cairomm/context.cc +++ b/cairomm/context.cc @@ -28,6 +28,7 @@ #include #include #include +#include /* M_PI is defined in math.h in the case of Microsoft Visual C++ */ #if defined(_MSC_VER) @@ -852,11 +853,17 @@ RefPtr get_surface_wrapper (cairo_surface_t* surface) return RefPtr(new SvgSurface(surface, false /* does not have reference */)); break; #endif +#if CAIRO_HAS_XCB_SURFACE + case CAIRO_SURFACE_TYPE_XCB: + return RefPtr(new XcbSurface(surface, false /* does not have reference */)); + break; +#endif + // the following surfaces are not directly supported in cairomm yet case CAIRO_SURFACE_TYPE_DIRECTFB: case CAIRO_SURFACE_TYPE_OS2: case CAIRO_SURFACE_TYPE_BEOS: - case CAIRO_SURFACE_TYPE_XCB: + default: return RefPtr(new Surface(surface, false /* does not have reference */)); } diff --git a/cairomm/filelist.am b/cairomm/filelist.am index ab26483..adbe3c5 100644 --- a/cairomm/filelist.am +++ b/cairomm/filelist.am @@ -22,6 +22,8 @@ cairomm_cc = \ surface.cc \ win32_font.cc \ win32_surface.cc \ + xcb_device.cc \ + xcb_surface.cc \ xlib_surface.cc cairomm_public_h = \ @@ -45,6 +47,8 @@ cairomm_public_h = \ types.h \ win32_font.h \ win32_surface.h \ + xcb_device.h \ + xcb_surface.h \ xlib_surface.h cairomm_private_h = \ diff --git a/cairomm/surface.cc b/cairomm/surface.cc index 5697295..89ddade 100644 --- a/cairomm/surface.cc +++ b/cairomm/surface.cc @@ -18,6 +18,7 @@ #include #include +#include #include namespace Cairo @@ -255,6 +256,11 @@ RefPtr Surface::get_device() return RefPtr