gimp r25730 - in trunk: . app/base app/core app/tools



Author: neo
Date: Wed May 21 14:20:15 2008
New Revision: 25730
URL: http://svn.gnome.org/viewvc/gimp?rev=25730&view=rev

Log:
2008-05-21  Sven Neumann  <sven gimp org>

	* app/base/desaturate.[ch]: changed to take a pointer as first
	argument as all PixelProcessor functions.

	* app/core/gimpdrawable-desaturate.c: changed accordingly.

	* app/tools/gimpdesaturatetool.[ch]: added legacy code path.


Modified:
   trunk/ChangeLog
   trunk/app/base/desaturate.c
   trunk/app/base/desaturate.h
   trunk/app/core/gimpdrawable-desaturate.c
   trunk/app/tools/gimpdesaturatetool.c
   trunk/app/tools/gimpdesaturatetool.h

Modified: trunk/app/base/desaturate.c
==============================================================================
--- trunk/app/base/desaturate.c	(original)
+++ trunk/app/base/desaturate.c	Wed May 21 14:20:15 2008
@@ -40,14 +40,15 @@
 
 
 void
-desaturate_region (GimpDesaturateMode  mode,
+desaturate_region (GimpDesaturateMode *mode,
                    PixelRegion        *srcPR,
                    PixelRegion        *destPR)
 {
+  g_return_if_fail (mode != NULL);
   g_return_if_fail (srcPR->bytes == destPR->bytes);
   g_return_if_fail (srcPR->bytes == 3 || srcPR->bytes == 4);
 
-  switch (mode)
+  switch (*mode)
     {
     case GIMP_DESATURATE_LIGHTNESS:
       desaturate_region_lightness (srcPR, destPR, srcPR->bytes == 4);

Modified: trunk/app/base/desaturate.h
==============================================================================
--- trunk/app/base/desaturate.h	(original)
+++ trunk/app/base/desaturate.h	Wed May 21 14:20:15 2008
@@ -20,7 +20,7 @@
 #define __DESATURATE_H__
 
 
-void  desaturate_region (GimpDesaturateMode  mode,
+void  desaturate_region (GimpDesaturateMode *mode,
                          PixelRegion        *srcPR,
                          PixelRegion        *destPR);
 

Modified: trunk/app/core/gimpdrawable-desaturate.c
==============================================================================
--- trunk/app/core/gimpdrawable-desaturate.c	(original)
+++ trunk/app/core/gimpdrawable-desaturate.c	Wed May 21 14:20:15 2008
@@ -88,7 +88,7 @@
                          x, y, width, height, TRUE);
 
       pixel_regions_process_parallel ((PixelProcessorFunc) desaturate_region,
-                                      GINT_TO_POINTER (mode),
+                                      &mode,
                                       2, &srcPR, &destPR);
 
       gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Desaturate"));

Modified: trunk/app/tools/gimpdesaturatetool.c
==============================================================================
--- trunk/app/tools/gimpdesaturatetool.c	(original)
+++ trunk/app/tools/gimpdesaturatetool.c	Wed May 21 14:20:15 2008
@@ -27,8 +27,7 @@
 
 #include "tools-types.h"
 
-#include "base/gimplut.h"
-#include "base/lut-funcs.h"
+#include "base/desaturate.h"
 
 #include "gegl/gimpdesaturateconfig.h"
 
@@ -106,6 +105,10 @@
 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
@@ -114,7 +117,7 @@
                                 GError      **error)
 {
   GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (tool);
-  GimpDrawable      *drawable;
+  GimpDrawable       *drawable;
 
   drawable = gimp_image_get_active_drawable (display->image);
 
@@ -145,7 +148,7 @@
                                     GObject          **config)
 {
   GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (image_map_tool);
-  GeglNode          *node;
+  GeglNode           *node;
 
   node = g_object_new (GEGL_TYPE_NODE,
                        "operation", "gimp-desaturate",
@@ -169,6 +172,9 @@
 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;
 }
 
 
@@ -195,9 +201,9 @@
 }
 
 static void
-gimp_desaturate_tool_config_notify (GObject           *object,
-                                    GParamSpec        *pspec,
-                                   GimpDesaturateTool *desaturate_tool)
+gimp_desaturate_tool_config_notify (GObject            *object,
+                                    GParamSpec         *pspec,
+                                    GimpDesaturateTool *desaturate_tool)
 {
   GimpDesaturateConfig *config = GIMP_DESATURATE_CONFIG (object);
 

Modified: trunk/app/tools/gimpdesaturatetool.h
==============================================================================
--- trunk/app/tools/gimpdesaturatetool.h	(original)
+++ trunk/app/tools/gimpdesaturatetool.h	Wed May 21 14:20:15 2008
@@ -39,6 +39,7 @@
   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]