[gimp/gimp-2-10] app: use gimp_gegl_rectangle_align_to_tile_grid() in gimp:buffer-source-validate



commit 6e82635d4fc4fad65514ffb719980bd4151ca36c
Author: Ell <ell_se yahoo com>
Date:   Sun Dec 2 02:33:20 2018 -0500

    app: use gimp_gegl_rectangle_align_to_tile_grid() in gimp:buffer-source-validate
    
    ... instead of custom code.
    
    (cherry picked from commit ce3a6c4fd60aba26d4541884c27542440d14d7d0)

 app/operations/gimpoperationbuffersourcevalidate.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)
---
diff --git a/app/operations/gimpoperationbuffersourcevalidate.c 
b/app/operations/gimpoperationbuffersourcevalidate.c
index 95d8a6b1d8..f494478be2 100644
--- a/app/operations/gimpoperationbuffersourcevalidate.c
+++ b/app/operations/gimpoperationbuffersourcevalidate.c
@@ -24,12 +24,9 @@
 #include <gegl-plugin.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
-#include "libgimpcolor/gimpcolor.h"
-#include "libgimpconfig/gimpconfig.h"
-#include "libgimpmath/gimpmath.h"
-
 #include "operations-types.h"
 
+#include "gegl/gimp-gegl-utils.h"
 #include "gegl/gimptilehandlervalidate.h"
 
 #include "gimpoperationbuffersourcevalidate.h"
@@ -239,24 +236,11 @@ gimp_operation_buffer_source_validate_process (GeglOperation        *operation,
 
       if (validate_handler)
         {
-          gint          shift_x;
-          gint          shift_y;
-          gint          tile_width;
-          gint          tile_height;
           GeglRectangle rect;
 
-          g_object_get (buffer_source_validate->buffer,
-                        "shift-x",     &shift_x,
-                        "shift-y",     &shift_y,
-                        "tile-width",  &tile_width,
-                        "tile-height", &tile_height,
-                        NULL);
-
           /* align the rectangle to the tile grid */
-          rect.x      = (gint) floor ((gdouble) (result->x                  + shift_x) / tile_width)  * 
tile_width;
-          rect.y      = (gint) floor ((gdouble) (result->y                  + shift_y) / tile_height) * 
tile_height;
-          rect.width  = (gint) ceil  ((gdouble) (result->x + result->width  + shift_x) / tile_width)  * 
tile_width  - rect.x;
-          rect.height = (gint) ceil  ((gdouble) (result->y + result->height + shift_y) / tile_height) * 
tile_height - rect.y;
+          gimp_gegl_rectangle_align_to_tile_grid (
+            &rect, result, buffer_source_validate->buffer);
 
           gimp_tile_handler_validate_validate (validate_handler,
                                                buffer_source_validate->buffer,


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