app: remove gimp_gegl_rectangle_align_to_tile_grid()

... and replace it with gegl_rectangle_align_to_buffer().
This commit is contained in:
Ell
2019-07-30 16:09:36 +03:00
parent 1e10cfc53f
commit ab94251ae9
11 changed files with 30 additions and 68 deletions

View File

@ -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);

View File

@ -37,7 +37,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"
@ -1271,7 +1270,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);

View File

@ -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,

View File

@ -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"
@ -928,10 +928,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;

View File

@ -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));

View File

@ -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),

View File

@ -25,8 +25,6 @@
#include <gegl.h>
#include <gegl-plugin.h>
#include "libgimpmath/gimpmath.h"
#include "gimp-gegl-types.h"
#include "core/gimpprogress.h"
@ -235,37 +233,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;
}

View File

@ -47,9 +47,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__ */

View File

@ -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,

View File

@ -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,

View File

@ -33,7 +33,6 @@
#include "gegl/gimp-babl.h"
#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"
@ -512,7 +511,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);
@ -1046,9 +1046,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"));