[cairo] [PATCH 67/71] add cairo_region_get_reference_count()

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Mon Apr 17 16:57:46 UTC 2017


---
 src/cairo-region.c | 20 ++++++++++++++++++++
 src/cairo.h        |  3 +++
 2 files changed, 23 insertions(+)

diff --git a/src/cairo-region.c b/src/cairo-region.c
index c1d35e174..0aba92715 100644
--- a/src/cairo-region.c
+++ b/src/cairo-region.c
@@ -941,3 +941,23 @@ cairo_region_equal (const cairo_region_t *a,
     return pixman_region32_equal (CONST_CAST &a->rgn, CONST_CAST &b->rgn);
 }
 slim_hidden_def (cairo_region_equal);
+
+/**
+ * cairo_region_get_reference_count:
+ * @surface: a #cairo_region_t
+ *
+ * Returns the current reference count of @region.
+ *
+ * Return value: the current reference count of @region.  If the
+ * object is a nil object, 0 will be returned.
+ *
+ **/
+unsigned int
+cairo_region_get_reference_count (cairo_region_t *region)
+{
+    if (region == NULL ||
+            CAIRO_REFERENCE_COUNT_IS_INVALID (&region->ref_count))
+        return 0;
+
+    return CAIRO_REFERENCE_COUNT_GET_VALUE (&region->ref_count);
+}
diff --git a/src/cairo.h b/src/cairo.h
index 33270d1ea..7e7ba5eec 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -3090,6 +3090,9 @@ cairo_region_reference (cairo_region_t *region);
 cairo_public void
 cairo_region_destroy (cairo_region_t *region);
 
+cairo_public unsigned int
+cairo_region_get_reference_count (cairo_region_t *region);
+
 cairo_public cairo_bool_t
 cairo_region_equal (const cairo_region_t *a, const cairo_region_t *b);
 
-- 
2.11.0.rc0.7.gbe5a750



More information about the cairo mailing list