summaryrefslogtreecommitdiff
path: root/gdk/gdkcairo.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2009-09-01 17:05:50 +0200
committerAlexander Larsson <alexl@redhat.com>2009-09-01 17:06:41 +0200
commit45956aea21e9c8a279f096a0536826a5d14a9c82 (patch)
tree87a6ad67941bea73d5b635463f9a014252027aaf /gdk/gdkcairo.c
parentf97a33ad9c6936b1ce6c5d4e937a17cc392b95b3 (diff)
downloadgtk+-45956aea21e9c8a279f096a0536826a5d14a9c82.tar.gz
Add gdk_cairo_reset_clip
This is required to get back the original drawable clip due to non-native windows on a cairo_t.
Diffstat (limited to 'gdk/gdkcairo.c')
-rw-r--r--gdk/gdkcairo.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdk/gdkcairo.c b/gdk/gdkcairo.c
index 9d3ce2d649..ef8ec25627 100644
--- a/gdk/gdkcairo.c
+++ b/gdk/gdkcairo.c
@@ -60,6 +60,34 @@ gdk_cairo_create (GdkDrawable *drawable)
}
/**
+ * gdk_cairo_reset_clip:
+ * @cr: a #cairo_t
+ * @drawable: a #GdkDrawable
+ *
+ * Resets the clip region for a Cairo context created by gdk_cairo_create().
+ *
+ * This resets the clip region to the "empty" state for the given drawable.
+ * This is required for non-native windows since a direct call to
+ * cairo_reset_clip() would unset the clip region inherited from the
+ * drawable (i.e. the window clip region), and thus let you e.g.
+ * draw outside your window.
+ *
+ * This is rarely needed though, since most code just create a new cairo_t
+ * using gdk_cairo_create() each time they want to draw something.
+ *
+ * Since: 2.18
+ **/
+void
+gdk_cairo_reset_clip (cairo_t *cr,
+ GdkDrawable *drawable)
+{
+ cairo_reset_clip (cr);
+
+ if (GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip)
+ GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip (drawable, cr);
+}
+
+/**
* gdk_cairo_set_source_color:
* @cr: a #cairo_t
* @color: a #GdkColor