[gimp/goat-invasion: 9/234] app: remove the legacy desaturate implementation



commit fca29b7a92321d4e12b49dd275cc5ec13c32a8a2
Author: Michael Natterer <mitch gimp org>
Date:   Tue Mar 13 23:52:04 2012 +0100

    app: remove the legacy desaturate implementation
    
    The GEGL one is just as fast or faster.

 app/base/Makefile.am               |    2 -
 app/base/desaturate.c              |  183 ------------------------------------
 app/base/desaturate.h              |   27 ------
 app/core/gimpdrawable-desaturate.c |   47 +++------
 app/tools/gimpdesaturatetool.c     |   13 +--
 app/tools/gimpdesaturatetool.h     |    1 -
 6 files changed, 18 insertions(+), 255 deletions(-)
---
diff --git a/app/base/Makefile.am b/app/base/Makefile.am
index 164aee1..f1dbb7d 100644
--- a/app/base/Makefile.am
+++ b/app/base/Makefile.am
@@ -32,8 +32,6 @@ libappbase_a_SOURCES = \
 	cpercep.h		\
 	curves.c		\
 	curves.h		\
-	desaturate.c		\
-	desaturate.h		\
 	gimphistogram.c		\
 	gimphistogram.h		\
 	gimplut.c		\
diff --git a/app/core/gimpdrawable-desaturate.c b/app/core/gimpdrawable-desaturate.c
index cdb3651..4e03ef3 100644
--- a/app/core/gimpdrawable-desaturate.c
+++ b/app/core/gimpdrawable-desaturate.c
@@ -21,18 +21,11 @@
 
 #include "core-types.h"
 
-#include "base/desaturate.h"
-
 #include "gegl/gimpdesaturateconfig.h"
 
-/* temp */
-#include "gimp.h"
-#include "gimpimage.h"
-
 #include "gimpdrawable.h"
 #include "gimpdrawable-desaturate.h"
 #include "gimpdrawable-operation.h"
-#include "gimpdrawable-process.h"
 #include "gimpprogress.h"
 
 #include "gimp-intl.h"
@@ -43,37 +36,29 @@ gimp_drawable_desaturate (GimpDrawable       *drawable,
                           GimpProgress       *progress,
                           GimpDesaturateMode  mode)
 {
+  GeglNode *desaturate;
+  GObject  *config;
+
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
   g_return_if_fail (gimp_drawable_is_rgb (drawable));
   g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
   g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
 
-  if (gimp_use_gegl (gimp_item_get_image (GIMP_ITEM (drawable))->gimp))
-    {
-      GeglNode *desaturate;
-      GObject  *config;
-
-      desaturate = g_object_new (GEGL_TYPE_NODE,
-                                 "operation", "gimp:desaturate",
-                                 NULL);
-
-      config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
-                             "mode", mode,
+  desaturate = g_object_new (GEGL_TYPE_NODE,
+                             "operation", "gimp:desaturate",
                              NULL);
 
-      gegl_node_set (desaturate,
-                     "config", config,
-                     NULL);
+  config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
+                         "mode", mode,
+                         NULL);
+
+  gegl_node_set (desaturate,
+                 "config", config,
+                 NULL);
 
-      g_object_unref (config);
+  g_object_unref (config);
 
-      gimp_drawable_apply_operation (drawable, progress, _("Desaturate"),
-                                     desaturate, TRUE);
-      g_object_unref  (desaturate);
-    }
-  else
-    {
-      gimp_drawable_process (drawable, progress, _("Desaturate"),
-                             (PixelProcessorFunc) desaturate_region, &mode);
-    }
+  gimp_drawable_apply_operation (drawable, progress, _("Desaturate"),
+                                 desaturate, TRUE);
+  g_object_unref  (desaturate);
 }
diff --git a/app/tools/gimpdesaturatetool.c b/app/tools/gimpdesaturatetool.c
index 9c829b0..dc23e0d 100644
--- a/app/tools/gimpdesaturatetool.c
+++ b/app/tools/gimpdesaturatetool.c
@@ -26,8 +26,6 @@
 
 #include "tools-types.h"
 
-#include "base/desaturate.h"
-
 #include "gegl/gimpdesaturateconfig.h"
 
 #include "core/gimpdrawable.h"
@@ -100,10 +98,6 @@ gimp_desaturate_tool_class_init (GimpDesaturateToolClass *klass)
 static void
 gimp_desaturate_tool_init (GimpDesaturateTool *desaturate_tool)
 {
-  GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (desaturate_tool);
-
-  im_tool->apply_func = (GimpImageMapApplyFunc) desaturate_region;
-  im_tool->apply_data = &desaturate_tool->mode;
 }
 
 static gboolean
@@ -169,15 +163,12 @@ gimp_desaturate_tool_get_operation (GimpImageMapTool  *image_map_tool,
 static void
 gimp_desaturate_tool_map (GimpImageMapTool *image_map_tool)
 {
-  GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (image_map_tool);
-
-  desaturate_tool->mode = desaturate_tool->config->mode;
 }
 
 
-/**********************/
+/***********************/
 /*  Desaturate dialog  */
-/**********************/
+/***********************/
 
 static void
 gimp_desaturate_tool_dialog (GimpImageMapTool *image_map_tool)
diff --git a/app/tools/gimpdesaturatetool.h b/app/tools/gimpdesaturatetool.h
index 00658ab..41ab6a1 100644
--- a/app/tools/gimpdesaturatetool.h
+++ b/app/tools/gimpdesaturatetool.h
@@ -38,7 +38,6 @@ struct _GimpDesaturateTool
   GimpImageMapTool       parent_instance;
 
   GimpDesaturateConfig  *config;
-  GimpDesaturateMode     mode;  /*  only for legacy mode  */
 
   /*  dialog  */
   GtkWidget             *button;



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