[gegl] over: use gegl_babl_variant in prepare



commit 712b902c02b78c4358902ec4957b301bf2461fda
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Oct 31 18:40:53 2018 +0100

    over: use gegl_babl_variant in prepare

 operations/common/over.c | 41 +++--------------------------------------
 1 file changed, 3 insertions(+), 38 deletions(-)
---
diff --git a/operations/common/over.c b/operations/common/over.c
index c082bca8c..779cf8910 100644
--- a/operations/common/over.c
+++ b/operations/common/over.c
@@ -52,10 +52,7 @@ static void opencl_prepare (GeglOperation *operation)
 
 static void prepare (GeglOperation *operation)
 {
-  int use_srgb = GEGL_PROPERTIES (operation)->srgb?1:0;
   const Babl *format = gegl_operation_get_source_format (operation, "input");
-  const Babl *space = NULL;
-  const Babl *model = NULL;
 
   if (gegl_operation_use_opencl (operation))
   {
@@ -65,49 +62,17 @@ static void prepare (GeglOperation *operation)
 
   if (!format)
     format = gegl_operation_get_source_format (operation, "aux");
-  if (format)
-  {
-    model = babl_format_get_model (format);
-  }
 
-  if (babl_model_is (model, "Y") ||
-      babl_model_is (model, "Y'") ||
-      babl_model_is (model, "Y~") ||
-      babl_model_is (model, "YA") ||
-      babl_model_is (model, "Y'A") ||
-      babl_model_is (model, "Y~A") ||
-      babl_model_is (model, "YaA") ||
-      babl_model_is (model, "Y'aA"))
-  {
-    format  = babl_format_with_space (use_srgb?"Y~aA float":"YaA float", space);
-  }
-#if 0 // just treat as else
-  else if (babl_model_is (model, "RGB") ||
-           babl_model_is (model, "R'G'B'") ||
-           babl_model_is (model, "R~G~B~") ||
-           babl_model_is (model, "RGBA")    ||
-           babl_model_is (model, "RGB")     ||
-           babl_model_is (model, "R'G'B'A") ||
-           babl_model_is (model, "R'G'B'")  ||
-           babl_model_is (model, "R~G~B~A") ||
-           babl_model_is (model, "R~G~B~")  ||
-           babl_model_is (model, "RaGaBaA") ||
-           babl_model_is (model, "R'aG'aB'aA"))
-  {
-    format  = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
-  }
-#endif
+  if(GEGL_PROPERTIES (operation)->srgb)
+    format = gegl_babl_variant (format, GEGL_BABL_VARIANT_PERCEPTUAL_PREMULTIPLIED);
   else
-  {
-    format  = babl_format_with_space (use_srgb?"R~aG~aB~aA float":"RaGaBaA float", space);
-  }
+    format = gegl_babl_variant (format, GEGL_BABL_VARIANT_LINEAR_PREMULTIPLIED);
 
   gegl_operation_set_format (operation, "input",  format);
   gegl_operation_set_format (operation, "aux",    format);
   gegl_operation_set_format (operation, "output", format);
 }
 
-
 static gboolean
 process (GeglOperation       *op,
          void                *in_buf,


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