[gimp] app, pdb: use GeglDitherMethod instead of simply an integer



commit 87d38194d760ca5ee4b6a141d4d2c99c3b6c431e
Author: Michael Natterer <mitch gimp org>
Date:   Mon Nov 7 20:41:39 2016 +0100

    app, pdb: use GeglDitherMethod instead of simply an integer

 app/actions/image-commands.c           |    5 ++++-
 app/core/gimp-edit.c                   |    2 +-
 app/core/gimpchannel.c                 |   25 +++++++++++++------------
 app/core/gimpdrawable.c                |   12 ++++++------
 app/core/gimpdrawable.h                |    8 ++++----
 app/core/gimpgrouplayer.c              |   20 ++++++++++----------
 app/core/gimpimage-convert-indexed.c   |    2 +-
 app/core/gimpimage-convert-precision.c |   12 ++++++------
 app/core/gimpimage-convert-precision.h |   12 ++++++------
 app/core/gimpimage-convert-type.c      |    3 ++-
 app/core/gimplayer.c                   |   24 ++++++++++++------------
 app/core/gimplayermask.c               |    8 ++++----
 app/core/gimpselection.c               |    8 ++++----
 app/pdb/image-convert-cmds.c           |    6 +++++-
 app/text/gimptextlayer.c               |   12 +++++++-----
 app/text/gimptextundo.c                |    3 ++-
 tools/pdbgen/pdb/image_convert.pdb     |    6 +++++-
 17 files changed, 92 insertions(+), 76 deletions(-)
---
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index 4cc9b4c..890c641 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -415,7 +415,10 @@ image_convert_gamma_cmd_callback (GtkAction *action,
   precision = gimp_babl_precision (gimp_image_get_component_type (image),
                                    value);
 
-  gimp_image_convert_precision (image, precision, 0, 0, 0,
+  gimp_image_convert_precision (image, precision,
+                                GEGL_DITHER_NONE,
+                                GEGL_DITHER_NONE,
+                                GEGL_DITHER_NONE,
                                 GIMP_PROGRESS (display));
   gimp_image_flush (image);
 }
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index 67de8e5..273e092 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -405,7 +405,7 @@ gimp_edit_paste (GimpImage     *image,
                                           gimp_drawable_get_precision (drawable),
                                           TRUE,
                                           NULL,
-                                          0, 0,
+                                          GEGL_DITHER_NONE, GEGL_DITHER_NONE,
                                           FALSE, NULL);
             }
           break;
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index b36acf2..5ea4f9b 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -147,8 +147,8 @@ static void       gimp_channel_convert_type  (GimpDrawable      *drawable,
                                               GimpImage         *dest_image,
                                               const Babl        *new_format,
                                               GimpColorProfile  *dest_profile,
-                                              gint               layer_dither_type,
-                                              gint               mask_dither_type,
+                                              GeglDitherMethod   layer_dither_type,
+                                              GeglDitherMethod   mask_dither_type,
                                               gboolean           push_undo,
                                               GimpProgress      *progress);
 static void gimp_channel_invalidate_boundary   (GimpDrawable       *drawable);
@@ -570,7 +570,8 @@ gimp_channel_convert (GimpItem  *item,
                                   GIMP_GRAY,
                                   gimp_image_get_precision (dest_image),
                                   gimp_drawable_has_alpha (drawable),
-                                  NULL, 0, 0,
+                                  NULL,
+                                  GEGL_DITHER_NONE, GEGL_DITHER_NONE,
                                   FALSE, NULL);
     }
 
@@ -944,14 +945,14 @@ gimp_channel_to_selection (GimpItem       *item,
 }
 
 static void
-gimp_channel_convert_type (GimpDrawable      *drawable,
-                           GimpImage         *dest_image,
-                           const Babl        *new_format,
-                           GimpColorProfile  *dest_profile,
-                           gint               layer_dither_type,
-                           gint               mask_dither_type,
-                           gboolean           push_undo,
-                           GimpProgress      *progress)
+gimp_channel_convert_type (GimpDrawable     *drawable,
+                           GimpImage        *dest_image,
+                           const Babl       *new_format,
+                           GimpColorProfile *dest_profile,
+                           GeglDitherMethod  layer_dither_type,
+                           GeglDitherMethod  mask_dither_type,
+                           gboolean          push_undo,
+                           GimpProgress     *progress)
 {
   GeglBuffer *dest_buffer;
 
@@ -961,7 +962,7 @@ gimp_channel_convert_type (GimpDrawable      *drawable,
                                      gimp_item_get_height (GIMP_ITEM (drawable))),
                      new_format);
 
-  if (mask_dither_type == 0)
+  if (mask_dither_type == GEGL_DITHER_NONE)
     {
       gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
                         GEGL_ABYSS_NONE,
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index b1e2731..fb58fdb 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -157,8 +157,8 @@ static void       gimp_drawable_real_convert_type  (GimpDrawable      *drawable,
                                                     GimpImage         *dest_image,
                                                     const Babl        *new_format,
                                                     GimpColorProfile  *dest_profile,
-                                                    gint               layer_dither_type,
-                                                    gint               mask_dither_type,
+                                                    GeglDitherMethod   layer_dither_type,
+                                                    GeglDitherMethod   mask_dither_type,
                                                     gboolean           push_undo,
                                                     GimpProgress      *progress);
 
@@ -789,8 +789,8 @@ gimp_drawable_real_convert_type (GimpDrawable      *drawable,
                                  GimpImage         *dest_image,
                                  const Babl        *new_format,
                                  GimpColorProfile  *dest_profile,
-                                 gint               layer_dither_type,
-                                 gint               mask_dither_type,
+                                 GeglDitherMethod   layer_dither_type,
+                                 GeglDitherMethod   mask_dither_type,
                                  gboolean           push_undo,
                                  GimpProgress      *progress)
 {
@@ -1035,8 +1035,8 @@ gimp_drawable_convert_type (GimpDrawable      *drawable,
                             GimpPrecision      new_precision,
                             gboolean           new_has_alpha,
                             GimpColorProfile  *dest_profile,
-                            gint               layer_dither_type,
-                            gint               mask_dither_type,
+                            GeglDitherMethod   layer_dither_type,
+                            GeglDitherMethod   mask_dither_type,
                             gboolean           push_undo,
                             GimpProgress      *progress)
 {
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index eba82d9..ee33ba5 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -65,8 +65,8 @@ struct _GimpDrawableClass
                                            GimpImage            *dest_image,
                                            const Babl           *new_format,
                                            GimpColorProfile     *dest_profile,
-                                           gint                  layer_dither_type,
-                                           gint                  mask_dither_type,
+                                           GeglDitherMethod      layer_dither_type,
+                                           GeglDitherMethod      mask_dither_type,
                                            gboolean              push_undo,
                                            GimpProgress         *progress);
   void          (* apply_buffer)          (GimpDrawable         *drawable,
@@ -144,8 +144,8 @@ void            gimp_drawable_convert_type       (GimpDrawable       *drawable,
                                                   GimpPrecision       new_precision,
                                                   gboolean            new_has_alpha,
                                                   GimpColorProfile   *dest_profile,
-                                                  gint                layer_dither_type,
-                                                  gint                mask_dither_type,
+                                                  GeglDitherMethod    layer_dither_type,
+                                                  GeglDitherMethod    mask_dither_type,
                                                   gboolean            push_undo,
                                                   GimpProgress       *progress);
 
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index 981fb33..94fe87b 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -141,8 +141,8 @@ static void            gimp_group_layer_convert_type (GimpDrawable      *drawabl
                                                       GimpImage         *dest_image,
                                                       const Babl        *new_format,
                                                       GimpColorProfile  *dest_profile,
-                                                      gint               layer_dither_type,
-                                                      gint               mask_dither_type,
+                                                      GeglDitherMethod   layer_dither_type,
+                                                      GeglDitherMethod   mask_dither_type,
                                                       gboolean           push_undo,
                                                       GimpProgress      *progress);
 
@@ -876,14 +876,14 @@ get_projection_format (GimpProjectable   *projectable,
 }
 
 static void
-gimp_group_layer_convert_type (GimpDrawable      *drawable,
-                               GimpImage         *dest_image,
-                               const Babl        *new_format,
-                               GimpColorProfile  *dest_profile,
-                               gint               layer_dither_type,
-                               gint               mask_dither_type,
-                               gboolean           push_undo,
-                               GimpProgress      *progress)
+gimp_group_layer_convert_type (GimpDrawable     *drawable,
+                               GimpImage        *dest_image,
+                               const Babl       *new_format,
+                               GimpColorProfile *dest_profile,
+                               GeglDitherMethod  layer_dither_type,
+                               GeglDitherMethod  mask_dither_type,
+                               gboolean          push_undo,
+                               GimpProgress     *progress)
 {
   GimpGroupLayer        *group   = GIMP_GROUP_LAYER (drawable);
   GimpGroupLayerPrivate *private = GET_PRIVATE (drawable);
diff --git a/app/core/gimpimage-convert-indexed.c b/app/core/gimpimage-convert-indexed.c
index 9edaae7..11defc5 100644
--- a/app/core/gimpimage-convert-indexed.c
+++ b/app/core/gimpimage-convert-indexed.c
@@ -998,7 +998,7 @@ gimp_image_convert_indexed (GimpImage               *image,
                                       gimp_drawable_get_precision (GIMP_DRAWABLE (layer)),
                                       gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)),
                                       dest_profile,
-                                      0, 0,
+                                      GEGL_DITHER_NONE, GEGL_DITHER_NONE,
                                       TRUE, NULL);
         }
     }
diff --git a/app/core/gimpimage-convert-precision.c b/app/core/gimpimage-convert-precision.c
index 6b8777c..5f6a2ad 100644
--- a/app/core/gimpimage-convert-precision.c
+++ b/app/core/gimpimage-convert-precision.c
@@ -45,12 +45,12 @@
 
 
 void
-gimp_image_convert_precision (GimpImage     *image,
-                              GimpPrecision  precision,
-                              gint           layer_dither_type,
-                              gint           text_layer_dither_type,
-                              gint           mask_dither_type,
-                              GimpProgress  *progress)
+gimp_image_convert_precision (GimpImage        *image,
+                              GimpPrecision     precision,
+                              GeglDitherMethod  layer_dither_type,
+                              GeglDitherMethod  text_layer_dither_type,
+                              GeglDitherMethod  mask_dither_type,
+                              GimpProgress     *progress)
 {
   GimpColorProfile *old_profile;
   GimpColorProfile *new_profile = NULL;
diff --git a/app/core/gimpimage-convert-precision.h b/app/core/gimpimage-convert-precision.h
index 13140b3..6fc988c 100644
--- a/app/core/gimpimage-convert-precision.h
+++ b/app/core/gimpimage-convert-precision.h
@@ -22,12 +22,12 @@
 #define __GIMP_IMAGE_CONVERT_PRECISION_H__
 
 
-void   gimp_image_convert_precision (GimpImage     *image,
-                                     GimpPrecision  precision,
-                                     gint           layer_dither_type,
-                                     gint           text_layer_dither_type,
-                                     gint           mask_dither_type,
-                                     GimpProgress  *progress);
+void   gimp_image_convert_precision (GimpImage        *image,
+                                     GimpPrecision     precision,
+                                     GeglDitherMethod  layer_dither_type,
+                                     GeglDitherMethod  text_layer_dither_type,
+                                     GeglDitherMethod  mask_dither_type,
+                                     GimpProgress     *progress);
 
 
 #endif  /*  __GIMP_IMAGE_CONVERT_PRECISION_H__  */
diff --git a/app/core/gimpimage-convert-type.c b/app/core/gimpimage-convert-type.c
index 0b65f66..efbebde 100644
--- a/app/core/gimpimage-convert-type.c
+++ b/app/core/gimpimage-convert-type.c
@@ -137,7 +137,8 @@ gimp_image_convert_type (GimpImage          *image,
                                   new_type,
                                   gimp_drawable_get_precision (drawable),
                                   gimp_drawable_has_alpha (drawable),
-                                  dest_profile, 0, 0,
+                                  dest_profile,
+                                  GEGL_DITHER_NONE, GEGL_DITHER_NONE,
                                   TRUE, sub_progress);
     }
 
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 7b8507a..3d9b4db 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -169,8 +169,8 @@ static void       gimp_layer_convert_type       (GimpDrawable       *drawable,
                                                  GimpImage          *dest_image,
                                                  const Babl         *new_format,
                                                  GimpColorProfile   *dest_profile,
-                                                 gint                layer_dither_type,
-                                                 gint                mask_dither_type,
+                                                 GeglDitherMethod    layer_dither_type,
+                                                 GeglDitherMethod    mask_dither_type,
                                                  gboolean            push_undo,
                                                  GimpProgress       *progress);
 static void    gimp_layer_invalidate_boundary   (GimpDrawable       *drawable);
@@ -814,7 +814,7 @@ gimp_layer_convert (GimpItem  *item,
                                   new_precision,
                                   gimp_drawable_has_alpha (drawable),
                                   dest_profile,
-                                  0, 0,
+                                  GEGL_DITHER_NONE, GEGL_DITHER_NONE,
                                   FALSE, NULL);
     }
 
@@ -1070,20 +1070,20 @@ gimp_layer_estimate_memsize (GimpDrawable      *drawable,
 }
 
 static void
-gimp_layer_convert_type (GimpDrawable      *drawable,
-                         GimpImage         *dest_image,
-                         const Babl        *new_format,
-                         GimpColorProfile  *dest_profile,
-                         gint               layer_dither_type,
-                         gint               mask_dither_type,
-                         gboolean           push_undo,
-                         GimpProgress      *progress)
+gimp_layer_convert_type (GimpDrawable     *drawable,
+                         GimpImage        *dest_image,
+                         const Babl       *new_format,
+                         GimpColorProfile *dest_profile,
+                         GeglDitherMethod  layer_dither_type,
+                         GeglDitherMethod  mask_dither_type,
+                         gboolean          push_undo,
+                         GimpProgress     *progress)
 {
   GimpLayer  *layer = GIMP_LAYER (drawable);
   GeglBuffer *src_buffer;
   GeglBuffer *dest_buffer;
 
-  if (layer_dither_type == 0)
+  if (layer_dither_type == GEGL_DITHER_NONE)
     {
       src_buffer = g_object_ref (gimp_drawable_get_buffer (drawable));
     }
diff --git a/app/core/gimplayermask.c b/app/core/gimplayermask.c
index 357897c..93fedf0 100644
--- a/app/core/gimplayermask.c
+++ b/app/core/gimplayermask.c
@@ -53,8 +53,8 @@ static void            gimp_layer_mask_convert_type       (GimpDrawable      *dr
                                                            GimpImage         *dest_image,
                                                            const Babl        *new_format,
                                                            GimpColorProfile  *dest_profile,
-                                                           gint               layer_dither_type,
-                                                           gint               mask_dither_type,
+                                                           GeglDitherMethod   layer_dither_type,
+                                                           GeglDitherMethod   mask_dither_type,
                                                            gboolean           push_undo,
                                                            GimpProgress      *progress);
 
@@ -165,8 +165,8 @@ gimp_layer_mask_convert_type (GimpDrawable      *drawable,
                               GimpImage         *dest_image,
                               const Babl        *new_format,
                               GimpColorProfile  *dest_profile,
-                              gint               layer_dither_type,
-                              gint               mask_dither_type,
+                              GeglDitherMethod   layer_dither_type,
+                              GeglDitherMethod   mask_dither_type,
                               gboolean           push_undo,
                               GimpProgress      *progress)
 {
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index 4d59e8e..57f3e5f 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -93,8 +93,8 @@ static void       gimp_selection_convert_type  (GimpDrawable        *drawable,
                                                 GimpImage           *dest_image,
                                                 const Babl          *new_format,
                                                 GimpColorProfile    *dest_profile,
-                                                gint                 layer_dither_type,
-                                                gint                 mask_dither_type,
+                                                GeglDitherMethod     layer_dither_type,
+                                                GeglDitherMethod     mask_dither_type,
                                                 gboolean             push_undo,
                                                 GimpProgress        *progress);
 static void gimp_selection_invalidate_boundary (GimpDrawable        *drawable);
@@ -357,8 +357,8 @@ gimp_selection_convert_type (GimpDrawable      *drawable,
                              GimpImage         *dest_image,
                              const Babl        *new_format,
                              GimpColorProfile  *dest_profile,
-                             gint               layer_dither_type,
-                             gint               mask_dither_type,
+                             GeglDitherMethod   layer_dither_type,
+                             GeglDitherMethod   mask_dither_type,
                              gboolean           push_undo,
                              GimpProgress      *progress)
 {
diff --git a/app/pdb/image-convert-cmds.c b/app/pdb/image-convert-cmds.c
index 6148f2a..8545de0 100644
--- a/app/pdb/image-convert-cmds.c
+++ b/app/pdb/image-convert-cmds.c
@@ -244,7 +244,11 @@ image_convert_precision_invoker (GimpProcedure         *procedure,
       if (gimp_pdb_image_is_not_base_type (image, GIMP_INDEXED, error) &&
           gimp_pdb_image_is_not_precision (image, precision, error))
         {
-          gimp_image_convert_precision (image, precision, 0, 0, 0, NULL);
+          gimp_image_convert_precision (image, precision,
+                                        GEGL_DITHER_NONE,
+                                        GEGL_DITHER_NONE,
+                                        GEGL_DITHER_NONE,
+                                        progress);
         }
       else
         {
diff --git a/app/text/gimptextlayer.c b/app/text/gimptextlayer.c
index 4630a22..cbd7338 100644
--- a/app/text/gimptextlayer.c
+++ b/app/text/gimptextlayer.c
@@ -89,8 +89,8 @@ static void       gimp_text_layer_convert_type   (GimpDrawable      *drawable,
                                                   GimpImage         *dest_image,
                                                   const Babl        *new_format,
                                                   GimpColorProfile  *dest_profile,
-                                                  gint               layer_dither_type,
-                                                  gint               mask_dither_type,
+                                                  GeglDitherMethod   layer_dither_type,
+                                                  GeglDitherMethod   mask_dither_type,
                                                   gboolean           push_undo,
                                                   GimpProgress      *progress);
 static void       gimp_text_layer_set_buffer     (GimpDrawable      *drawable,
@@ -319,15 +319,17 @@ gimp_text_layer_convert_type (GimpDrawable      *drawable,
                               GimpImage         *dest_image,
                               const Babl        *new_format,
                               GimpColorProfile  *dest_profile,
-                              gint               layer_dither_type,
-                              gint               mask_dither_type,
+                              GeglDitherMethod   layer_dither_type,
+                              GeglDitherMethod   mask_dither_type,
                               gboolean           push_undo,
                               GimpProgress      *progress)
 {
   GimpTextLayer *layer = GIMP_TEXT_LAYER (drawable);
   GimpImage     *image = gimp_item_get_image (GIMP_ITEM (layer));
 
-  if (! layer->text || layer->modified || layer_dither_type != 0)
+  if (! layer->text   ||
+      layer->modified ||
+      layer_dither_type != GEGL_DITHER_NONE)
     {
       GIMP_DRAWABLE_CLASS (parent_class)->convert_type (drawable, dest_image,
                                                         new_format,
diff --git a/app/text/gimptextundo.c b/app/text/gimptextundo.c
index c2c7b74..5f03330 100644
--- a/app/text/gimptextundo.c
+++ b/app/text/gimptextundo.c
@@ -274,7 +274,8 @@ gimp_text_undo_pop (GimpUndo            *undo,
                                     gimp_babl_format_get_base_type (text_undo->format),
                                     gimp_babl_format_get_precision (text_undo->format),
                                     babl_format_has_alpha (text_undo->format),
-                                    NULL, 0, 0,
+                                    NULL,
+                                    GEGL_DITHER_NONE, GEGL_DITHER_NONE,
                                     FALSE, NULL);
         text_undo->format = format;
       }
diff --git a/tools/pdbgen/pdb/image_convert.pdb b/tools/pdbgen/pdb/image_convert.pdb
index 5bb5841..9219fcd 100644
--- a/tools/pdbgen/pdb/image_convert.pdb
+++ b/tools/pdbgen/pdb/image_convert.pdb
@@ -241,7 +241,11 @@ HELP
   if (gimp_pdb_image_is_not_base_type (image, GIMP_INDEXED, error) &&
       gimp_pdb_image_is_not_precision (image, precision, error))
     {
-      gimp_image_convert_precision (image, precision, 0, 0, 0, NULL);
+      gimp_image_convert_precision (image, precision,
+                                    GEGL_DITHER_NONE,
+                                    GEGL_DITHER_NONE,
+                                    GEGL_DITHER_NONE,
+                                    progress);
     }
   else
     {


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