[gegl] stretch-contrast: avoid dividing by zero
- From: Michael Henning <mhenning src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] stretch-contrast: avoid dividing by zero
- Date: Sat, 12 Jan 2013 02:58:14 +0000 (UTC)
commit 2404d230dca56fb0126101b13504e5e6f88f8873
Author: Michael Henning <drawoc darkrefraction com>
Date: Fri Dec 21 22:25:30 2012 -0500
stretch-contrast: avoid dividing by zero
operations/common/stretch-contrast.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/operations/common/stretch-contrast.c b/operations/common/stretch-contrast.c
index 140367b..de769f8 100644
--- a/operations/common/stretch-contrast.c
+++ b/operations/common/stretch-contrast.c
@@ -91,6 +91,12 @@ process (GeglOperation *operation,
buffer_get_min_max (input, &min, &max);
diff = max - min;
+ /* Avoid a divide by zero error if the image is a solid color */
+ if (diff == 0.0){
+ gegl_buffer_copy (input, NULL, output, NULL);
+ return TRUE;
+ }
+
gi = gegl_buffer_iterator_new (input, result, 0, babl_format ("RGBA float"),
GEGL_BUFFER_READ, GEGL_ABYSS_NONE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]