[gimp/gimp-2-10] Issue #2473 - Transforming a layer doesn't properly transform its mask



commit 7ca3fe6576a5dfb472b9debbcf99e11d8fc41282
Author: Ell <ell_se yahoo com>
Date:   Sun Nov 11 02:10:44 2018 -0500

    Issue #2473 - Transforming a layer doesn't properly transform its mask
    
    In gimp_drawable_transform_buffer_affine(), avoid modifying the
    clipping mode when transforming layer masks, since this function is
    used (among other things) to transform layer masks together with
    their layer, in which case they should use the same clipping mode
    as the layer.
    
    This fixes a regression introduced by commit
    2ae823ba2b852c8f6d36a462db6b71662ffe61f0, causing layer masks to be
    transformed with a mismatched clipping mode during layer
    transforms, leading to discrepencies between the transformed layer
    and the transformed mask.
    
    This commit merely reverts the necessary part of above commit,
    fixing the regression, though note that this code is really up for
    some serious refactoring: the logic for determining which clipping
    mode to use when is spread all over the place.
    
    (cherry picked from commit 45fc30caa7f9ed6e0483dfee221e719650dae0b4)

 app/core/gimpdrawable-transform.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c
index ea21da426c..1fecefc06d 100644
--- a/app/core/gimpdrawable-transform.c
+++ b/app/core/gimpdrawable-transform.c
@@ -144,9 +144,16 @@ gimp_drawable_transform_buffer_affine (GimpDrawable            *drawable,
   u2 = u1 + gegl_buffer_get_width  (orig_buffer);
   v2 = v1 + gegl_buffer_get_height (orig_buffer);
 
-  clip_result = gimp_drawable_transform_get_effective_clip (drawable,
-                                                            orig_buffer,
-                                                            clip_result);
+  /*  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,


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