[gimp] Bug 735895 - Precision Conversion "Dithering" dialog



commit 0631f1c6293bd3131d8e969178c2bea74387934c
Author: Michael Natterer <mitch gimp org>
Date:   Thu Nov 10 12:11:19 2016 +0100

    Bug 735895 - Precision Conversion "Dithering" dialog
    
    Don't offer dithering options when converting to 16 bit, it doesn't
    make much sense to dither for anything but 8 bit. Thanks to Elle for
    testing that this assumption is indeed true.
    
    Use a properly commented #define instead of just a hardcoded "8 bits"
    to make clear that this is a pure GUI "restriction".

 app/actions/image-commands.c           |    6 +++---
 app/dialogs/convert-precision-dialog.c |    7 ++++---
 app/dialogs/convert-precision-dialog.h |    8 ++++++++
 3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index 9f49cfa..8d92302 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -1195,11 +1195,11 @@ image_convert_precision_callback (GtkWidget        *dialog,
   new_bits = (babl_format_get_bytes_per_pixel (new_format) * 8 /
               babl_format_get_n_components (new_format));
 
-  if (new_bits >= old_bits || new_bits > 16)
+  if (new_bits >= old_bits ||
+      new_bits >  CONVERT_PRECISION_DIALOG_MAX_DITHER_BITS)
     {
       /*  don't dither if we are converting to a higher bit depth,
-       *  or to more than 16 bits (gegl:color-reduction only does
-       *  16 bits).
+       *  or to more than MAX_DITHER_BITS.
        */
       layer_dither_method      = GEGL_DITHER_NONE;
       text_layer_dither_method = GEGL_DITHER_NONE;
diff --git a/app/dialogs/convert-precision-dialog.c b/app/dialogs/convert-precision-dialog.c
index ed50fe2..0c9fff3 100644
--- a/app/dialogs/convert-precision-dialog.c
+++ b/app/dialogs/convert-precision-dialog.c
@@ -111,10 +111,11 @@ convert_precision_dialog_new (GimpImage                    *image,
   new_bits = (babl_format_get_bytes_per_pixel (new_format) * 8 /
               babl_format_get_n_components (new_format));
 
-  /*  don't dither if we are converting to a higher bit depth, or to
-   *  more than 16 bits (gegl:color-reduction only does 16 bits).
+  /*  don't dither if we are converting to a higher bit depth,
+   *  or to more than MAX_DITHER_BITS.
    */
-  dither = (new_bits < old_bits && new_bits <= 16);
+  dither = (new_bits <  old_bits &&
+            new_bits <= CONVERT_PRECISION_DIALOG_MAX_DITHER_BITS);
 
   linear = gimp_babl_format_get_linear (old_format);
 
diff --git a/app/dialogs/convert-precision-dialog.h b/app/dialogs/convert-precision-dialog.h
index af13c60..d34ba59 100644
--- a/app/dialogs/convert-precision-dialog.h
+++ b/app/dialogs/convert-precision-dialog.h
@@ -19,6 +19,14 @@
 #define __CONVERT_PRECISION_DIALOG_H__
 
 
+/*  Don't offer dithering when converting down to more than this
+ *  number of bits per component. Note that gegl:color-reduction would
+ *  do 16 bit, so this is a limitation of the GUI to values that make
+ *  sense. See bug #735895.
+ */
+#define CONVERT_PRECISION_DIALOG_MAX_DITHER_BITS 8
+
+
 typedef void (* GimpConvertPrecisionCallback) (GtkWidget        *dialog,
                                                GimpImage        *image,
                                                GimpPrecision     precision,


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