[gimp] app: port blend to gimp_drawable_apply_buffer()



commit fe1f140e1a629474e59fac9c3a04a1c2ddb9deb3
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 22 20:01:10 2012 +0100

    app: port blend to gimp_drawable_apply_buffer()

 app/core/gimpdrawable-blend.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c
index 3af8153..022745c 100644
--- a/app/core/gimpdrawable-blend.c
+++ b/app/core/gimpdrawable-blend.c
@@ -205,9 +205,8 @@ gimp_drawable_blend (GimpDrawable         *drawable,
                      GimpProgress         *progress)
 {
   GimpImage   *image;
-  TileManager *buf_tiles;
+  GeglBuffer  *buffer;
   PixelRegion  bufPR;
-  gint         bytes;
   gint         x, y, width, height;
 
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
@@ -223,10 +222,11 @@ gimp_drawable_blend (GimpDrawable         *drawable,
   gimp_set_busy (image->gimp);
 
   /*  Always create an alpha temp buf (for generality) */
-  bytes = gimp_drawable_bytes_with_alpha (drawable);
+  buffer = gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0, width, height),
+                                 gimp_drawable_get_format_with_alpha (drawable));
 
-  buf_tiles = tile_manager_new (width, height, bytes);
-  pixel_region_init (&bufPR, buf_tiles, 0, 0, width, height, TRUE);
+  pixel_region_init (&bufPR, gimp_gegl_buffer_get_tiles (buffer),
+                     0, 0, width, height, TRUE);
 
   gradient_fill_region (image, drawable, context,
                         &bufPR, width, height,
@@ -242,8 +242,10 @@ gimp_drawable_blend (GimpDrawable         *drawable,
       distR.tiles = NULL;
     }
 
-  pixel_region_init (&bufPR, buf_tiles, 0, 0, width, height, FALSE);
-  gimp_drawable_apply_region (drawable, &bufPR,
+  gimp_gegl_buffer_refetch_tiles (buffer);
+
+  gimp_drawable_apply_buffer (drawable, buffer,
+                              GIMP_GEGL_RECT (0, 0, width, height),
                               TRUE, C_("undo-type", "Blend"),
                               opacity, paint_mode,
                               NULL, NULL, x, y);
@@ -252,7 +254,7 @@ gimp_drawable_blend (GimpDrawable         *drawable,
   gimp_drawable_update (drawable, x, y, width, height);
 
   /*  free the temporary buffer  */
-  tile_manager_unref (buf_tiles);
+  g_object_unref (buffer);
 
   gimp_unset_busy (image->gimp);
 }



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