app: add member GimpDisplayShell.filter_format

and use it where we used to hardcode "R'G'B'A float".
This commit is contained in:
Michael Natterer
2015-06-02 00:01:28 +02:00
parent 08545ad549
commit 460948e068
4 changed files with 9 additions and 7 deletions

View File

@ -91,7 +91,7 @@ gimp_display_shell_profile_update (GimpDisplayShell *shell)
src_format = gimp_pickable_get_format (GIMP_PICKABLE (image)); src_format = gimp_pickable_get_format (GIMP_PICKABLE (image));
if (gimp_display_shell_has_filter (shell)) if (gimp_display_shell_has_filter (shell))
dest_format = babl_format ("R'G'B'A float"); dest_format = shell->filter_format;
else else
dest_format = babl_format ("R'G'B'A u8"); dest_format = babl_format ("R'G'B'A u8");

View File

@ -63,7 +63,6 @@ gimp_display_shell_render (GimpDisplayShell *shell,
#ifdef USE_NODE_BLIT #ifdef USE_NODE_BLIT
GeglNode *node; GeglNode *node;
#endif #endif
const Babl *filter_format = babl_format ("R'G'B'A float");
gdouble scale_x = 1.0; gdouble scale_x = 1.0;
gdouble scale_y = 1.0; gdouble scale_y = 1.0;
gdouble buffer_scale = 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; gint h = GIMP_DISPLAY_RENDER_BUF_HEIGHT * GIMP_DISPLAY_RENDER_MAX_SCALE;
shell->filter_data = 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 = 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 = shell->filter_buffer =
gegl_buffer_linear_new_from_data (shell->filter_data, gegl_buffer_linear_new_from_data (shell->filter_data,
filter_format, shell->filter_format,
GEGL_RECTANGLE (0, 0, w, h), GEGL_RECTANGLE (0, 0, w, h),
GEGL_AUTO_ROWSTRIDE, GEGL_AUTO_ROWSTRIDE,
(GDestroyNotify) gegl_free, (GDestroyNotify) gegl_free,
@ -255,7 +254,7 @@ gimp_display_shell_render (GimpDisplayShell *shell,
GEGL_RECTANGLE (scaled_x, scaled_y, GEGL_RECTANGLE (scaled_x, scaled_y,
scaled_width, scaled_height), scaled_width, scaled_height),
buffer_scale, buffer_scale,
filter_format, shell->filter_format,
shell->filter_data, shell->filter_stride, shell->filter_data, shell->filter_stride,
GEGL_ABYSS_CLAMP); GEGL_ABYSS_CLAMP);
#else #else
@ -263,7 +262,7 @@ gimp_display_shell_render (GimpDisplayShell *shell,
buffer_scale, buffer_scale,
GEGL_RECTANGLE (scaled_x, scaled_y, GEGL_RECTANGLE (scaled_x, scaled_y,
scaled_width, scaled_height), scaled_width, scaled_height),
filter_format, shell->filter_format,
shell->filter_data, shell->filter_stride, shell->filter_data, shell->filter_stride,
GEGL_BLIT_CACHE); GEGL_BLIT_CACHE);
#endif #endif

View File

@ -336,6 +336,8 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell->cursor_modifier = GIMP_CURSOR_MODIFIER_NONE; shell->cursor_modifier = GIMP_CURSOR_MODIFIER_NONE;
shell->override_cursor = (GimpCursorType) -1; shell->override_cursor = (GimpCursorType) -1;
shell->filter_format = babl_format ("R'G'B'A float");
shell->motion_buffer = gimp_motion_buffer_new (); shell->motion_buffer = gimp_motion_buffer_new ();
g_signal_connect (shell->motion_buffer, "stroke", g_signal_connect (shell->motion_buffer, "stroke",

View File

@ -159,6 +159,7 @@ struct _GimpDisplayShell
guint filter_idle_id; guint filter_idle_id;
GtkWidget *filters_dialog; /* color display filter dialog */ GtkWidget *filters_dialog; /* color display filter dialog */
const Babl *filter_format; /* filter_buffer's format */
GeglBuffer *filter_buffer; /* buffer for display filters */ GeglBuffer *filter_buffer; /* buffer for display filters */
guchar *filter_data; /* filter_buffer's pixels */ guchar *filter_data; /* filter_buffer's pixels */
gint filter_stride; /* filter_buffer's stride */ gint filter_stride; /* filter_buffer's stride */