[gegl] color-reduction: fix off by one in parameters
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] color-reduction: fix off by one in parameters
- Date: Fri, 26 Feb 2021 15:34:48 +0000 (UTC)
commit e66b1ca59c8fda0f4f567c96be5c5a9fae3384b1
Author: Øyvind Kolås <pippin gimp org>
Date: Fri Feb 26 16:32:29 2021 +0100
color-reduction: fix off by one in parameters
The quantization was producing one level more than specified in the
input, thus 2 levels would yield 3. Fixing issue #278.
operations/common/dither.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/operations/common/dither.c b/operations/common/dither.c
index c069efd8a..cc66e9d7e 100644
--- a/operations/common/dither.c
+++ b/operations/common/dither.c
@@ -553,10 +553,10 @@ process (GeglOperation *operation,
guint channel_levels [4];
const Babl *format = gegl_operation_get_format (operation,"output");
- channel_levels [0] = o->red_levels;
- channel_levels [1] = o->green_levels;
- channel_levels [2] = o->blue_levels;
- channel_levels [3] = o->alpha_levels;
+ channel_levels [0] = o->red_levels - 1;
+ channel_levels [1] = o->green_levels - 1;
+ channel_levels [2] = o->blue_levels - 1;
+ channel_levels [3] = o->alpha_levels - 1;
if (o->dither_method != GEGL_DITHER_FLOYD_STEINBERG)
process_standard (input, output, result, channel_levels,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]