[gegl] Clean up get_bounding_box for composer/composer3
- From: Daniel Sabo <daniels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Clean up get_bounding_box for composer/composer3
- Date: Mon, 10 Feb 2014 19:07:11 +0000 (UTC)
commit 91ac0e40a676683a2e7ed16c37c90b8db26c35d4
Author: Daniel Sabo <DanielSabo gmail com>
Date: Mon Feb 10 11:02:32 2014 -0800
Clean up get_bounding_box for composer/composer3
It is safe to write to one of the inputs of gegl_rectangle_bounding_box
so the deep if chain is unnecessary.
gegl/operation/gegl-operation-composer.c | 18 ++++-----------
gegl/operation/gegl-operation-composer3.c | 34 +++++++---------------------
2 files changed, 14 insertions(+), 38 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-composer.c b/gegl/operation/gegl-operation-composer.c
index 766edf4..739e914 100644
--- a/gegl/operation/gegl-operation-composer.c
+++ b/gegl/operation/gegl-operation-composer.c
@@ -147,20 +147,12 @@ get_bounding_box (GeglOperation *self)
GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (self, "input");
GeglRectangle *aux_rect = gegl_operation_source_get_bounding_box (self, "aux");
- if (!in_rect)
- {
- if (aux_rect)
- return *aux_rect;
- return result;
- }
+ if (in_rect)
+ result = *in_rect;
+
if (aux_rect)
- {
- gegl_rectangle_bounding_box (&result, in_rect, aux_rect);
- }
- else
- {
- return *in_rect;
- }
+ gegl_rectangle_bounding_box (&result, &result, aux_rect);
+
return result;
}
diff --git a/gegl/operation/gegl-operation-composer3.c b/gegl/operation/gegl-operation-composer3.c
index 0fbf64b..339c813 100644
--- a/gegl/operation/gegl-operation-composer3.c
+++ b/gegl/operation/gegl-operation-composer3.c
@@ -163,31 +163,15 @@ get_bounding_box (GeglOperation *self)
GeglRectangle *aux_rect = gegl_operation_source_get_bounding_box (self, "aux");
GeglRectangle *aux2_rect = gegl_operation_source_get_bounding_box (self, "aux2");
- if (!in_rect)
- if (!aux_rect)
- if (!aux2_rect)
- return result;
- else
- return *aux2_rect;
- else
- if (!aux2_rect)
- return *aux_rect;
- else
- gegl_rectangle_bounding_box (&result, aux_rect, aux2_rect);
- else
- if (!aux_rect)
- if (!aux2_rect)
- return *in_rect;
- else
- gegl_rectangle_bounding_box (&result, in_rect, aux2_rect);
- else
- if (!aux2_rect)
- gegl_rectangle_bounding_box (&result, in_rect, aux_rect);
- else
- {
- gegl_rectangle_bounding_box (&result, in_rect, aux_rect);
- gegl_rectangle_bounding_box (&result, &result, aux2_rect);
- }
+ if (in_rect)
+ result = *in_rect;
+
+ if (aux_rect)
+ gegl_rectangle_bounding_box (&result, &result, aux_rect);
+
+ if (aux2_rect)
+ gegl_rectangle_bounding_box (&result, &result, aux2_rect);
+
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]