Commit 9424d42d authored by Michael Natterer's avatar Michael Natterer 😴

pdb: apply recent fixes to the deprecated transform procedures

Don't transform the tiles of group layers, use the item transform API
instead. Go the same code path if there is no selection.
parent 1a359a13
This diff is collapsed.
......@@ -28,6 +28,7 @@
#include "config/gimpcoreconfig.h"
#include "core/gimp-transform-utils.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpdrawable-transform.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
......@@ -72,10 +73,19 @@ flip_invoker (GimpProcedure *procedure,
gimp_transform_get_flip_axis (x, y, width, height,
flip_type, TRUE, &axis);
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, FALSE))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, FALSE))
{
success = FALSE;
}
}
else
{
gimp_item_flip (GIMP_ITEM (drawable), context,
flip_type, axis, FALSE);
}
}
}
......@@ -152,13 +162,24 @@ perspective_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Perspective"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
success = FALSE;
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
......@@ -223,13 +244,24 @@ rotate_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Rotating"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
success = FALSE;
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
......@@ -301,13 +333,24 @@ scale_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Scaling"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
......@@ -374,13 +417,24 @@ shear_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Shearing"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
success = FALSE;
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
......@@ -452,12 +506,23 @@ transform_2d_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("2D Transform"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
success = FALSE;
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
......
......@@ -54,12 +54,23 @@ $assemble_matrix
if (progress)
gimp_progress_start (progress, _(\"$progress_text\"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation, recursion_level,
clip_result, progress);
}
if (progress)
......@@ -106,14 +117,25 @@ $assemble_matrix
if (progress)
gimp_progress_start (progress, _(\"$progress_text\"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress);
}
if (progress)
gimp_progress_end (progress);
}
......@@ -161,12 +183,19 @@ sub drawable_transform_flip_simple {
gimp_transform_get_flip_axis (x, y, width, height,
flip_type, auto_center, &axis);
if (! gimp_drawable_transform_flip (drawable, context,
flip_type,
axis,
clip_result))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, clip_result))
{
success = FALSE;
}
}
else
{
gimp_item_flip (GIMP_ITEM (drawable), context,
flip_type, axis, clip_result);
}
}
}
......@@ -399,12 +428,21 @@ sub drawable_transform_rotate_simple {
gimp_transform_get_rotate_center (x, y, width, height,
auto_center, &cx, &cy);
if (! gimp_drawable_transform_rotate (drawable, context,
rotate_type,
cx, cy,
clip_result))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
if (! gimp_drawable_transform_rotate (drawable, context,
rotate_type, cx, cy,
clip_result))
{
success = FALSE;
}
}
else
{
success = FALSE;
gimp_item_rotate (GIMP_ITEM (drawable), context,
rotate_type, cx, cy,
clip_result);
}
}
}
......@@ -848,6 +886,7 @@ CODE
"config/gimpcoreconfig.h"
"core/gimp.h"
"core/gimp-transform-utils.h"
"core/gimpchannel.h"
"core/gimpimage.h"
"core/gimpdrawable.h"
"core/gimpdrawable-transform.h"
......
......@@ -47,10 +47,19 @@ sub flip {
gimp_transform_get_flip_axis (x, y, width, height,
flip_type, TRUE, &axis);
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, FALSE))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, FALSE))
{
success = FALSE;
}
}
else
{
gimp_item_flip (GIMP_ITEM (drawable), context,
flip_type, axis, FALSE);
}
}
}
......@@ -129,13 +138,24 @@ sub perspective {
if (progress)
gimp_progress_start (progress, _("Perspective"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
success = FALSE;
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
......@@ -194,13 +214,24 @@ sub rotate {
if (progress)
gimp_progress_start (progress, _("Rotating"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
success = FALSE;
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
......@@ -270,13 +301,24 @@ sub scale {
if (progress)
gimp_progress_start (progress, _("Scaling"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
......@@ -338,13 +380,24 @@ sub shear {
if (progress)
gimp_progress_start (progress, _("Shearing"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
success = FALSE;
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
......@@ -410,12 +463,23 @@ sub transform_2d {
if (progress)
gimp_progress_start (progress, _("2D Transform"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
success = FALSE;
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
......@@ -430,6 +494,7 @@ CODE
@headers = qw("libgimpmath/gimpmath.h"
"config/gimpcoreconfig.h"
"core/gimp.h"
"core/gimpchannel.h"
"core/gimp-transform-utils.h"
"core/gimpimage.h"
"core/gimpdrawable.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment