[gegl/soc-2013-opecl-ops] buffer: unify get_format paths



commit 94eb31e5f274f7c4e110fbdb59ff66a7a7d8cf5a
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Wed Sep 11 22:19:55 2013 -0700

    buffer: unify get_format paths

 gegl/buffer/gegl-buffer.c |   34 ++++++----------------------------
 1 files changed, 6 insertions(+), 28 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer.c b/gegl/buffer/gegl-buffer.c
index 07476d7..1107eee 100644
--- a/gegl/buffer/gegl-buffer.c
+++ b/gegl/buffer/gegl-buffer.c
@@ -107,9 +107,6 @@ enum
   LAST_SIGNAL
 };
 
-static const Babl * gegl_buffer_internal_get_format (GeglBuffer *buffer);
-
-
 guint gegl_buffer_signals[LAST_SIGNAL] = { 0 };
 
 
@@ -176,21 +173,7 @@ gegl_buffer_get_property (GObject    *gobject,
         break;
 
       case PROP_FORMAT:
-        /* might already be set the first time, if it was set during
-         * construction, we're caching the value in the buffer itself,
-         * since it will never change.
-         */
-
-        {
-          const Babl *format = buffer->soft_format;
-
-          if (format == NULL)
-            format = buffer->format;
-          if (format == NULL)
-            format = gegl_buffer_internal_get_format (buffer);
-
-          g_value_set_pointer (value, (gpointer) format);
-        }
+        g_value_set_pointer (value, (gpointer) gegl_buffer_get_format (buffer));
         break;
 
       case PROP_BACKEND:
@@ -1177,19 +1160,14 @@ gegl_buffer_create_sub_buffer (GeglBuffer          *buffer,
                        NULL);
 }
 
-static const Babl *
-gegl_buffer_internal_get_format (GeglBuffer *buffer)
-{
-  g_assert (buffer);
-  if (buffer->format != NULL)
-    return buffer->format;
-  return gegl_tile_backend_get_format (gegl_buffer_backend (buffer));
-}
-
 const Babl *
 gegl_buffer_get_format (GeglBuffer *buffer)
 {
-  return buffer ? buffer->format : NULL;
+  g_return_val_if_fail (buffer, NULL);
+
+  if (buffer->soft_format)
+    return buffer->soft_format;
+  return buffer->format;
 }
 
 const Babl *


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