[gimp/gimp-2-10] app, pdb: use gimp_item_get_clip() everywhere
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app, pdb: use gimp_item_get_clip() everywhere
- Date: Fri, 9 Aug 2019 19:24:51 +0000 (UTC)
commit f221b424c044ce56ffa640c3f95be3e4ef180647
Author: Ell <ell_se yahoo com>
Date: Fri Aug 9 21:51:27 2019 +0300
app, pdb: use gimp_item_get_clip() everywhere
Remove the special clipping-mode handling for channels throughout
the transform (and drawable-filter) code, and rather use
gimp_item_get_clip(), added in the previous commit, instead. As
mentioned in the previous commit, we only modify the clipping mode
in top-level code, while having lower-level code use the clipping
mode as-is. This not only hides the actual clipping-mode logic
from the transform code, but, in particular, allows code performing
transformation internally to use arbitrary clipping modes.
Also, this commit fixes a bunch of PDB bugs all over the place :)
app/actions/drawable-commands.c | 12 +++----
app/core/gimpchannel.c | 68 ---------------------------------------
app/core/gimpdrawable-transform.c | 60 ----------------------------------
app/core/gimpdrawable-transform.h | 4 ---
app/core/gimpdrawablefilter.c | 8 ++---
app/core/gimpimage-item-list.c | 25 ++++++++++----
app/core/gimpitem-linked.c | 19 +----------
app/pdb/drawable-transform-cmds.c | 32 ++++++++++++++++++
app/pdb/item-transform-cmds.c | 27 ++++++++++------
app/pdb/transform-tools-cmds.c | 18 +++++++----
app/tools/gimpfiltertool.c | 2 +-
app/tools/gimpfliptool.c | 16 ++-------
app/tools/gimptransformtool.c | 36 ++++-----------------
pdb/groups/drawable_transform.pdb | 8 +++++
pdb/groups/item_transform.pdb | 9 ++++--
pdb/groups/transform_tools.pdb | 18 +++++++----
16 files changed, 125 insertions(+), 237 deletions(-)
---
diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c
index 1a20aace4a..7ea70e8b6d 100644
--- a/app/actions/drawable-commands.c
+++ b/app/actions/drawable-commands.c
@@ -257,7 +257,8 @@ drawable_flip_cmd_callback (GimpAction *action,
}
else
{
- gimp_item_flip (item, context, orientation, axis, FALSE);
+ gimp_item_flip (item, context, orientation, axis,
+ gimp_item_get_clip (item, FALSE));
}
gimp_image_flush (image);
@@ -274,7 +275,6 @@ drawable_rotate_cmd_callback (GimpAction *action,
GimpItem *item;
gint off_x, off_y;
gdouble center_x, center_y;
- gboolean clip_result = FALSE;
GimpRotationType rotation_type;
return_if_no_drawable (image, drawable, data);
return_if_no_context (context, data);
@@ -288,9 +288,6 @@ drawable_rotate_cmd_callback (GimpAction *action,
center_x = ((gdouble) off_x + (gdouble) gimp_item_get_width (item) / 2.0);
center_y = ((gdouble) off_y + (gdouble) gimp_item_get_height (item) / 2.0);
- if (GIMP_IS_CHANNEL (item))
- clip_result = TRUE;
-
if (gimp_item_get_linked (item))
{
gimp_item_linked_rotate (item, context, rotation_type,
@@ -298,8 +295,9 @@ drawable_rotate_cmd_callback (GimpAction *action,
}
else
{
- gimp_item_rotate (item, context, rotation_type,
- center_x, center_y, clip_result);
+ gimp_item_rotate (item, context,
+ rotation_type, center_x, center_y,
+ gimp_item_get_clip (item, FALSE));
}
gimp_image_flush (image);
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 622f66f3b8..a9b7546809 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -110,24 +110,6 @@ static void gimp_channel_resize (GimpItem *item,
gint new_height,
gint offset_x,
gint offset_y);
-static void gimp_channel_flip (GimpItem *item,
- GimpContext *context,
- GimpOrientationType flip_type,
- gdouble axis,
- gboolean flip_result);
-static void gimp_channel_rotate (GimpItem *item,
- GimpContext *context,
- GimpRotationType flip_type,
- gdouble center_x,
- gdouble center_y,
- gboolean flip_result);
-static void gimp_channel_transform (GimpItem *item,
- GimpContext *context,
- const GimpMatrix3 *matrix,
- GimpTransformDirection direction,
- GimpInterpolationType interpolation_type,
- GimpTransformResize clip_result,
- GimpProgress *progress);
static GimpTransformResize
gimp_channel_get_clip (GimpItem *item,
GimpTransformResize clip_result);
@@ -265,9 +247,6 @@ gimp_channel_class_init (GimpChannelClass *klass)
item_class->translate = gimp_channel_translate;
item_class->scale = gimp_channel_scale;
item_class->resize = gimp_channel_resize;
- item_class->flip = gimp_channel_flip;
- item_class->rotate = gimp_channel_rotate;
- item_class->transform = gimp_channel_transform;
item_class->get_clip = gimp_channel_get_clip;
item_class->fill = gimp_channel_fill;
item_class->stroke = gimp_channel_stroke;
@@ -772,53 +751,6 @@ gimp_channel_resize (GimpItem *item,
}
}
-static void
-gimp_channel_flip (GimpItem *item,
- GimpContext *context,
- GimpOrientationType flip_type,
- gdouble axis,
- gboolean clip_result)
-{
- if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
- clip_result = TRUE;
-
- GIMP_ITEM_CLASS (parent_class)->flip (item, context, flip_type, axis,
- clip_result);
-}
-
-static void
-gimp_channel_rotate (GimpItem *item,
- GimpContext *context,
- GimpRotationType rotate_type,
- gdouble center_x,
- gdouble center_y,
- gboolean clip_result)
-{
- /* don't default to clip_result == TRUE here */
-
- GIMP_ITEM_CLASS (parent_class)->rotate (item, context,
- rotate_type, center_x, center_y,
- clip_result);
-}
-
-static void
-gimp_channel_transform (GimpItem *item,
- GimpContext *context,
- const GimpMatrix3 *matrix,
- GimpTransformDirection direction,
- GimpInterpolationType interpolation_type,
- GimpTransformResize clip_result,
- GimpProgress *progress)
-{
- if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
- clip_result = TRUE;
-
- GIMP_ITEM_CLASS (parent_class)->transform (item, context, matrix, direction,
- interpolation_type,
- clip_result,
- progress);
-}
-
static GimpTransformResize
gimp_channel_get_clip (GimpItem *item,
GimpTransformResize clip_result)
diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c
index cdda65e367..9cbedfdba2 100644
--- a/app/core/gimpdrawable-transform.c
+++ b/app/core/gimpdrawable-transform.c
@@ -64,41 +64,6 @@
/* public functions */
-GimpTransformResize
-gimp_drawable_transform_get_effective_clip (GimpDrawable *drawable,
- GeglBuffer *orig_buffer,
- GimpTransformResize clip_result)
-{
- g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), clip_result);
- g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)),
- clip_result);
- g_return_val_if_fail (orig_buffer == NULL || GEGL_IS_BUFFER (orig_buffer),
- clip_result);
-
- /* Always clip unfloated buffers since they must keep their size */
- if (GIMP_IS_CHANNEL (drawable))
- {
- if (orig_buffer)
- {
- if (! babl_format_has_alpha (gegl_buffer_get_format (orig_buffer)))
- clip_result = GIMP_TRANSFORM_RESIZE_CLIP;
- }
- else
- {
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
- GimpChannel *mask = gimp_image_get_mask (image);
-
- if (GIMP_CHANNEL (drawable) == mask ||
- gimp_channel_is_empty (mask))
- {
- clip_result = GIMP_TRANSFORM_RESIZE_CLIP;
- }
- }
- }
-
- return clip_result;
-}
-
GeglBuffer *
gimp_drawable_transform_buffer_affine (GimpDrawable *drawable,
GimpContext *context,
@@ -146,17 +111,6 @@ gimp_drawable_transform_buffer_affine (GimpDrawable *drawable,
u2 = u1 + gegl_buffer_get_width (orig_buffer);
v2 = v1 + gegl_buffer_get_height (orig_buffer);
- /* Don't modify the clipping mode of layer masks here, so that,
- * when transformed together with their layer, they match the
- * layer's clipping mode.
- */
- if (G_TYPE_FROM_INSTANCE (drawable) == GIMP_TYPE_CHANNEL)
- {
- clip_result = gimp_drawable_transform_get_effective_clip (drawable,
- orig_buffer,
- clip_result);
- }
-
/* Find the bounding coordinates of target */
gimp_transform_resize_boundary (&m, clip_result,
u1, v1, u2, v2,
@@ -788,10 +742,6 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
gint new_offset_y;
GimpColorProfile *profile;
- clip_result = gimp_drawable_transform_get_effective_clip (drawable,
- orig_buffer,
- clip_result);
-
/* also transform the mask if we are transforming an entire layer */
if (GIMP_IS_LAYER (drawable) &&
gimp_layer_get_mask (GIMP_LAYER (drawable)) &&
@@ -876,11 +826,6 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
gint new_offset_y;
GimpColorProfile *profile;
- /* always clip unfloated buffers so they keep their size */
- if (GIMP_IS_CHANNEL (drawable) &&
- ! babl_format_has_alpha (gegl_buffer_get_format (orig_buffer)))
- clip_result = TRUE;
-
/* also transform the mask if we are transforming an entire layer */
if (GIMP_IS_LAYER (drawable) &&
gimp_layer_get_mask (GIMP_LAYER (drawable)) &&
@@ -961,11 +906,6 @@ gimp_drawable_transform_rotate (GimpDrawable *drawable,
gint new_offset_y;
GimpColorProfile *profile;
- /* always clip unfloated buffers so they keep their size */
- if (GIMP_IS_CHANNEL (drawable) &&
- ! babl_format_has_alpha (gegl_buffer_get_format (orig_buffer)))
- clip_result = TRUE;
-
/* also transform the mask if we are transforming an entire layer */
if (GIMP_IS_LAYER (drawable) &&
gimp_layer_get_mask (GIMP_LAYER (drawable)) &&
diff --git a/app/core/gimpdrawable-transform.h b/app/core/gimpdrawable-transform.h
index fec177b42d..8cdd53f8c1 100644
--- a/app/core/gimpdrawable-transform.h
+++ b/app/core/gimpdrawable-transform.h
@@ -19,10 +19,6 @@
#define __GIMP_DRAWABLE_TRANSFORM_H__
-GimpTransformResize gimp_drawable_transform_get_effective_clip (GimpDrawable *drawable,
- GeglBuffer *orig_buffer,
- GimpTransformResize clip_result);
-
GeglBuffer * gimp_drawable_transform_buffer_affine (GimpDrawable *drawable,
GimpContext *context,
GeglBuffer *orig_buffer,
diff --git a/app/core/gimpdrawablefilter.c b/app/core/gimpdrawablefilter.c
index 531df67cfb..d09ee4912f 100644
--- a/app/core/gimpdrawablefilter.c
+++ b/app/core/gimpdrawablefilter.c
@@ -538,13 +538,9 @@ static void
gimp_drawable_filter_sync_clip (GimpDrawableFilter *filter,
gboolean sync_region)
{
- gboolean clip = filter->clip;
+ gboolean clip;
- if (! clip)
- {
- if (! GIMP_IS_LAYER (filter->drawable))
- clip = TRUE;
- }
+ clip = gimp_item_get_clip (GIMP_ITEM (filter->drawable), filter->clip);
if (! clip)
{
diff --git a/app/core/gimpimage-item-list.c b/app/core/gimpimage-item-list.c
index 3a801d5405..6b6bad48fa 100644
--- a/app/core/gimpimage-item-list.c
+++ b/app/core/gimpimage-item-list.c
@@ -161,8 +161,13 @@ gimp_image_item_list_flip (GimpImage *image,
}
for (l = list; l; l = g_list_next (l))
- gimp_item_flip (GIMP_ITEM (l->data), context,
- flip_type, axis, clip_result);
+ {
+ GimpItem *item = l->data;
+
+ gimp_item_flip (item, context,
+ flip_type, axis,
+ gimp_item_get_clip (item, clip_result));
+ }
if (list->next)
{
@@ -200,8 +205,13 @@ gimp_image_item_list_rotate (GimpImage *image,
}
for (l = list; l; l = g_list_next (l))
- gimp_item_rotate (GIMP_ITEM (l->data), context,
- rotate_type, center_x, center_y, clip_result);
+ {
+ GimpItem *item = l->data;
+
+ gimp_item_rotate (item, context,
+ rotate_type, center_x, center_y,
+ gimp_item_get_clip (item, clip_result));
+ }
if (list->next)
{
@@ -251,13 +261,16 @@ gimp_image_item_list_transform (GimpImage *image,
for (l = list; l; l = g_list_next (l))
{
+ GimpItem *item = l->data;
+
if (queue)
gimp_object_queue_pop (queue);
- gimp_item_transform (GIMP_ITEM (l->data), context,
+ gimp_item_transform (item, context,
matrix, direction,
interpolation_type,
- clip_result, progress);
+ gimp_item_get_clip (item, clip_result),
+ progress);
}
if (list->next)
diff --git a/app/core/gimpitem-linked.c b/app/core/gimpitem-linked.c
index e1ff330cc7..9c876e3829 100644
--- a/app/core/gimpitem-linked.c
+++ b/app/core/gimpitem-linked.c
@@ -134,7 +134,6 @@ gimp_item_linked_rotate (GimpItem *item,
{
GimpImage *image;
GList *items;
- GList *channels;
g_return_if_fail (GIMP_IS_ITEM (item));
g_return_if_fail (GIMP_IS_CONTEXT (context));
@@ -144,30 +143,14 @@ gimp_item_linked_rotate (GimpItem *item,
image = gimp_item_get_image (item);
items = gimp_image_item_list_get_list (image,
- GIMP_ITEM_TYPE_LAYERS |
- GIMP_ITEM_TYPE_VECTORS,
+ GIMP_ITEM_TYPE_ALL,
GIMP_ITEM_SET_LINKED);
items = gimp_image_item_list_filter (items);
- channels = gimp_image_item_list_get_list (image,
- GIMP_ITEM_TYPE_CHANNELS,
- GIMP_ITEM_SET_LINKED);
- channels = gimp_image_item_list_filter (channels);
-
- if (items && channels)
- gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
- C_("undo-type", "Rotate Items"));
-
gimp_image_item_list_rotate (image, items, context,
rotate_type, center_x, center_y, clip_result);
- gimp_image_item_list_rotate (image, channels, context,
- rotate_type, center_x, center_y, TRUE);
-
- if (items && channels)
- gimp_image_undo_group_end (image);
g_list_free (items);
- g_list_free (channels);
}
void
diff --git a/app/pdb/drawable-transform-cmds.c b/app/pdb/drawable-transform-cmds.c
index 6fef9b9c40..ea469a7c2a 100644
--- a/app/pdb/drawable-transform-cmds.c
+++ b/app/pdb/drawable-transform-cmds.c
@@ -94,6 +94,8 @@ drawable_transform_flip_simple_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_flip (GIMP_ITEM (drawable), context,
flip_type, axis, clip_result);
}
@@ -178,6 +180,8 @@ drawable_transform_flip_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation,
@@ -268,6 +272,8 @@ drawable_transform_flip_default_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
@@ -367,6 +373,8 @@ drawable_transform_perspective_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation,
@@ -467,6 +475,8 @@ drawable_transform_perspective_default_invoker (GimpProcedure *procedure
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
@@ -540,6 +550,8 @@ drawable_transform_rotate_simple_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_rotate (GIMP_ITEM (drawable), context,
rotate_type, cx, cy,
clip_result);
@@ -629,6 +641,8 @@ drawable_transform_rotate_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation,
@@ -723,6 +737,8 @@ drawable_transform_rotate_default_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
@@ -812,6 +828,8 @@ drawable_transform_scale_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation,
@@ -903,6 +921,8 @@ drawable_transform_scale_default_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
@@ -989,6 +1009,8 @@ drawable_transform_shear_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation,
@@ -1076,6 +1098,8 @@ drawable_transform_shear_default_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
@@ -1173,6 +1197,8 @@ drawable_transform_2d_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation,
@@ -1271,6 +1297,8 @@ drawable_transform_2d_default_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
@@ -1376,6 +1404,8 @@ drawable_transform_matrix_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation,
@@ -1482,6 +1512,8 @@ drawable_transform_matrix_default_invoker (GimpProcedure *procedure,
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
diff --git a/app/pdb/item-transform-cmds.c b/app/pdb/item-transform-cmds.c
index a4e103cf4d..ca1eb771f4 100644
--- a/app/pdb/item-transform-cmds.c
+++ b/app/pdb/item-transform-cmds.c
@@ -159,7 +159,8 @@ item_transform_flip_simple_invoker (GimpProcedure *procedure,
{
gimp_item_flip (item, context,
flip_type, axis,
- pdb_context->transform_resize);
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize));
}
}
}
@@ -252,7 +253,8 @@ item_transform_flip_invoker (GimpProcedure *procedure,
gimp_item_transform (item, context, &matrix,
pdb_context->transform_direction,
pdb_context->interpolation,
- pdb_context->transform_resize,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
progress);
}
@@ -360,7 +362,8 @@ item_transform_perspective_invoker (GimpProcedure *procedure,
gimp_item_transform (item, context, &matrix,
pdb_context->transform_direction,
pdb_context->interpolation,
- pdb_context->transform_resize,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
progress);
}
@@ -450,7 +453,8 @@ item_transform_rotate_simple_invoker (GimpProcedure *procedure,
gimp_item_rotate (item, context,
rotate_type,
center_x, center_y,
- pdb_context->transform_resize);
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize));
}
}
}
@@ -548,7 +552,8 @@ item_transform_rotate_invoker (GimpProcedure *procedure,
gimp_item_transform (item, context, &matrix,
pdb_context->transform_direction,
pdb_context->interpolation,
- pdb_context->transform_resize,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
progress);
}
@@ -648,7 +653,8 @@ item_transform_scale_invoker (GimpProcedure *procedure,
gimp_item_transform (item, context, &matrix,
pdb_context->transform_direction,
pdb_context->interpolation,
- pdb_context->transform_resize,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
progress);
}
@@ -743,7 +749,8 @@ item_transform_shear_invoker (GimpProcedure *procedure,
gimp_item_transform (item, context, &matrix,
pdb_context->transform_direction,
pdb_context->interpolation,
- pdb_context->transform_resize,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
progress);
}
@@ -849,7 +856,8 @@ item_transform_2d_invoker (GimpProcedure *procedure,
gimp_item_transform (item, context, &matrix,
pdb_context->transform_direction,
pdb_context->interpolation,
- pdb_context->transform_resize,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
progress);
}
@@ -963,7 +971,8 @@ item_transform_matrix_invoker (GimpProcedure *procedure,
gimp_item_transform (item, context, &matrix,
pdb_context->transform_direction,
pdb_context->interpolation,
- pdb_context->transform_resize,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
progress);
}
diff --git a/app/pdb/transform-tools-cmds.c b/app/pdb/transform-tools-cmds.c
index 845a18d796..cefa0debc6 100644
--- a/app/pdb/transform-tools-cmds.c
+++ b/app/pdb/transform-tools-cmds.c
@@ -91,7 +91,8 @@ flip_invoker (GimpProcedure *procedure,
else
{
gimp_item_flip (GIMP_ITEM (drawable), context,
- flip_type, axis, FALSE);
+ flip_type, axis,
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE));
}
}
}
@@ -187,7 +188,8 @@ perspective_invoker (GimpProcedure *procedure,
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation,
- FALSE, progress);
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
}
if (progress)
@@ -271,7 +273,8 @@ rotate_invoker (GimpProcedure *procedure,
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation,
- FALSE, progress);
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
}
if (progress)
@@ -362,7 +365,8 @@ scale_invoker (GimpProcedure *procedure,
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation,
- FALSE, progress);
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
}
if (progress)
@@ -448,7 +452,8 @@ shear_invoker (GimpProcedure *procedure,
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation,
- FALSE, progress);
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
}
if (progress)
@@ -538,7 +543,8 @@ transform_2d_invoker (GimpProcedure *procedure,
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation,
- FALSE, progress);
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
}
if (progress)
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index 04f9250526..3fb17f5317 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -1165,7 +1165,7 @@ gimp_filter_tool_update_dialog (GimpFilterTool *filter_tool)
{
gtk_widget_set_visible (
filter_tool->clip_combo,
- GIMP_IS_LAYER (tool->drawable) &&
+ gimp_item_get_clip (GIMP_ITEM (tool->drawable), FALSE) == FALSE &&
! gimp_gegl_node_is_point_operation (filter_tool->operation));
gtk_widget_hide (filter_tool->region_combo);
diff --git a/app/tools/gimpfliptool.c b/app/tools/gimpfliptool.c
index 49cc9a1247..24688d7a73 100644
--- a/app/tools/gimpfliptool.c
+++ b/app/tools/gimpfliptool.c
@@ -371,16 +371,9 @@ gimp_flip_tool_transform (GimpTransformTool *tr_tool,
if (orig_buffer)
{
/* this happens when transforming a selection cut out of a
- * normal drawable, or the selection
+ * normal drawable
*/
- /* always clip the selection and unfloated channels
- * so they keep their size
- */
- if (GIMP_IS_CHANNEL (active_item) &&
- ! babl_format_has_alpha (gegl_buffer_get_format (orig_buffer)))
- clip_result = TRUE;
-
ret = gimp_drawable_transform_buffer_flip (GIMP_DRAWABLE (active_item),
context,
orig_buffer,
@@ -396,11 +389,6 @@ gimp_flip_tool_transform (GimpTransformTool *tr_tool,
{
/* this happens for entire drawables, paths and layer groups */
- /* always clip layer masks so they keep their size
- */
- if (GIMP_IS_CHANNEL (active_item))
- clip_result = TRUE;
-
if (gimp_item_get_linked (active_item))
{
gimp_item_linked_flip (active_item, context,
@@ -408,6 +396,8 @@ gimp_flip_tool_transform (GimpTransformTool *tr_tool,
}
else
{
+ clip_result = gimp_item_get_clip (active_item, clip_result);
+
gimp_item_flip (active_item, context,
flip_type, axis, clip_result);
}
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index e0ff30ffbc..1a87f4aa52 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -146,16 +146,9 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
if (orig_buffer)
{
/* this happens when transforming a selection cut out of a
- * normal drawable, or the selection
+ * normal drawable
*/
- /* always clip the selection and unfloated channels
- * so they keep their size
- */
- if (GIMP_IS_CHANNEL (active_item) &&
- ! babl_format_has_alpha (gegl_buffer_get_format (orig_buffer)))
- clip = GIMP_TRANSFORM_RESIZE_CLIP;
-
ret = gimp_drawable_transform_buffer_affine (GIMP_DRAWABLE (active_item),
context,
orig_buffer,
@@ -185,10 +178,7 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
}
else
{
- /* always clip layer masks so they keep their size
- */
- if (GIMP_IS_CHANNEL (active_item))
- clip = GIMP_TRANSFORM_RESIZE_CLIP;
+ clip = gimp_item_get_clip (active_item, clip);
gimp_item_transform (active_item, context,
&tr_tool->transform,
@@ -268,14 +258,13 @@ gimp_transform_tool_confirm (GimpTransformTool *tr_tool,
orig_bounds.width = gimp_item_get_width (item);
orig_bounds.height = gimp_item_get_height (item);
+
+ clip = gimp_item_get_clip (item, clip);
}
else
{
orig_bounds = selection_bounds;
}
-
- clip = gimp_drawable_transform_get_effective_clip (
- GIMP_DRAWABLE (item), NULL, clip);
}
else
{
@@ -283,7 +272,7 @@ gimp_transform_tool_confirm (GimpTransformTool *tr_tool,
&orig_bounds.x, &orig_bounds.y,
&orig_bounds.width, &orig_bounds.height);
- clip = GIMP_TRANSFORM_RESIZE_ADJUST;
+ clip = gimp_item_get_clip (item, clip);
}
gimp_transform_resize_boundary (&transform, clip,
@@ -689,9 +678,6 @@ gimp_transform_tool_transform (GimpTransformTool *tr_tool,
break;
case GIMP_TRANSFORM_TYPE_SELECTION:
- orig_buffer = g_object_ref (gimp_drawable_get_buffer (GIMP_DRAWABLE (active_item)));
- break;
-
case GIMP_TRANSFORM_TYPE_PATH:
break;
}
@@ -726,17 +712,7 @@ gimp_transform_tool_transform (GimpTransformTool *tr_tool,
}
break;
- case GIMP_TRANSFORM_TYPE_SELECTION:
- if (new_buffer)
- {
- gimp_channel_push_undo (GIMP_CHANNEL (active_item), NULL);
-
- gimp_drawable_set_buffer (GIMP_DRAWABLE (active_item),
- FALSE, NULL, new_buffer);
- g_object_unref (new_buffer);
- }
- break;
-
+ case GIMP_TRANSFORM_TYPE_SELECTION:
case GIMP_TRANSFORM_TYPE_PATH:
/* Nothing to be done */
break;
diff --git a/pdb/groups/drawable_transform.pdb b/pdb/groups/drawable_transform.pdb
index 6074b8468b..8d5707ab74 100644
--- a/pdb/groups/drawable_transform.pdb
+++ b/pdb/groups/drawable_transform.pdb
@@ -72,6 +72,8 @@ $assemble_matrix
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation,
@@ -139,6 +141,8 @@ $assemble_matrix
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
@@ -205,6 +209,8 @@ sub drawable_transform_flip_simple {
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_flip (GIMP_ITEM (drawable), context,
flip_type, axis, clip_result);
}
@@ -453,6 +459,8 @@ sub drawable_transform_rotate_simple {
}
else
{
+ clip_result = gimp_item_get_clip (GIMP_ITEM (drawable), clip_result);
+
gimp_item_rotate (GIMP_ITEM (drawable), context,
rotate_type, cx, cy,
clip_result);
diff --git a/pdb/groups/item_transform.pdb b/pdb/groups/item_transform.pdb
index f5d93735a6..9cf3a28034 100644
--- a/pdb/groups/item_transform.pdb
+++ b/pdb/groups/item_transform.pdb
@@ -92,7 +92,8 @@ $assemble_matrix
gimp_item_transform (item, context, &matrix,
pdb_context->transform_direction,
pdb_context->interpolation,
- pdb_context->transform_resize,
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize),
progress);
}
@@ -256,7 +257,8 @@ HELP
{
gimp_item_flip (item, context,
flip_type, axis,
- pdb_context->transform_resize);
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize));
}
}
}
@@ -507,7 +509,8 @@ HELP
gimp_item_rotate (item, context,
rotate_type,
center_x, center_y,
- pdb_context->transform_resize);
+ gimp_item_get_clip (
+ item, pdb_context->transform_resize));
}
}
}
diff --git a/pdb/groups/transform_tools.pdb b/pdb/groups/transform_tools.pdb
index e1a83ac000..cdfa32e83a 100644
--- a/pdb/groups/transform_tools.pdb
+++ b/pdb/groups/transform_tools.pdb
@@ -61,7 +61,8 @@ sub flip {
else
{
gimp_item_flip (GIMP_ITEM (drawable), context,
- flip_type, axis, FALSE);
+ flip_type, axis,
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE));
}
}
}
@@ -159,7 +160,8 @@ sub perspective {
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation,
- FALSE, progress);
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
}
if (progress)
@@ -237,7 +239,8 @@ sub rotate {
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation,
- FALSE, progress);
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
}
if (progress)
@@ -326,7 +329,8 @@ sub scale {
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation,
- FALSE, progress);
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
}
if (progress)
@@ -407,7 +411,8 @@ sub shear {
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation,
- FALSE, progress);
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
}
if (progress)
@@ -491,7 +496,8 @@ sub transform_2d {
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation,
- FALSE, progress);
+ gimp_item_get_clip (GIMP_ITEM (drawable), FALSE),
+ progress);
}
if (progress)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]