[gimp] pdb: fix image-mask transforms
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] pdb: fix image-mask transforms
- Date: Fri, 9 Aug 2019 19:25:17 +0000 (UTC)
commit ce6dfd3194bebc18bcdaba6d8cab0d18aaf819c1
Author: Ell <ell_se yahoo com>
Date: Fri Aug 9 22:18:24 2019 +0300
pdb: fix image-mask transforms
In the various PDB transform functions, avoid erroneously creating
a floating selection when transforming the image mask, and rather
transform the mask normally.
app/pdb/item-transform-cmds.c | 63 ++++++++++++++++++++++++++++++-------------
pdb/groups/item_transform.pdb | 21 ++++++++++-----
2 files changed, 60 insertions(+), 24 deletions(-)
---
diff --git a/app/pdb/item-transform-cmds.c b/app/pdb/item-transform-cmds.c
index ca1eb771f4..bcf210e3fe 100644
--- a/app/pdb/item-transform-cmds.c
+++ b/app/pdb/item-transform-cmds.c
@@ -125,6 +125,8 @@ item_transform_flip_simple_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
gint off_x, off_y;
gimp_item_get_offset (item, &off_x, &off_y);
@@ -134,9 +136,10 @@ item_transform_flip_simple_invoker (GimpProcedure *procedure,
gimp_transform_get_flip_axis (x, y, width, height,
flip_type, auto_center, &axis);
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@@ -208,6 +211,8 @@ item_transform_flip_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@@ -222,9 +227,10 @@ item_transform_flip_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Flipping"));
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@@ -314,6 +320,8 @@ item_transform_perspective_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@@ -331,9 +339,10 @@ item_transform_perspective_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Perspective"));
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@@ -415,6 +424,8 @@ item_transform_rotate_simple_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
gint off_x, off_y;
gimp_item_get_offset (item, &off_x, &off_y);
@@ -424,9 +435,10 @@ item_transform_rotate_simple_invoker (GimpProcedure *procedure,
gimp_transform_get_rotate_center (x, y, width, height,
auto_center, ¢er_x, ¢er_y);
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@@ -502,6 +514,8 @@ item_transform_rotate_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@@ -521,9 +535,10 @@ item_transform_rotate_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Rotating"));
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@@ -606,6 +621,8 @@ item_transform_scale_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@@ -622,9 +639,10 @@ item_transform_scale_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Scaling"));
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@@ -702,6 +720,8 @@ item_transform_shear_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@@ -718,9 +738,10 @@ item_transform_shear_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Shearing"));
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@@ -808,6 +829,8 @@ item_transform_2d_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@@ -825,9 +848,10 @@ item_transform_2d_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("2D Transform"));
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@@ -919,6 +943,8 @@ item_transform_matrix_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@@ -940,9 +966,10 @@ item_transform_matrix_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("2D Transforming"));
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
diff --git a/pdb/groups/item_transform.pdb b/pdb/groups/item_transform.pdb
index 9cf3a28034..81ee4175ef 100644
--- a/pdb/groups/item_transform.pdb
+++ b/pdb/groups/item_transform.pdb
@@ -48,6 +48,8 @@ $success_check
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@@ -61,9 +63,10 @@ $assemble_matrix
if (progress)
gimp_progress_start (progress, FALSE, _(\"$progress_text\"));
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@@ -223,6 +226,8 @@ HELP
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
gint off_x, off_y;
gimp_item_get_offset (item, &off_x, &off_y);
@@ -232,9 +237,10 @@ HELP
gimp_transform_get_flip_axis (x, y, width, height,
flip_type, auto_center, &axis);
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@@ -471,6 +477,8 @@ HELP
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
+ GimpImage *image = gimp_item_get_image (item);
+ GimpChannel *mask = gimp_image_get_mask (image);
gint off_x, off_y;
gimp_item_get_offset (item, &off_x, &off_y);
@@ -480,9 +488,10 @@ HELP
gimp_transform_get_rotate_center (x, y, width, height,
auto_center, ¢er_x, ¢er_y);
- if (GIMP_IS_DRAWABLE (item) &&
+ if (GIMP_IS_DRAWABLE (item) &&
+ item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
- ! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
+ ! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]