[gimp/goat-invasion: 11/418] app: remove the legacy threshold code



commit ea20ab22364b671b3a3b933b13d93c84950bda3d
Author: Michael Natterer <mitch gimp org>
Date:   Wed Mar 14 00:23:58 2012 +0100

    app: remove the legacy threshold code

 app/base/Makefile.am              |    2 -
 app/base/threshold.c              |   81 -------------------------------------
 app/base/threshold.h              |   35 ----------------
 app/core/gimpdrawable-threshold.c |   46 ++++++---------------
 app/gegl/gimpthresholdconfig.c    |   19 ---------
 app/gegl/gimpthresholdconfig.h    |    5 --
 app/tools/gimpthresholdtool.c     |   21 ----------
 7 files changed, 13 insertions(+), 196 deletions(-)
---
diff --git a/app/base/Makefile.am b/app/base/Makefile.am
index f1dbb7d..8f55bdc 100644
--- a/app/base/Makefile.am
+++ b/app/base/Makefile.am
@@ -52,8 +52,6 @@ libappbase_a_SOURCES = \
 	siox.h			\
 	temp-buf.c		\
 	temp-buf.h		\
-	threshold.c		\
-	threshold.h		\
 	tile.c			\
 	tile.h			\
 	tile-private.h		\
diff --git a/app/core/gimpdrawable-threshold.c b/app/core/gimpdrawable-threshold.c
index 2835b21..2f093b4 100644
--- a/app/core/gimpdrawable-threshold.c
+++ b/app/core/gimpdrawable-threshold.c
@@ -21,18 +21,11 @@
 
 #include "core-types.h"
 
-#include "base/threshold.h"
-
 #include "gegl/gimpthresholdconfig.h"
 
-/* temp */
-#include "gimp.h"
-#include "gimpimage.h"
-
 #include "gimpdrawable.h"
 #include "gimpdrawable-operation.h"
 #include "gimpdrawable-threshold.h"
-#include "gimpdrawable-process.h"
 
 #include "gimp-intl.h"
 
@@ -45,42 +38,29 @@ gimp_drawable_threshold (GimpDrawable *drawable,
                          gint          low,
                          gint          high)
 {
-  GimpThresholdConfig *config;
+  GeglNode *node;
+  GObject  *config;
 
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
   g_return_if_fail (! gimp_drawable_is_indexed (drawable));
   g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
 
+  node = g_object_new (GEGL_TYPE_NODE,
+                       "operation", "gimp:threshold",
+                       NULL);
+
   config = g_object_new (GIMP_TYPE_THRESHOLD_CONFIG,
                          "low",  low  / 255.0,
                          "high", high / 255.0,
                          NULL);
 
-  if (gimp_use_gegl (gimp_item_get_image (GIMP_ITEM (drawable))->gimp))
-    {
-      GeglNode *node;
-
-      node = g_object_new (GEGL_TYPE_NODE,
-                           "operation", "gimp:threshold",
-                           NULL);
-      gegl_node_set (node,
-                     "config", config,
-                     NULL);
-
-      gimp_drawable_apply_operation (drawable, progress, _("Threshold"),
-                                     node, TRUE);
-      g_object_unref (node);
-    }
-  else
-    {
-      Threshold cruft;
-
-      gimp_threshold_config_to_cruft (config, &cruft,
-                                      gimp_drawable_is_rgb (drawable));
-
-      gimp_drawable_process (drawable, progress, _("Threshold"),
-                             (PixelProcessorFunc) threshold, &cruft);
-    }
+  gegl_node_set (node,
+                 "config", config,
+                 NULL);
 
   g_object_unref (config);
+
+  gimp_drawable_apply_operation (drawable, progress, _("Threshold"),
+                                 node, TRUE);
+  g_object_unref (node);
 }
diff --git a/app/gegl/gimpthresholdconfig.c b/app/gegl/gimpthresholdconfig.c
index 8892f8d..cff90b3 100644
--- a/app/gegl/gimpthresholdconfig.c
+++ b/app/gegl/gimpthresholdconfig.c
@@ -26,9 +26,6 @@
 
 #include "gimp-gegl-types.h"
 
-/*  temp cruft  */
-#include "base/threshold.h"
-
 #include "gimpthresholdconfig.h"
 
 
@@ -131,19 +128,3 @@ gimp_threshold_config_set_property (GObject      *object,
       break;
     }
 }
-
-
-/*  temp cruft  */
-
-void
-gimp_threshold_config_to_cruft (GimpThresholdConfig *config,
-                                Threshold           *cruft,
-                                gboolean             color)
-{
-  g_return_if_fail (GIMP_IS_THRESHOLD_CONFIG (config));
-  g_return_if_fail (cruft != NULL);
-
-  cruft->low_threshold  = config->low  * 255.999;
-  cruft->high_threshold = config->high * 255.999;
-  cruft->color          = color;
-}
diff --git a/app/gegl/gimpthresholdconfig.h b/app/gegl/gimpthresholdconfig.h
index 0fef784..f4a14f7 100644
--- a/app/gegl/gimpthresholdconfig.h
+++ b/app/gegl/gimpthresholdconfig.h
@@ -51,10 +51,5 @@ struct _GimpThresholdConfigClass
 
 GType   gimp_threshold_config_get_type (void) G_GNUC_CONST;
 
-/*  temp cruft  */
-void    gimp_threshold_config_to_cruft (GimpThresholdConfig *config,
-                                        Threshold           *cruft,
-                                        gboolean             color);
-
 
 #endif /* __GIMP_THRESHOLD_CONFIG_H__ */
diff --git a/app/tools/gimpthresholdtool.c b/app/tools/gimpthresholdtool.c
index 69628c7..8738c37 100644
--- a/app/tools/gimpthresholdtool.c
+++ b/app/tools/gimpthresholdtool.c
@@ -26,7 +26,6 @@
 #include "tools-types.h"
 
 #include "base/gimphistogram.h"
-#include "base/threshold.h"
 
 #include "gegl/gimpthresholdconfig.h"
 
@@ -57,7 +56,6 @@ static gboolean   gimp_threshold_tool_initialize      (GimpTool          *tool,
 
 static GeglNode * gimp_threshold_tool_get_operation   (GimpImageMapTool  *im_tool,
                                                        GObject          **config);
-static void       gimp_threshold_tool_map             (GimpImageMapTool  *im_tool);
 static void       gimp_threshold_tool_dialog          (GimpImageMapTool  *im_tool);
 
 static void       gimp_threshold_tool_config_notify   (GObject           *object,
@@ -112,20 +110,13 @@ gimp_threshold_tool_class_init (GimpThresholdToolClass *klass)
   im_tool_class->export_dialog_title = _("Export Threshold Settings");
 
   im_tool_class->get_operation       = gimp_threshold_tool_get_operation;
-  im_tool_class->map                 = gimp_threshold_tool_map;
   im_tool_class->dialog              = gimp_threshold_tool_dialog;
 }
 
 static void
 gimp_threshold_tool_init (GimpThresholdTool *t_tool)
 {
-  GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (t_tool);
-
-  t_tool->threshold = g_slice_new0 (Threshold);
   t_tool->histogram = gimp_histogram_new ();
-
-  im_tool->apply_func = (GimpImageMapApplyFunc) threshold;
-  im_tool->apply_data = t_tool->threshold;
 }
 
 static void
@@ -133,8 +124,6 @@ gimp_threshold_tool_finalize (GObject *object)
 {
   GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (object);
 
-  g_slice_free (Threshold, t_tool->threshold);
-
   if (t_tool->histogram)
     {
       gimp_histogram_unref (t_tool->histogram);
@@ -205,16 +194,6 @@ gimp_threshold_tool_get_operation (GimpImageMapTool  *image_map_tool,
   return node;
 }
 
-static void
-gimp_threshold_tool_map (GimpImageMapTool *image_map_tool)
-{
-  GimpThresholdTool *t_tool   = GIMP_THRESHOLD_TOOL (image_map_tool);
-  GimpDrawable      *drawable = image_map_tool->drawable;
-
-  gimp_threshold_config_to_cruft (t_tool->config, t_tool->threshold,
-                                  gimp_drawable_is_rgb (drawable));
-}
-
 
 /**********************/
 /*  Threshold dialog  */



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