diff --git a/app/actions/windows-commands.c b/app/actions/windows-commands.c index b82fdfb125..f7ff19c78d 100644 --- a/app/actions/windows-commands.c +++ b/app/actions/windows-commands.c @@ -19,6 +19,7 @@ #include +#include #include #include "libgimpwidgets/gimpwidgets.h" diff --git a/app/display/gimpdisplayshell-expose.c b/app/display/gimpdisplayshell-expose.c index b60ef13092..710e87695e 100644 --- a/app/display/gimpdisplayshell-expose.c +++ b/app/display/gimpdisplayshell-expose.c @@ -17,6 +17,7 @@ #include "config.h" +#include #include #include "display-types.h" diff --git a/app/display/gimpdisplayshell-filter.c b/app/display/gimpdisplayshell-filter.c index a491ba6035..1ec53fb48d 100644 --- a/app/display/gimpdisplayshell-filter.c +++ b/app/display/gimpdisplayshell-filter.c @@ -17,6 +17,7 @@ #include "config.h" +#include #include #include "libgimpconfig/gimpconfig.h" diff --git a/app/display/gimpdisplayshell-grab.c b/app/display/gimpdisplayshell-grab.c index 2ca9c1a064..d9dec3890c 100644 --- a/app/display/gimpdisplayshell-grab.c +++ b/app/display/gimpdisplayshell-grab.c @@ -19,6 +19,7 @@ #include "config.h" +#include #include #include "display-types.h" diff --git a/app/display/gimpdisplayshell-items.c b/app/display/gimpdisplayshell-items.c index 17d63c4797..c92ff5b409 100644 --- a/app/display/gimpdisplayshell-items.c +++ b/app/display/gimpdisplayshell-items.c @@ -20,6 +20,7 @@ #include "config.h" +#include #include #include diff --git a/app/display/gimpdisplayshell-progress.c b/app/display/gimpdisplayshell-progress.c index cc0526000a..bca0bcbed0 100644 --- a/app/display/gimpdisplayshell-progress.c +++ b/app/display/gimpdisplayshell-progress.c @@ -17,6 +17,7 @@ #include "config.h" +#include #include #include "display-types.h" diff --git a/app/display/gimpdisplayshell-render.c b/app/display/gimpdisplayshell-render.c index 03d137cb8c..4ed04ffa55 100644 --- a/app/display/gimpdisplayshell-render.c +++ b/app/display/gimpdisplayshell-render.c @@ -146,13 +146,11 @@ gimp_display_shell_render (GimpDisplayShell *shell, cairo_surface_mark_dirty (shell->mask_surface); - buffer = gimp_drawable_get_buffer (shell->mask); - stride = cairo_image_surface_get_stride (shell->mask_surface); data = cairo_image_surface_get_data (shell->mask_surface); data += mask_src_y * stride + mask_src_x * 4; - gegl_buffer_get (buffer, + gegl_buffer_get (shell->mask, GEGL_RECTANGLE ((x + viewport_offset_x) * window_scale, (y + viewport_offset_y) * window_scale, w * window_scale, diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index a881e53772..897c3efb45 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -1823,13 +1823,11 @@ gimp_display_shell_set_highlight (GimpDisplayShell *shell, **/ void gimp_display_shell_set_mask (GimpDisplayShell *shell, - GimpDrawable *mask, + GeglBuffer *mask, const GimpRGB *color) { g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); - g_return_if_fail (mask == NULL || - (GIMP_IS_DRAWABLE (mask) && - babl_format_get_bytes_per_pixel (gimp_drawable_get_format (mask)) == 1)); + g_return_if_fail (mask == NULL || GEGL_IS_BUFFER (mask)); g_return_if_fail (mask == NULL || color != NULL); if (mask) diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h index 50f182357f..c4c57a9e04 100644 --- a/app/display/gimpdisplayshell.h +++ b/app/display/gimpdisplayshell.h @@ -186,7 +186,7 @@ struct _GimpDisplayShell gdouble rotate_drag_angle; gpointer scroll_info; - GimpDrawable *mask; + GeglBuffer *mask; GimpRGB mask_color; GimpMotionBuffer *motion_buffer; @@ -272,7 +272,7 @@ void gimp_display_shell_resume (GimpDisplayShell *shell); void gimp_display_shell_set_highlight (GimpDisplayShell *shell, const GdkRectangle *highlight); void gimp_display_shell_set_mask (GimpDisplayShell *shell, - GimpDrawable *mask, + GeglBuffer *mask, const GimpRGB *color); diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c index bca38f5600..0c0ad814a1 100644 --- a/app/tools/gimpforegroundselecttool.c +++ b/app/tools/gimpforegroundselecttool.c @@ -32,9 +32,9 @@ #include "tools-types.h" +#include "gegl/gimp-gegl-mask.h" + #include "core/gimp.h" -#include "core/gimpchannel-combine.h" -#include "core/gimpchannel-select.h" #include "core/gimpdrawable-foreground-extract.h" #include "core/gimpimage.h" #include "core/gimplayer.h" @@ -223,13 +223,13 @@ gimp_foreground_select_tool_finalize (GObject *object) GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (object); if (fg_select->stroke) - g_warning ("%s: stroke should be NULL at this point", G_STRLOC); + g_warning ("%s: stroke should be NULL at this point", G_STRLOC); if (fg_select->mask) - g_warning ("%s: mask should be NULL at this point", G_STRLOC); + g_warning ("%s: mask should be NULL at this point", G_STRLOC); if (fg_select->trimap) - g_warning ("%s: mask should be NULL at this point", G_STRLOC); + g_warning ("%s: mask should be NULL at this point", G_STRLOC); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -510,16 +510,16 @@ gimp_foreground_select_tool_motion (GimpTool *tool, } static void -gimp_foreground_select_tool_get_area (GimpChannel *mask, - gint *x1, - gint *y1, - gint *x2, - gint *y2) +gimp_foreground_select_tool_get_area (GeglBuffer *mask, + gint *x1, + gint *y1, + gint *x2, + gint *y2) { gint width; gint height; - gimp_channel_bounds (mask, x1, y1, x2, y2); + gimp_gegl_mask_bounds (mask, x1, y1, x2, y2); width = *x2 - *x1; height = *y2 - *y1; @@ -618,13 +618,12 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel, points, TRUE); - fg_select->trimap = gimp_channel_new (image, - gimp_image_get_width (image), - gimp_image_get_height (image), - "foreground-extraction",NULL); + fg_select->trimap = gegl_buffer_new (GEGL_RECTANGLE (0, 0, + gimp_image_get_width (image), + gimp_image_get_height (image)), + gimp_image_get_mask_format (image)); - gimp_scan_convert_render_value (scan_convert, - gimp_drawable_get_buffer (GIMP_DRAWABLE (fg_select->trimap)), + gimp_scan_convert_render_value (scan_convert, fg_select->trimap, 0, 0, 1.0); gimp_scan_convert_free (scan_convert); @@ -646,7 +645,7 @@ gimp_foreground_select_tool_set_trimap (GimpForegroundSelectTool *fg_select, gimp_foreground_select_options_get_mask_color (options, &color); gimp_display_shell_set_mask (gimp_display_get_shell (display), - GIMP_DRAWABLE (fg_select->trimap), &color); + fg_select->trimap, &color); gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_PAINTBRUSH); @@ -674,7 +673,7 @@ gimp_foreground_select_tool_set_preview (GimpForegroundSelectTool *fg_select, gimp_foreground_select_options_get_mask_color (options, &color); gimp_rgb_set_alpha (&color, 1.0); gimp_display_shell_set_mask (gimp_display_get_shell (display), - GIMP_DRAWABLE (fg_select->mask), &color); + fg_select->mask, &color); gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_PAINTBRUSH); @@ -749,7 +748,7 @@ gimp_foreground_select_tool_preview (GimpForegroundSelectTool *fg_select, _("Computing alpha of unknown pixels"), FALSE); - trimap_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (fg_select->trimap)); + trimap_buffer = fg_select->trimap; drawable_buffer = gimp_drawable_get_buffer (drawable); gegl = gegl_node_new (); @@ -804,15 +803,11 @@ gimp_foreground_select_tool_preview (GimpForegroundSelectTool *fg_select, g_object_unref (processor); - fg_select->mask = gimp_channel_new_from_buffer (buffer, image, - "preview-mask", NULL); + fg_select->mask = buffer; gimp_foreground_select_tool_set_preview (fg_select, display); g_object_unref (gegl); - - if (buffer) - g_object_unref (buffer); } static void @@ -822,15 +817,12 @@ gimp_foreground_select_tool_apply (GimpForegroundSelectTool *fg_select, GimpTool *tool = GIMP_TOOL (fg_select); GimpImage *image = gimp_display_get_image (display); GimpLayer *layer = gimp_image_get_active_layer (image); - GeglBuffer *buffer; GimpLayerMask *layer_mask; GimpRGB color = { 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE }; g_return_if_fail (fg_select->mask != NULL); - buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (fg_select->mask)); - - layer_mask = gimp_layer_mask_new_from_buffer (buffer, image, + layer_mask = gimp_layer_mask_new_from_buffer (fg_select->mask, image, "mask", &color); gimp_layer_add_mask (layer, layer_mask, TRUE, NULL); @@ -878,8 +870,7 @@ gimp_foreground_select_tool_stroke_paint (GimpForegroundSelectTool *fg_select GIMP_JOIN_ROUND, GIMP_CAP_ROUND, 10.0, 0.0, NULL); - gimp_scan_convert_compose_value (scan_convert, - gimp_drawable_get_buffer (GIMP_DRAWABLE (fg_select->trimap)), + gimp_scan_convert_compose_value (scan_convert, fg_select->trimap, 0, 0, gimp_foreground_select_options_get_opacity (options)); diff --git a/app/tools/gimpforegroundselecttool.h b/app/tools/gimpforegroundselecttool.h index f2e29821bf..31a89749f5 100644 --- a/app/tools/gimpforegroundselecttool.h +++ b/app/tools/gimpforegroundselecttool.h @@ -49,8 +49,8 @@ struct _GimpForegroundSelectTool GimpCoords last_coords; GArray *stroke; - GimpChannel *trimap; - GimpChannel *mask; + GeglBuffer *trimap; + GeglBuffer *mask; MattingState state; }; diff --git a/app/tools/gimptool-progress.c b/app/tools/gimptool-progress.c index 1f2a136ebe..703356ec46 100644 --- a/app/tools/gimptool-progress.c +++ b/app/tools/gimptool-progress.c @@ -20,6 +20,7 @@ #include "config.h" +#include #include #include "tools-types.h"