[gegl] operations/external/pixbuf: Clean up the prepare implementation



commit 4e40b292cd76e6fce7b5f80799ca364fc0215244
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Feb 23 15:14:23 2017 +0100

    operations/external/pixbuf: Clean up the prepare implementation
    
    It is hard to follow the multiple nested function calls with a ternary
    operator inside the parenthesis.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779135

 operations/external/pixbuf.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/operations/external/pixbuf.c b/operations/external/pixbuf.c
index 6d3f50e..0e05001 100644
--- a/operations/external/pixbuf.c
+++ b/operations/external/pixbuf.c
@@ -55,9 +55,13 @@ get_bounding_box (GeglOperation *operation)
 
 static void prepare (GeglOperation *operation)
 {
+  const Babl *format;
   GeglProperties *o = GEGL_PROPERTIES (operation);
-  gegl_operation_set_format (operation, "output",
-      babl_format(gdk_pixbuf_get_has_alpha(GDK_PIXBUF(o->pixbuf))?"R'G'B'A u8":"R'G'B' u8"));
+  gboolean has_alpha;
+
+  has_alpha = gdk_pixbuf_get_has_alpha (GDK_PIXBUF (o->pixbuf));
+  format = has_alpha ? babl_format ("R'G'B'A u8") : babl_format ("R'G'B' u8");
+  gegl_operation_set_format (operation, "output", format);
 }
 
 static gboolean


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