gimp r25895 - in trunk: . plug-ins/common



Author: neo
Date: Wed Jun  4 20:12:21 2008
New Revision: 25895
URL: http://svn.gnome.org/viewvc/gimp?rev=25895&view=rev

Log:
2008-06-04  Sven Neumann  <sven gimp org>

	* plug-ins/common/red-eye-removal.c: fixed weird handling of the
	threshold parameter. Some unrelated minor cleanups.



Modified:
   trunk/ChangeLog
   trunk/plug-ins/common/red-eye-removal.c

Modified: trunk/plug-ins/common/red-eye-removal.c
==============================================================================
--- trunk/plug-ins/common/red-eye-removal.c	(original)
+++ trunk/plug-ins/common/red-eye-removal.c	Wed Jun  4 20:12:21 2008
@@ -59,7 +59,7 @@
 static void     remove_redeye         (GimpDrawable     *drawable);
 static void     remove_redeye_preview (GimpDrawable     *drawable,
                                        GimpPreview      *preview);
-static void      redeye_inner_loop    (const guchar     *src,
+static void     redeye_inner_loop     (const guchar     *src,
                                        guchar           *dest,
                                        gint              width,
                                        gint              height,
@@ -77,6 +77,7 @@
 #define PLUG_IN_PROC    "plug-in-red-eye-removal"
 #define PLUG_IN_BINARY  "red-eye-removal"
 
+
 const GimpPlugInInfo PLUG_IN_INFO =
 {
   NULL,  /* init_proc  */
@@ -100,8 +101,6 @@
     { GIMP_PDB_INT32,    "threshold", "Red eye threshold in percent" }
   };
 
-  gimp_set_data (PLUG_IN_PROC, &threshold, sizeof (threshold));
-
   gimp_install_procedure (PLUG_IN_PROC,
                           N_("Remove the red eye effect caused by camera "
                              "flashes"),
@@ -129,8 +128,7 @@
  */
 static gboolean
 dialog (gint32        image_id,
-        GimpDrawable *drawable,
-        gint         *current_threshold)
+        GimpDrawable *drawable)
 {
   GtkWidget *dialog;
   GtkWidget *preview;
@@ -218,7 +216,6 @@
   GimpDrawable      *drawable;
   GimpRunMode        run_mode;
   GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
-  gint32             threshold;
   gint32             image_ID;
 
   run_mode = param[0].data.d_int32;
@@ -241,15 +238,8 @@
       case GIMP_RUN_INTERACTIVE:
         gimp_get_data (PLUG_IN_PROC, &threshold);
 
-        if (strncmp (name, PLUG_IN_PROC, strlen (PLUG_IN_PROC)) == 0)
-          {
-            if (! dialog (image_ID, drawable, &threshold))
-              status = GIMP_PDB_CANCEL;
-          }
-        else
-          {
-            threshold = 50;
-          }
+        if (! dialog (image_ID, drawable))
+          status = GIMP_PDB_CANCEL;
         break;
 
       case GIMP_RUN_WITH_LAST_VALS:
@@ -260,8 +250,7 @@
         break;
     }
 
-  /*  Make sure that the drawable is RGB color.
-   *  Greyscale images don't have the red eye effect. */
+  /*  Make sure that the drawable is RGB color.  */
   if (status == GIMP_PDB_SUCCESS &&
       gimp_drawable_is_rgb (drawable->drawable_id))
     {
@@ -270,12 +259,8 @@
       if (run_mode != GIMP_RUN_NONINTERACTIVE)
         gimp_displays_flush ();
 
-      /* if we ran in auto mode don't reset the threshold */
-      if (run_mode == GIMP_RUN_INTERACTIVE
-          && strncmp (name, PLUG_IN_PROC, strlen (PLUG_IN_PROC)) == 0)
-      {
+      if (run_mode == GIMP_RUN_INTERACTIVE)
         gimp_set_data (PLUG_IN_PROC, &threshold, sizeof (threshold));
-      }
     }
   else
     {
@@ -283,9 +268,9 @@
     }
 
   *nreturn_vals = 1;
-  *return_vals = values;
+  *return_vals  = values;
 
-  values[0].type = GIMP_PDB_STATUS;
+  values[0].type          = GIMP_PDB_STATUS;
   values[0].data.d_status = status;
 
   gimp_drawable_detach (drawable);
@@ -335,7 +320,7 @@
       progress += src_rgn.w * src_rgn.h;
 
       if (i % 16 == 0)
-        gimp_progress_update ((double) progress / (double) max_progress);
+        gimp_progress_update ((gdouble) progress / (gdouble) max_progress);
     }
 
   gimp_drawable_flush (drawable);
@@ -375,13 +360,13 @@
                    gint          height,
                    gint          bpp,
                    gboolean      has_alpha,
-                   int           rowstride)
+                   gint          rowstride)
 {
-  const gint    red   = 0;
-  const gint    green = 1;
-  const gint    blue  = 2;
-  const gint    alpha = 3;
-  gint          x, y;
+  const gint red   = 0;
+  const gint green = 1;
+  const gint blue  = 2;
+  const gint alpha = 3;
+  gint       x, y;
 
   for (y = 0; y < height; y++)
     {



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