summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@gnome.org>2008-01-30 13:08:28 -0600
committerJonathon Jongsma <jjongsma@gnome.org>2008-01-30 13:08:28 -0600
commit5f5319856b2d44f70b72bbec663c65e82c514d6a (patch)
tree311a3154c494eb0d4b70f7105479e9a4a12fb122
parent2f0c46335a37bc5d78fd1667f73c664df134c952 (diff)
* cairomm/xlib_surface.cc:
* cairomm/xlib_surface.h: add new get_xrender_format() function (new in 1.5.8) and add missing static create_with_xrender_format() function * docs/reference/Doxyfile.in: add CAIRO_HAS_XLIB_XRENDER_SURFACE feature so that new xrender API shows up in docs
-rw-r--r--ChangeLog8
-rw-r--r--cairomm/xlib_surface.cc28
-rw-r--r--cairomm/xlib_surface.h50
-rw-r--r--docs/reference/Doxyfile.in1
4 files changed, 85 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 437120d..5afab0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2008-01-30 Jonathon Jongsma <jjongsma@gnome.org>
+ * cairomm/xlib_surface.cc:
+ * cairomm/xlib_surface.h: add new get_xrender_format() function (new in
+ 1.5.8) and add missing static create_with_xrender_format() function
+ * docs/reference/Doxyfile.in: add CAIRO_HAS_XLIB_XRENDER_SURFACE feature so
+ that new xrender API shows up in docs
+
+2008-01-30 Jonathon Jongsma <jjongsma@gnome.org>
+
* configure.in: bump cairo requirement to 1.5.8
* cairomm/context.cc:
* cairomm/context.h: add get_path_extents function, new in 1.5.8
diff --git a/cairomm/xlib_surface.cc b/cairomm/xlib_surface.cc
index 8320521..6d615dd 100644
--- a/cairomm/xlib_surface.cc
+++ b/cairomm/xlib_surface.cc
@@ -130,6 +130,34 @@ int XlibSurface::get_width() const
return w;
}
+#if CAIRO_HAS_XLIB_XRENDER_SURFACE
+Cairo::RefPtr<Cairo::XlibSurface>
+XlibSurface::create_with_xrender_format (Display *dpy,
+ Drawable drawable,
+ Screen *screen,
+ XRenderPictFormat *format,
+ int width,
+ int height)
+{
+ cairo_surface_t* cobject =
+ cairo_xlib_surface_create_with_xrender_format(dpy, drawable,
+ screen, format,
+ width, height);
+ check_status_and_throw_exception(cairo_surface_status(cobject));
+ return RefPtr<XlibSurface>(new XlibSurface(cobject, true /* has reference */));
+}
+
+XRenderPictFormat*
+XlibSurface::get_xrender_format() const
+{
+ XRenderPictFormat*
+ format = cairo_xlib_surface_get_xrender_format(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return format;
+}
+
+#endif // CAIRO_HAS_XLIB_XRENDER_SURFACE
+
#endif // CAIRO_HAS_XLIB_SURFACE
} //namespace Cairo
diff --git a/cairomm/xlib_surface.h b/cairomm/xlib_surface.h
index cddd880..9a304d2 100644
--- a/cairomm/xlib_surface.h
+++ b/cairomm/xlib_surface.h
@@ -26,8 +26,11 @@
// You may include it directly if you need to use this API.
#ifdef CAIRO_HAS_XLIB_SURFACE
-#include <cairo-xlib.h> //Needed for the X11 "Display" struct (which pollutes the namespace because it has no prefix.)
-#endif
+#include <cairo-xlib.h> // Needed for the X11 "Display" struct (which pollutes the namespace because it has no prefix.)
+#ifdef CAIRO_HAS_XLIB_XRENDER_SURFACE
+#include <cairo-xlib-xrender.h> // xrender-specific API
+#endif // CAIRO_HAS_XLIB_XRENDER_SURFACE
+#endif // CAIRO_HAS_XLIB_SURFACE
namespace Cairo
@@ -137,6 +140,49 @@ public:
/** Get the width in pixels of the X Drawable underlying the surface */
int get_width() const;
+#if CAIRO_HAS_XLIB_XRENDER_SURFACE
+ /**
+ * Creates an Xlib surface that draws to the given drawable. The way that
+ * colors are represented in the drawable is specified by the provided picture
+ * format.
+ *
+ * Note: If @drawable is a Window, then the function set_size() must be called
+ * whenever the size of the window changes.
+ *
+ * @param dpy an X Display
+ * @param drawable an X Drawable, (a Pixmap or a Window)
+ * @param screen the X Screen associated with @drawable
+ * @param format the picture format to use for drawing to @drawable. The depth
+ * of @format must match the depth of the drawable.
+ * @param width the current width of @drawable.
+ * @param height the current height of @drawable.
+ *
+ * @return the newly created surface
+ **/
+ static Cairo::RefPtr<Cairo::XlibSurface>
+ create_with_xrender_format (Display *dpy,
+ Drawable drawable,
+ Screen *screen,
+ XRenderPictFormat *format,
+ int width,
+ int height);
+
+ /**
+ * Gets the X Render picture format that @surface uses for rendering with the
+ * X Render extension. If the surface was created by
+ * cairo_xlib_surface_create_with_xrender_format() originally, the return
+ * value is the format passed to that constructor.
+ *
+ * Return value: the XRenderPictFormat* associated with @surface,
+ * or %NULL if the surface is not an xlib surface
+ * or if the X Render extension is not available.
+ *
+ * Since: 1.6
+ **/
+ XRenderPictFormat * get_xrender_format() const;
+
+#endif // CAIRO_HAS_XLIB_XRENDER_SURFACE
+
};
#endif // CAIRO_HAS_XLIB_SURFACE
diff --git a/docs/reference/Doxyfile.in b/docs/reference/Doxyfile.in
index d334480..ce1f8e1 100644
--- a/docs/reference/Doxyfile.in
+++ b/docs/reference/Doxyfile.in
@@ -189,6 +189,7 @@ INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN_IGNORE_THIS \
CAIRO_HAS_XLIB_SURFACE \
+ CAIRO_HAS_XLIB_XRENDER_SURFACE \
CAIRO_HAS_WIN32_SURFACE \
CAIRO_HAS_PDF_SURFACE \
CAIRO_HAS_PS_SURFACE \