[gegl] Added gegl_rectangle_is_empty function
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Added gegl_rectangle_is_empty function
- Date: Thu, 8 Jul 2010 15:07:03 +0000 (UTC)
commit 2e789d36584daa09bf5f3968f1adb93a922a7a93
Author: Danny Robson <danny blubinc net>
Date: Sat Jun 5 18:09:19 2010 +1000
Added gegl_rectangle_is_empty function
gegl/gegl-utils.c | 13 +++++++++++++
gegl/gegl-utils.h | 10 ++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gegl/gegl-utils.c b/gegl/gegl-utils.c
index e80c955..8df8914 100644
--- a/gegl/gegl-utils.c
+++ b/gegl/gegl-utils.c
@@ -127,6 +127,8 @@
gegl_rectangle_contains (const GeglRectangle *r,
const GeglRectangle *s)
{
+ g_return_val_if_fail (r && s, FALSE);
+
if (s->x >= r->x &&
s->y >= r->y &&
(s->x + s->width) <= (r->x + r->width) &&
@@ -140,6 +142,8 @@
gegl_rectangle_equal (const GeglRectangle *r,
const GeglRectangle *s)
{
+ g_return_val_if_fail (r && s, FALSE);
+
if (r->x == s->x &&
r->y == s->y &&
r->width == s->width &&
@@ -156,6 +160,8 @@
gint w,
gint h)
{
+ g_return_val_if_fail (r, FALSE);
+
if (r->x == x &&
r->y == y &&
r->width == w &&
@@ -165,6 +171,13 @@
return FALSE;
}
+ gboolean
+ gegl_rectangle_is_empty (const GeglRectangle *r)
+ {
+ g_return_val_if_fail (r != NULL, FALSE);
+ return r->width == 0 && r->height == 0;
+ }
+
static GeglRectangle *
gegl_rectangle_dup (const GeglRectangle *rectangle)
{
diff --git a/gegl/gegl-utils.h b/gegl/gegl-utils.h
index 10c038c..3a56b99 100644
--- a/gegl/gegl-utils.h
+++ b/gegl/gegl-utils.h
@@ -88,6 +88,16 @@ gboolean gegl_rectangle_equal_coords (const GeglRectangle *rectangle,
gint height);
/**
+ * gegl_rectangle_is_empty:
+ * @rectangle: a #GeglRectangle
+ *
+ * Check if a rectangle has zero area.
+ *
+ * Returns TRUE if @rectangle height and width are both zero.
+ */
+gboolean gegl_rectangle_is_empty (const GeglRectangle *rectangle);
+
+/**
* gegl_rectangle_copy:
* @destination: a #GeglRectangle
* @source: a #GeglRectangle
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]