mirror of https://github.com/GNOME/gimp.git
don't accept palettes with more than 256 colors.
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. svn path=/trunk/; revision=25348
This commit is contained in:
parent
b6e36b0965
commit
356d689eef
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
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.
|
||||
|
||||
2008-04-03 Jordi Mallach <jordi@sindominio.net>
|
||||
|
||||
* configure.in (ALL_LINGUAS): Add Valencian-Catalan (ca@valencia).
|
||||
|
|
|
@ -780,6 +780,8 @@ gimp_image_convert (GimpImage *image,
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -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 @@ image_convert_indexed_invoker (GimpProcedure *procedure,
|
|||
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 @@ image_convert_set_dither_matrix_invoker (GimpProcedure *procedure,
|
|||
|
||||
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);
|
||||
|
|
|
@ -133,8 +133,17 @@ HELP
|
|||
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 @@ HELP
|
|||
%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 @@ CODE
|
|||
|
||||
@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
|
||||
|
|
Loading…
Reference in New Issue