merged fix from stable branch (#70344).
2002-02-03 Sven Neumann <sven@gimp.org> * app/core/gimpimage-convert.c: merged fix from stable branch (#70344). * plug-ins/common/smooth_palette.c: merged fix from stable branch (#70333).
This commit is contained in:
committed by
Sven Neumann
parent
b45f03a346
commit
bdd47b1652
@ -1,3 +1,10 @@
|
||||
2002-02-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimpimage-convert.c: merged fix from stable branch (#70344).
|
||||
|
||||
* plug-ins/common/smooth_palette.c: merged fix from stable branch
|
||||
(#70333).
|
||||
|
||||
2002-02-03 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* configure.in
|
||||
|
||||
@ -2464,11 +2464,12 @@ custompal_pass1 (QuantizeObj *quantobj)
|
||||
GimpPaletteEntry *entry;
|
||||
guchar r, g, b;
|
||||
|
||||
/* fprintf(stderr, "custompal_pass1: using (theCustomPalette %s) from (file %s)\n",
|
||||
theCustomPalette->name, theCustomPalette->filename); */
|
||||
/* fprintf (stderr,
|
||||
"custompal_pass1: using (theCustomPalette %s) from (file %s)\n",
|
||||
theCustomPalette->name, theCustomPalette->filename); */
|
||||
|
||||
for (i = 0, list = theCustomPalette->colors;
|
||||
list;
|
||||
i < 256 && list;
|
||||
i++, list = g_list_next (list))
|
||||
{
|
||||
entry = (GimpPaletteEntry *) list->data;
|
||||
|
||||
@ -74,6 +74,12 @@ query (void)
|
||||
{ GIMP_PDB_INT32, "show_image","Show Image?" }
|
||||
};
|
||||
|
||||
static GimpParamDef return_vals[] =
|
||||
{
|
||||
{ GIMP_PDB_IMAGE, "new_image", "Output image" },
|
||||
{ GIMP_PDB_LAYER, "new_layer", "Output layer" }
|
||||
};
|
||||
|
||||
gimp_install_procedure ("plug_in_smooth_palette",
|
||||
"derive smooth palette from image",
|
||||
"help!",
|
||||
@ -83,8 +89,8 @@ query (void)
|
||||
N_("<Image>/Filters/Colors/Smooth Palette..."),
|
||||
"RGB*",
|
||||
GIMP_PLUGIN,
|
||||
G_N_ELEMENTS (args), 0,
|
||||
args, NULL);
|
||||
G_N_ELEMENTS (args), G_N_ELEMENTS (return_vals),
|
||||
args, return_vals);
|
||||
}
|
||||
|
||||
static struct
|
||||
@ -186,8 +192,6 @@ run (gchar *name,
|
||||
values[0].data.d_status = status;
|
||||
}
|
||||
|
||||
#define R (rand())
|
||||
|
||||
static long
|
||||
pix_diff (guchar *pal,
|
||||
gint bpp,
|
||||
@ -255,8 +259,8 @@ doit (GimpDrawable *drawable,
|
||||
/* get initial palette */
|
||||
for (i = 0; i < psize; i++)
|
||||
{
|
||||
gint x = R % drawable->width;
|
||||
gint y = R % drawable->height;
|
||||
gint x = rand() % drawable->width;
|
||||
gint y = rand() % drawable->height;
|
||||
|
||||
gimp_pixel_rgn_get_pixel (&pr, pal + bpp * i, x, y);
|
||||
}
|
||||
@ -282,7 +286,7 @@ doit (GimpDrawable *drawable,
|
||||
|
||||
/* scramble */
|
||||
for (i = 1; i < psize; i++)
|
||||
pix_swap (pal, bpp, i, R % psize);
|
||||
pix_swap (pal, bpp, i, rand() % psize);
|
||||
|
||||
/* measure */
|
||||
len = 0.0;
|
||||
@ -292,8 +296,8 @@ doit (GimpDrawable *drawable,
|
||||
/* improve */
|
||||
for (i = 0; i < config.try_size; i++)
|
||||
{
|
||||
gint i0 = 1 + (R % (psize-2));
|
||||
gint i1 = 1 + (R % (psize-2));
|
||||
gint i0 = 1 + (rand() % (psize-2));
|
||||
gint i1 = 1 + (rand() % (psize-2));
|
||||
glong as_is, swapd;
|
||||
|
||||
if (1 == (i0 - i1))
|
||||
@ -341,7 +345,7 @@ doit (GimpDrawable *drawable,
|
||||
for (i = 1; i < 4 * psize; i++)
|
||||
{
|
||||
glong as_is, swapd;
|
||||
gint i0 = 1 + R % (psize - 2);
|
||||
gint i0 = 1 + rand() % (psize - 2);
|
||||
gint i1 = i0 + 1;
|
||||
|
||||
as_is = (pix_diff (pal, bpp, i0 - 1, i0) +
|
||||
|
||||
Reference in New Issue
Block a user