From 9e5329df77ecc56cf00c6186f4947203c9de5d45 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 3 Feb 2016 10:44:07 +0100 Subject: [PATCH] app: some cleanup in gimpdrawable-blend.c --- app/core/gimpdrawable-blend.c | 82 +++++++++++++++-------------------- 1 file changed, 34 insertions(+), 48 deletions(-) diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c index 45ef9581cc..4a4c187a95 100644 --- a/app/core/gimpdrawable-blend.c +++ b/app/core/gimpdrawable-blend.c @@ -17,24 +17,16 @@ #include "config.h" -#include -#include - #include #include #include -#include "libgimpbase/gimpbase.h" -#include "libgimpmath/gimpmath.h" -#include "libgimpcolor/gimpcolor.h" - #include "core-types.h" #include "gegl/gimp-gegl-apply-operation.h" #include "gegl/gimp-gegl-utils.h" #include "gimp.h" -#include "gimp-utils.h" #include "gimpchannel.h" #include "gimpcontext.h" #include "gimpdrawable-blend.h" @@ -96,6 +88,8 @@ gimp_drawable_blend (GimpDrawable *drawable, { GimpImage *image; GeglBuffer *buffer; + GeglBuffer *shapeburst = NULL; + GeglNode *render; gint x, y, width, height; g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); @@ -115,46 +109,41 @@ gimp_drawable_blend (GimpDrawable *drawable, buffer = gegl_buffer_new (GEGL_RECTANGLE (x, y, width, height), gimp_drawable_get_format_with_alpha (drawable)); - { - GeglBuffer *shapeburst = NULL; - GeglNode *render; + if (gradient_type >= GIMP_GRADIENT_SHAPEBURST_ANGULAR && + gradient_type <= GIMP_GRADIENT_SHAPEBURST_DIMPLED) + { + shapeburst = + gimp_drawable_blend_shapeburst_distmap (drawable, TRUE, + GEGL_RECTANGLE (x, y, width, height), + progress); + } - if (gradient_type >= GIMP_GRADIENT_SHAPEBURST_ANGULAR && - gradient_type <= GIMP_GRADIENT_SHAPEBURST_DIMPLED) - { - shapeburst = gimp_drawable_blend_shapeburst_distmap (drawable, TRUE, - GEGL_RECTANGLE (x, y, width, height), - progress); - } + render = gegl_node_new_child (NULL, + "operation", "gimp:blend", + "context", context, + "gradient", gradient, + "start-x", startx, + "start-y", starty, + "end-x", endx, + "end-y", endy, + "gradient-type", gradient_type, + "gradient-repeat", repeat, + "offset", offset, + "gradient-reverse", reverse, + "supersample", supersample, + "supersample-depth", max_depth, + "supersample-threshold", threshold, + "dither", dither, + NULL); - render = gegl_node_new_child (NULL, - "operation", "gimp:blend", - "context", context, - "gradient", gradient, - "start-x", startx, - "start-y", starty, - "end-x", endx, - "end-y", endy, - "gradient-type", gradient_type, - "gradient-repeat", repeat, - "offset", offset, - "gradient-reverse", reverse, - "supersample", supersample, - "supersample-depth", max_depth, - "supersample-threshold", threshold, - "dither", dither, - NULL); + gimp_gegl_apply_operation (shapeburst, progress, NULL, + render, + buffer, GEGL_RECTANGLE (x, y, width, height)); - gimp_gegl_apply_operation (shapeburst, progress, NULL, - render, - buffer, GEGL_RECTANGLE (x, y, width, height)); - - g_object_unref (render); - - if (shapeburst) - g_object_unref (shapeburst); - } + g_object_unref (render); + if (shapeburst) + g_object_unref (shapeburst); gimp_drawable_apply_buffer (drawable, buffer, GEGL_RECTANGLE (x, y, width, height), @@ -162,10 +151,8 @@ gimp_drawable_blend (GimpDrawable *drawable, opacity, paint_mode, NULL, x, y); - /* update the image */ gimp_drawable_update (drawable, x, y, width, height); - /* free the temporary buffer */ g_object_unref (buffer); gimp_unset_busy (image->gimp); @@ -195,8 +182,7 @@ gimp_drawable_blend_shapeburst_distmap (GimpDrawable *drawable, /* allocate the distance map */ dist_buffer = gegl_buffer_new (region, babl_format ("Y float")); - /* allocate the selection mask copy - */ + /* allocate the selection mask copy */ temp_buffer = gegl_buffer_new (region, babl_format ("Y float")); mask = gimp_image_get_mask (image);