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".
This commit is contained in:
Michael Natterer 2016-11-10 12:11:19 +01:00
parent e3115f1565
commit 0631f1c629
3 changed files with 15 additions and 6 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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,