[gimp] app: always use the image's mask format for quick mask



commit 8e9a89d0b93cb4cca281b5393c7f8480612975d5
Author: Ell <ell_se yahoo com>
Date:   Tue Jun 28 10:29:20 2016 +0000

    app: always use the image's mask format for quick mask
    
    Previously, activating quick mask while the selection was empty
    would use the image's channel format for the mask, instead of its
    mask format; these formats are different for sRGB images.

 app/core/gimpimage-quick-mask.c |   40 +++++++++++---------------------------
 1 files changed, 12 insertions(+), 28 deletions(-)
---
diff --git a/app/core/gimpimage-quick-mask.c b/app/core/gimpimage-quick-mask.c
index bc13090..babaa91 100644
--- a/app/core/gimpimage-quick-mask.c
+++ b/app/core/gimpimage-quick-mask.c
@@ -83,41 +83,25 @@ gimp_image_set_quick_mask_state (GimpImage *image,
     {
       if (! mask)
         {
+          GimpLayer *floating_sel;
+
           gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_QUICK_MASK,
                                        C_("undo-type", "Enable Quick Mask"));
 
-          if (gimp_channel_is_empty (selection))
-            {
-              /* if no selection */
-
-              GimpLayer *floating_sel = gimp_image_get_floating_selection (image);
-
-              if (floating_sel)
-                floating_sel_to_layer (floating_sel, NULL);
-
-              mask = gimp_channel_new (image,
-                                       gimp_image_get_width  (image),
-                                       gimp_image_get_height (image),
-                                       GIMP_IMAGE_QUICK_MASK_NAME,
-                                       &private->quick_mask_color);
+          floating_sel = gimp_image_get_floating_selection (image);
 
-              /* Clear the mask */
-              gimp_channel_clear (mask, NULL, FALSE);
-            }
-          else
-            {
-              /* if selection */
+          if (floating_sel)
+            floating_sel_to_layer (floating_sel, NULL);
 
-              mask = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
-                                                        GIMP_TYPE_CHANNEL));
+          mask = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (selection),
+                                                    GIMP_TYPE_CHANNEL));
 
-              /* Clear the selection */
-              gimp_channel_clear (selection, NULL, TRUE);
+          if (! gimp_channel_is_empty (selection))
+            gimp_channel_clear (selection, NULL, TRUE);
 
-              gimp_channel_set_color (mask, &private->quick_mask_color, FALSE);
-              gimp_item_rename (GIMP_ITEM (mask), GIMP_IMAGE_QUICK_MASK_NAME,
-                                NULL);
-            }
+          gimp_channel_set_color (mask, &private->quick_mask_color, FALSE);
+          gimp_item_rename (GIMP_ITEM (mask), GIMP_IMAGE_QUICK_MASK_NAME,
+                            NULL);
 
           if (private->quick_mask_inverted)
             gimp_channel_invert (mask, FALSE);


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