gimp r25348 - in trunk: . app/core app/pdb tools/pdbgen/pdb
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25348 - in trunk: . app/core app/pdb tools/pdbgen/pdb
- Date: Thu, 3 Apr 2008 09:36:44 +0100 (BST)
Author: mitch
Date: Thu Apr 3 09:36:44 2008
New Revision: 25348
URL: http://svn.gnome.org/viewvc/gimp?rev=25348&view=rev
Log:
2008-04-03 Michael Natterer <mitch gimp org>
* app/core/gimpimage-convert.c (gimp_image_convert): don't accept
palettes with more than 256 colors.
* tools/pdbgen/pdb/convert.pdb: fail here too for palettes
with > 256 colors. Fixes bug #525471.
* app/pdb/convert_cmds.c: regenerated.
Modified:
trunk/ChangeLog
trunk/app/core/gimpimage-convert.c
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 Thu Apr 3 09:36:44 2008
@@ -780,6 +780,8 @@
{
g_return_val_if_fail (custom_palette == NULL ||
GIMP_IS_PALETTE (custom_palette), FALSE);
+ g_return_val_if_fail (custom_palette == NULL ||
+ custom_palette->n_colors <= 256, FALSE);
if (! custom_palette)
palette_type = GIMP_MONO_PALETTE;
Modified: trunk/app/pdb/convert_cmds.c
==============================================================================
--- trunk/app/pdb/convert_cmds.c (original)
+++ trunk/app/pdb/convert_cmds.c Thu Apr 3 09:36:44 2008
@@ -26,13 +26,17 @@
#include "core/gimpimage-convert.h"
#include "core/gimpimage.h"
+#include "core/gimppalette.h"
#include "core/gimpparamspecs.h"
#include "gimppdb.h"
+#include "gimppdberror.h"
#include "gimppdb-utils.h"
#include "gimpprocedure.h"
#include "internal_procs.h"
+#include "gimp-intl.h"
+
static GValueArray *
image_convert_rgb_invoker (GimpProcedure *procedure,
@@ -125,7 +129,16 @@
case GIMP_CUSTOM_PALETTE:
pal = gimp_pdb_get_palette (gimp, palette, FALSE, error);
if (! pal)
- success = FALSE;
+ {
+ success = FALSE;
+ }
+ else if (pal->n_colors > 256)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
+ _("Cannot convert to a palette "
+ "with more than 256 colors."));
+ success = FALSE;
+ }
break;
default:
@@ -165,7 +178,7 @@
if (success)
{
- gimp_image_convert_set_dither_matrix (width, height, (guchar *) matrix);
+ gimp_image_convert_set_dither_matrix (width, height, (guchar *) matrix);
}
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 Thu Apr 3 09:36:44 2008
@@ -133,8 +133,17 @@
case GIMP_CUSTOM_PALETTE:
pal = gimp_pdb_get_palette (gimp, palette, FALSE, error);
if (! pal)
- success = FALSE;
- break;
+ {
+ success = FALSE;
+ }
+ else if (pal->n_colors > 256)
+ {
+ g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
+ _("Cannot convert to a palette "
+ "with more than 256 colors."));
+ success = FALSE;
+ }
+ break;
default:
break;
@@ -177,7 +186,7 @@
%invoke = (
code => <<'CODE'
{
- gimp_image_convert_set_dither_matrix (width, height, (guchar *) matrix);
+ gimp_image_convert_set_dither_matrix (width, height, (guchar *) matrix);
}
CODE
);
@@ -185,7 +194,10 @@
@headers = qw("core/gimpimage.h"
"core/gimpimage-convert.h"
- "gimppdb-utils.h");
+ "core/gimppalette.h"
+ "gimppdberror.h"
+ "gimppdb-utils.h"
+ "gimp-intl.h");
@procs = qw(image_convert_rgb
image_convert_grayscale
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]