Commit 0631f1c6 authored by Michael Natterer's avatar Michael Natterer 😴
Browse files

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".
parent e3115f15
......@@ -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;
......
......@@ -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);
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment