gimp r25353 - in trunk: . app/core app/pdb tools/pdbgen/pdb



Author: neo
Date: Fri Apr  4 07:29:35 2008
New Revision: 25353
URL: http://svn.gnome.org/viewvc/gimp?rev=25353&view=rev

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

	* app/core/gimpimage-convert.[ch]
	(gimp_image_convert_set_dither_matrix): minor cleanup.

	* tools/pdbgen/pdb/convert.pdb: changed accordingly.

	* app/pdb/convert_cmds.c: regenerated.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpimage-convert.c
   trunk/app/core/gimpimage-convert.h
   trunk/app/pdb/convert_cmds.c
   trunk/tools/pdbgen/pdb/convert.pdb

Modified: trunk/app/core/gimpimage-convert.c
==============================================================================
--- trunk/app/core/gimpimage-convert.c	(original)
+++ trunk/app/core/gimpimage-convert.c	Fri Apr  4 07:29:35 2008
@@ -4157,18 +4157,18 @@
 
 
 void
-gimp_image_convert_set_dither_matrix (gint          width,
-                                      gint          height,
-                                      const guchar *source)
+gimp_image_convert_set_dither_matrix (const guchar *matrix,
+                                      gint          width,
+                                      gint          height)
 {
   gint x;
   gint y;
 
-  /* if source is invalid, restore the default matrix */
-  if (source == NULL || width == 0 || height == 0)
+  /* if matrix is invalid, restore the default matrix */
+  if (matrix == NULL || width == 0 || height == 0)
     {
-      source = (guchar *) (&DM_ORIGINAL);
-      width = DM_WIDTH;
+      matrix = (const guchar *) DM_ORIGINAL;
+      width  = DM_WIDTH;
       height = DM_HEIGHT;
     }
 
@@ -4179,8 +4179,8 @@
     {
       for (x = 0; x < DM_WIDTH; x++)
         {
-          DM[x][y] = source[((x % width) * height) + (y % height)];
-       }
+          DM[x][y] = matrix[((x % width) * height) + (y % height)];
+        }
     }
 }
 

Modified: trunk/app/core/gimpimage-convert.h
==============================================================================
--- trunk/app/core/gimpimage-convert.h	(original)
+++ trunk/app/core/gimpimage-convert.h	Fri Apr  4 07:29:35 2008
@@ -37,9 +37,9 @@
                                     GimpProgress            *progress,
                                     GError                 **error);
 
-void  gimp_image_convert_set_dither_matrix (gint           width,
-                                             gint           height,
-                                             const guchar  *source);
+void  gimp_image_convert_set_dither_matrix (const guchar *matrix,
+                                            gint          width,
+                                            gint          height);
 
 
 #endif  /*  __GIMP_IMAGE_CONVERT_H__  */

Modified: trunk/app/pdb/convert_cmds.c
==============================================================================
--- trunk/app/pdb/convert_cmds.c	(original)
+++ trunk/app/pdb/convert_cmds.c	Fri Apr  4 07:29:35 2008
@@ -54,7 +54,8 @@
   if (success)
     {
       if (gimp_image_base_type (image) != GIMP_RGB)
-        success = gimp_image_convert (image, GIMP_RGB, 0, 0, FALSE, FALSE, 0, NULL,
+        success = gimp_image_convert (image, GIMP_RGB,
+                                      0, 0, FALSE, FALSE, 0, NULL,
                                       NULL, error);
       else
         success = FALSE;
@@ -79,7 +80,8 @@
   if (success)
     {
       if (gimp_image_base_type (image) != GIMP_GRAY)
-        success = gimp_image_convert (image, GIMP_GRAY, 0, 0, FALSE, FALSE, 0, NULL,
+        success = gimp_image_convert (image, GIMP_GRAY,
+                                      0, 0, FALSE, FALSE, 0, NULL,
                                       NULL, error);
       else
         success = FALSE;
@@ -115,7 +117,7 @@
 
   if (success)
     {
-      GimpPalette *pal = NULL;
+      GimpPalette *palette = NULL;
 
       if (gimp_image_base_type (image) != GIMP_INDEXED)
         {
@@ -127,12 +129,12 @@
               break;
 
             case GIMP_CUSTOM_PALETTE:
-              pal = gimp_pdb_get_palette (gimp, palette, FALSE, error);
-              if (! pal)
+              palette = gimp_pdb_get_palette (gimp, palette, FALSE, error);
+              if (! palette)
                 {
                   success = FALSE;
                 }
-              else if (pal->n_colors > 256)
+              else if (palette->n_colors > MAXNUMCOLORS)
                 {
                   g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
                                _("Cannot convert to a palette "
@@ -146,11 +148,15 @@
             }
         }
       else
-        success = FALSE;
+        {
+          success = FALSE;
+        }
 
       if (success)
-        success = gimp_image_convert (image, GIMP_INDEXED, num_cols, dither_type,
-                                      alpha_dither, remove_unused, palette_type, pal,
+        success = gimp_image_convert (image, GIMP_INDEXED,
+                                      num_cols, dither_type,
+                                      alpha_dither, remove_unused,
+                                      palette_type, palette,
                                       NULL, error);
     }
 
@@ -178,7 +184,7 @@
 
   if (success)
     {
-      gimp_image_convert_set_dither_matrix (width, height, (guchar *) matrix);
+      gimp_image_convert_set_dither_matrix (matrix, width, height);
     }
 
   return gimp_procedure_get_return_values (procedure, success);

Modified: trunk/tools/pdbgen/pdb/convert.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/convert.pdb	(original)
+++ trunk/tools/pdbgen/pdb/convert.pdb	Fri Apr  4 07:29:35 2008
@@ -37,7 +37,8 @@
 	code => <<'CODE'
 {
   if (gimp_image_base_type (image) != GIMP_RGB)
-    success = gimp_image_convert (image, GIMP_RGB, 0, 0, FALSE, FALSE, 0, NULL,
+    success = gimp_image_convert (image, GIMP_RGB,
+                                  0, 0, FALSE, FALSE, 0, NULL,
                                   NULL, error);
   else
     success = FALSE;
@@ -66,7 +67,8 @@
 	code => <<'CODE'
 {
   if (gimp_image_base_type (image) != GIMP_GRAY)
-    success = gimp_image_convert (image, GIMP_GRAY, 0, 0, FALSE, FALSE, 0, NULL,
+    success = gimp_image_convert (image, GIMP_GRAY,
+                                  0, 0, FALSE, FALSE, 0, NULL,
                                   NULL, error);
   else
     success = FALSE;
@@ -119,7 +121,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPalette *pal = NULL;
+  GimpPalette *palette = NULL;
 
   if (gimp_image_base_type (image) != GIMP_INDEXED)
     {
@@ -131,12 +133,12 @@
 	  break;
 
 	case GIMP_CUSTOM_PALETTE:
-          pal = gimp_pdb_get_palette (gimp, palette, FALSE, error);
-	  if (! pal)
+          palette = gimp_pdb_get_palette (gimp, palette, FALSE, error);
+	  if (! palette)
             {
               success = FALSE;
             }
-          else if (pal->n_colors > 256)
+          else if (palette->n_colors > MAXNUMCOLORS)
             {
               g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
                            _("Cannot convert to a palette "
@@ -150,11 +152,15 @@
 	}
     }
   else
-    success = FALSE;
+    {
+      success = FALSE;
+    }
 
   if (success)
-    success = gimp_image_convert (image, GIMP_INDEXED, num_cols, dither_type,
-                                  alpha_dither, remove_unused, palette_type, pal,
+    success = gimp_image_convert (image, GIMP_INDEXED,
+                                  num_cols, dither_type,
+                                  alpha_dither, remove_unused,
+				  palette_type, palette,
                                   NULL, error);
 }
 CODE
@@ -186,7 +192,7 @@
     %invoke = (
 	code => <<'CODE'
 {
-  gimp_image_convert_set_dither_matrix (width, height, (guchar *) matrix);
+  gimp_image_convert_set_dither_matrix (matrix, width, height);
 }
 CODE
     );



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