[gimp] app: add member GimpDisplayShell.filter_format



commit 460948e068b4c2dd7d0bd22a66b6a9bcfea1ffed
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jun 2 00:01:28 2015 +0200

    app: add member GimpDisplayShell.filter_format
    
    and use it where we used to hardcode "R'G'B'A float".

 app/display/gimpdisplayshell-profile.c |    2 +-
 app/display/gimpdisplayshell-render.c  |   11 +++++------
 app/display/gimpdisplayshell.c         |    2 ++
 app/display/gimpdisplayshell.h         |    1 +
 4 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-profile.c b/app/display/gimpdisplayshell-profile.c
index ad070ee..5b377d1 100644
--- a/app/display/gimpdisplayshell-profile.c
+++ b/app/display/gimpdisplayshell-profile.c
@@ -91,7 +91,7 @@ gimp_display_shell_profile_update (GimpDisplayShell *shell)
   src_format = gimp_pickable_get_format (GIMP_PICKABLE (image));
 
   if (gimp_display_shell_has_filter (shell))
-    dest_format = babl_format ("R'G'B'A float");
+    dest_format = shell->filter_format;
   else
     dest_format = babl_format ("R'G'B'A u8");
 
diff --git a/app/display/gimpdisplayshell-render.c b/app/display/gimpdisplayshell-render.c
index d8f8f1b..9936876 100644
--- a/app/display/gimpdisplayshell-render.c
+++ b/app/display/gimpdisplayshell-render.c
@@ -63,7 +63,6 @@ gimp_display_shell_render (GimpDisplayShell *shell,
 #ifdef USE_NODE_BLIT
   GeglNode        *node;
 #endif
-  const Babl      *filter_format = babl_format ("R'G'B'A float");
   gdouble          scale_x       = 1.0;
   gdouble          scale_y       = 1.0;
   gdouble          buffer_scale  = 1.0;
@@ -177,14 +176,14 @@ gimp_display_shell_render (GimpDisplayShell *shell,
           gint h = GIMP_DISPLAY_RENDER_BUF_HEIGHT * GIMP_DISPLAY_RENDER_MAX_SCALE;
 
           shell->filter_data =
-            gegl_malloc (w * h * babl_format_get_bytes_per_pixel (filter_format));
+            gegl_malloc (w * h * babl_format_get_bytes_per_pixel (shell->filter_format));
 
           shell->filter_stride =
-            w * babl_format_get_bytes_per_pixel (filter_format);
+            w * babl_format_get_bytes_per_pixel (shell->filter_format);
 
           shell->filter_buffer =
             gegl_buffer_linear_new_from_data (shell->filter_data,
-                                              filter_format,
+                                              shell->filter_format,
                                               GEGL_RECTANGLE (0, 0, w, h),
                                               GEGL_AUTO_ROWSTRIDE,
                                               (GDestroyNotify) gegl_free,
@@ -255,7 +254,7 @@ gimp_display_shell_render (GimpDisplayShell *shell,
                            GEGL_RECTANGLE (scaled_x, scaled_y,
                                            scaled_width, scaled_height),
                            buffer_scale,
-                           filter_format,
+                           shell->filter_format,
                            shell->filter_data, shell->filter_stride,
                            GEGL_ABYSS_CLAMP);
 #else
@@ -263,7 +262,7 @@ gimp_display_shell_render (GimpDisplayShell *shell,
                           buffer_scale,
                           GEGL_RECTANGLE (scaled_x, scaled_y,
                                           scaled_width, scaled_height),
-                          filter_format,
+                          shell->filter_format,
                           shell->filter_data, shell->filter_stride,
                           GEGL_BLIT_CACHE);
 #endif
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 69c0113..edac907 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -336,6 +336,8 @@ gimp_display_shell_init (GimpDisplayShell *shell)
   shell->cursor_modifier   = GIMP_CURSOR_MODIFIER_NONE;
   shell->override_cursor   = (GimpCursorType) -1;
 
+  shell->filter_format     = babl_format ("R'G'B'A float");
+
   shell->motion_buffer   = gimp_motion_buffer_new ();
 
   g_signal_connect (shell->motion_buffer, "stroke",
diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h
index 0773df1..b621072 100644
--- a/app/display/gimpdisplayshell.h
+++ b/app/display/gimpdisplayshell.h
@@ -159,6 +159,7 @@ struct _GimpDisplayShell
   guint                  filter_idle_id;
   GtkWidget             *filters_dialog; /* color display filter dialog       */
 
+  const Babl        *filter_format;    /*  filter_buffer's format             */
   GeglBuffer        *filter_buffer;    /*  buffer for display filters         */
   guchar            *filter_data;      /*  filter_buffer's pixels             */
   gint               filter_stride;    /*  filter_buffer's stride             */


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