[gimp/gimp-2-10] app: remove gimp_gegl_rectangle_align_to_tile_grid()



commit b72aad57f23c6083c2a66f52703b6ee0077d010b
Author: Ell <ell_se yahoo com>
Date:   Tue Jul 30 16:09:36 2019 +0300

    app: remove gimp_gegl_rectangle_align_to_tile_grid()
    
    ... and replace it with gegl_rectangle_align_to_buffer().
    
    (cherry picked from commit ab94251ae939651e15bf7efc4c766383f2cf6ebf)

 app/core/gimpchannel-combine.c                     |  4 +--
 app/core/gimpchannel.c                             |  4 +--
 app/core/gimpdrawable-filters.c                    |  6 ++--
 app/core/gimpdrawable.c                            |  7 +++--
 app/core/gimphistogram.c                           |  7 +++--
 app/core/gimpmaskundo.c                            |  8 ++---
 app/gegl/gimp-gegl-utils.c                         | 36 ----------------------
 app/gegl/gimp-gegl-utils.h                         |  4 ---
 app/operations/gimpoperationbuffersourcevalidate.c |  6 ++--
 app/operations/gimpoperationfillsource.c           |  7 ++---
 app/paint/gimppaintcore.c                          |  9 +++---
 11 files changed, 30 insertions(+), 68 deletions(-)
---
diff --git a/app/core/gimpchannel-combine.c b/app/core/gimpchannel-combine.c
index 93bc85b610..aaef7918c0 100644
--- a/app/core/gimpchannel-combine.c
+++ b/app/core/gimpchannel-combine.c
@@ -28,7 +28,6 @@
 #include "core-types.h"
 
 #include "gegl/gimp-gegl-mask-combine.h"
-#include "gegl/gimp-gegl-utils.h"
 
 #include "gimpchannel.h"
 #include "gimpchannel-combine.h"
@@ -119,7 +118,8 @@ gimp_channel_combine_clear (GimpChannel         *mask,
 
       update_area = area;
 
-      gimp_gegl_rectangle_align_to_tile_grid (&area, &area, buffer);
+      gegl_rectangle_align_to_buffer (&area, &area, buffer,
+                                      GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
     }
 
   gegl_buffer_clear (buffer, &area);
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 5abee03436..373efb10fb 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -36,7 +36,6 @@
 #include "gegl/gimp-gegl-loops.h"
 #include "gegl/gimp-gegl-mask.h"
 #include "gegl/gimp-gegl-nodes.h"
-#include "gegl/gimp-gegl-utils.h"
 
 #include "gimp.h"
 #include "gimp-utils.h"
@@ -1268,7 +1267,8 @@ gimp_channel_real_clear (GimpChannel *channel,
       rect.height = gimp_item_get_height (GIMP_ITEM (channel));
     }
 
-  gimp_gegl_rectangle_align_to_tile_grid (&aligned_rect, &rect, buffer);
+  gegl_rectangle_align_to_buffer (&aligned_rect, &rect, buffer,
+                                  GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
 
   gegl_buffer_clear (buffer, &aligned_rect);
 
diff --git a/app/core/gimpdrawable-filters.c b/app/core/gimpdrawable-filters.c
index b39753ef86..89c5a38e8d 100644
--- a/app/core/gimpdrawable-filters.c
+++ b/app/core/gimpdrawable-filters.c
@@ -28,7 +28,6 @@
 #include "gegl/gimpapplicator.h"
 #include "gegl/gimp-gegl-apply-operation.h"
 #include "gegl/gimp-gegl-loops.h"
-#include "gegl/gimp-gegl-utils.h"
 
 #include "gimp-utils.h"
 #include "gimpdrawable.h"
@@ -165,10 +164,11 @@ gimp_drawable_merge_filter (GimpDrawable *drawable,
         gimp_applicator_set_output_format (applicator, NULL);
     }
 
-  gimp_gegl_rectangle_align_to_tile_grid (
+  gegl_rectangle_align_to_buffer (
     &undo_rect,
     &rect,
-    gimp_drawable_get_buffer (drawable));
+    gimp_drawable_get_buffer (drawable),
+    GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
 
   undo_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
                                                  undo_rect.width,
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 7c9544bb03..ce47b345c5 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -30,7 +30,7 @@
 #include "gegl/gimp-babl.h"
 #include "gegl/gimp-gegl-apply-operation.h"
 #include "gegl/gimp-gegl-loops.h"
-#include "gegl/gimp-gegl-utils.h"
+#include "gegl/gimptilehandlerbuffer.h"
 
 #include "gimp-memsize.h"
 #include "gimp-utils.h"
@@ -918,10 +918,11 @@ gimp_drawable_real_push_undo (GimpDrawable *drawable,
       GeglBuffer    *drawable_buffer = gimp_drawable_get_buffer (drawable);
       GeglRectangle  drawable_rect;
 
-      gimp_gegl_rectangle_align_to_tile_grid (
+      gegl_rectangle_align_to_buffer (
         &drawable_rect,
         GEGL_RECTANGLE (x, y, width, height),
-        drawable_buffer);
+        drawable_buffer,
+        GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
 
       x      = drawable_rect.x;
       y      = drawable_rect.y;
diff --git a/app/core/gimphistogram.c b/app/core/gimphistogram.c
index 0abe467412..6bc23c4c1b 100644
--- a/app/core/gimphistogram.c
+++ b/app/core/gimphistogram.c
@@ -31,7 +31,6 @@
 
 #include "gegl/gimp-babl.h"
 #include "gegl/gimp-gegl-loops.h"
-#include "gegl/gimp-gegl-utils.h"
 
 #include "gimp-atomic.h"
 #include "gimp-parallel.h"
@@ -321,7 +320,8 @@ gimp_histogram_calculate_async (GimpHistogram       *histogram,
   if (histogram->priv->calculate_async)
     gimp_async_cancel_and_wait (histogram->priv->calculate_async);
 
-  gimp_gegl_rectangle_align_to_tile_grid (&rect, buffer_rect, buffer);
+  gegl_rectangle_align_to_buffer (&rect, buffer_rect, buffer,
+                                  GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
 
   context = g_slice_new0 (CalculateContext);
 
@@ -340,7 +340,8 @@ gimp_histogram_calculate_async (GimpHistogram       *histogram,
       else
         context->mask_rect = *gegl_buffer_get_extent (mask);
 
-      gimp_gegl_rectangle_align_to_tile_grid (&rect, &context->mask_rect, mask);
+      gegl_rectangle_align_to_buffer (&rect, &context->mask_rect, mask,
+                                      GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
 
       context->mask = gegl_buffer_new (&rect, gegl_buffer_get_format (mask));
 
diff --git a/app/core/gimpmaskundo.c b/app/core/gimpmaskundo.c
index 32b72980a0..d388ee5f36 100644
--- a/app/core/gimpmaskundo.c
+++ b/app/core/gimpmaskundo.c
@@ -23,7 +23,6 @@
 #include "core-types.h"
 
 #include "gegl/gimp-gegl-loops.h"
-#include "gegl/gimp-gegl-utils.h"
 
 #include "gimp-memsize.h"
 #include "gimpchannel.h"
@@ -116,8 +115,8 @@ gimp_mask_undo_constructed (GObject *object)
       GeglBuffer    *buffer = gimp_drawable_get_buffer (drawable);
       GeglRectangle  rect;
 
-      gimp_gegl_rectangle_align_to_tile_grid (&rect, &mask_undo->bounds,
-                                              buffer);
+      gegl_rectangle_align_to_buffer (&rect, &mask_undo->bounds, buffer,
+                                      GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
 
       mask_undo->buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
                                                            rect.width,
@@ -211,7 +210,8 @@ gimp_mask_undo_pop (GimpUndo            *undo,
     {
       GeglBuffer *buffer = gimp_drawable_get_buffer (drawable);
 
-      gimp_gegl_rectangle_align_to_tile_grid (&rect, &bounds, buffer);
+      gegl_rectangle_align_to_buffer (&rect, &bounds, buffer,
+                                      GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
 
       new_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
                                                     rect.width, rect.height),
diff --git a/app/gegl/gimp-gegl-utils.c b/app/gegl/gimp-gegl-utils.c
index 91175a4652..a88e70f9d9 100644
--- a/app/gegl/gimp-gegl-utils.c
+++ b/app/gegl/gimp-gegl-utils.c
@@ -25,8 +25,6 @@
 #include <gegl.h>
 #include <gegl-plugin.h>
 
-#include "libgimpmath/gimpmath.h"
-
 #include "gimp-gegl-types.h"
 
 #include "core/gimpprogress.h"
@@ -232,37 +230,3 @@ gimp_gegl_param_spec_has_key (GParamSpec  *pspec,
 
   return FALSE;
 }
-
-void
-gimp_gegl_rectangle_align_to_tile_grid (GeglRectangle       *dest,
-                                        const GeglRectangle *src,
-                                        GeglBuffer          *buffer)
-{
-  gint          shift_x;
-  gint          shift_y;
-  gint          tile_width;
-  gint          tile_height;
-  GeglRectangle rect;
-
-  g_return_if_fail (dest != NULL);
-  g_return_if_fail (src != NULL);
-  g_return_if_fail (GEGL_IS_BUFFER (buffer));
-
-  g_object_get (buffer,
-                "shift-x",     &shift_x,
-                "shift-y",     &shift_y,
-                "tile-width",  &tile_width,
-                "tile-height", &tile_height,
-                NULL);
-
-  rect.x      = (gint) floor ((gdouble) (src->x               + shift_x) /
-                              tile_width)  * tile_width;
-  rect.y      = (gint) floor ((gdouble) (src->y               + shift_y) /
-                              tile_height) * tile_height;
-  rect.width  = (gint) ceil  ((gdouble) (src->x + src->width  + shift_x) /
-                              tile_width)  * tile_width  - rect.x;
-  rect.height = (gint) ceil  ((gdouble) (src->y + src->height + shift_y) /
-                              tile_height) * tile_height - rect.y;
-
-  *dest = rect;
-}
diff --git a/app/gegl/gimp-gegl-utils.h b/app/gegl/gimp-gegl-utils.h
index ef5188ede8..f568588235 100644
--- a/app/gegl/gimp-gegl-utils.h
+++ b/app/gegl/gimp-gegl-utils.h
@@ -46,9 +46,5 @@ gboolean     gimp_gegl_param_spec_has_key            (GParamSpec          *pspec
                                                       const gchar         *key,
                                                       const gchar         *value);
 
-void         gimp_gegl_rectangle_align_to_tile_grid  (GeglRectangle       *dest,
-                                                      const GeglRectangle *src,
-                                                      GeglBuffer          *buffer);
-
 
 #endif /* __GIMP_GEGL_UTILS_H__ */
diff --git a/app/operations/gimpoperationbuffersourcevalidate.c 
b/app/operations/gimpoperationbuffersourcevalidate.c
index e9e257bae3..f4d8be47fb 100644
--- a/app/operations/gimpoperationbuffersourcevalidate.c
+++ b/app/operations/gimpoperationbuffersourcevalidate.c
@@ -26,7 +26,6 @@
 
 #include "operations-types.h"
 
-#include "gegl/gimp-gegl-utils.h"
 #include "gegl/gimptilehandlervalidate.h"
 
 #include "gimpoperationbuffersourcevalidate.h"
@@ -239,8 +238,9 @@ gimp_operation_buffer_source_validate_process (GeglOperation        *operation,
           GeglRectangle rect;
 
           /* align the rectangle to the tile grid */
-          gimp_gegl_rectangle_align_to_tile_grid (
-            &rect, result, buffer_source_validate->buffer);
+          gegl_rectangle_align_to_buffer (
+            &rect, result, buffer_source_validate->buffer,
+            GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
 
           gimp_tile_handler_validate_validate (validate_handler,
                                                buffer_source_validate->buffer,
diff --git a/app/operations/gimpoperationfillsource.c b/app/operations/gimpoperationfillsource.c
index c2a798fd06..5811611373 100644
--- a/app/operations/gimpoperationfillsource.c
+++ b/app/operations/gimpoperationfillsource.c
@@ -26,8 +26,6 @@
 
 #include "operations-types.h"
 
-#include "gegl/gimp-gegl-utils.h"
-
 #include "core/gimpdrawable.h"
 #include "core/gimpfilloptions.h"
 
@@ -238,9 +236,10 @@ gimp_operation_fill_source_process (GeglOperation        *operation,
       GeglBuffer    *buffer;
       GeglRectangle  rect;
 
-      gimp_gegl_rectangle_align_to_tile_grid (
+      gegl_rectangle_align_to_buffer (
         &rect, result,
-        gimp_drawable_get_buffer (fill_source->drawable));
+        gimp_drawable_get_buffer (fill_source->drawable),
+        GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
 
       buffer = gimp_fill_options_create_buffer (fill_source->options,
                                                 fill_source->drawable,
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index 94b399f154..28cd09613e 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -32,7 +32,6 @@
 
 #include "gegl/gimp-gegl-loops.h"
 #include "gegl/gimp-gegl-nodes.h"
-#include "gegl/gimp-gegl-utils.h"
 #include "gegl/gimpapplicator.h"
 
 #include "core/gimp.h"
@@ -511,7 +510,8 @@ gimp_paint_core_finish (GimpPaintCore *core,
                                 gimp_item_get_height (GIMP_ITEM (drawable)),
                                 &rect.x, &rect.y, &rect.width, &rect.height);
 
-      gimp_gegl_rectangle_align_to_tile_grid (&rect, &rect, core->undo_buffer);
+      gegl_rectangle_align_to_buffer (&rect, &rect, core->undo_buffer,
+                                      GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
 
       gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_PAINT,
                                    core->undo_desc);
@@ -1045,9 +1045,10 @@ gimp_paint_core_replace (GimpPaintCore            *core,
                                                 core->paint_buffer_y,
                                                 width, height);
 
-          gimp_gegl_rectangle_align_to_tile_grid (
+          gegl_rectangle_align_to_buffer (
             &aligned_combined_mask_rect, &combined_mask_rect,
-            gimp_drawable_get_buffer (drawable));
+            gimp_drawable_get_buffer (drawable),
+            GEGL_RECTANGLE_ALIGNMENT_SUPERSET);
 
           combined_mask_buffer = gegl_buffer_new (&aligned_combined_mask_rect,
                                                   babl_format ("Y float"));


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