[gnome-photos] Always set input and output formats



commit 5abcaffae8c19689a2ea8cbed2bfc4493c18fc8e
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Oct 30 12:17:45 2017 +0100

    Always set input and output formats
    
    Some operations never set their output parameters during "prepare".
    For example, various source operations because the output is only
    known during "process". Support consuming data from such operations by
    defaulting to the largest supported format.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789642

 src/photos-operation-insta-curve.c |   13 +++++++++----
 src/photos-operation-saturation.c  |    7 ++++++-
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-operation-insta-curve.c b/src/photos-operation-insta-curve.c
index c927c5e..f37caee 100644
--- a/src/photos-operation-insta-curve.c
+++ b/src/photos-operation-insta-curve.c
@@ -879,10 +879,15 @@ photos_operation_insta_curve_prepare (GeglOperation *operation)
 
   input_format = gegl_operation_get_source_format (operation, "input");
   if (input_format == NULL)
-    return;
-
-  has_alpha = babl_format_has_alpha (input_format);
-  type = babl_format_get_type (input_format, 0);
+    {
+      has_alpha = TRUE;
+      type = babl_type ("float");
+    }
+  else
+    {
+      has_alpha = babl_format_has_alpha (input_format);
+      type = babl_format_get_type (input_format, 0);
+    }
 
   format_alpha_float = babl_format ("R'G'B'A float");
   format_alpha_u8 = babl_format ("R'G'B'A u8");
diff --git a/src/photos-operation-saturation.c b/src/photos-operation-saturation.c
index a1f2d67..6290ca8 100644
--- a/src/photos-operation-saturation.c
+++ b/src/photos-operation-saturation.c
@@ -159,7 +159,11 @@ photos_operation_saturation_prepare (GeglOperation *operation)
 
   input_format = gegl_operation_get_source_format (operation, "input");
   if (input_format == NULL)
-    return;
+    {
+      format = babl_format ("CIE Lab alpha float");
+      self->process = photos_operation_saturation_process_lab_alpha;
+      goto out;
+    }
 
   model_input = babl_format_get_model (input_format);
 
@@ -192,6 +196,7 @@ photos_operation_saturation_prepare (GeglOperation *operation)
         }
     }
 
+ out:
   gegl_operation_set_format (operation, "input", format);
   gegl_operation_set_format (operation, "output", format);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]