Fix to convert.c from Adam for fencepost error.
-Yosh
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
Tue Mar 24 04:19:55 PST 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
|
* app/convert.c: fix for fencepost error from Adam
|
||||||
|
|
||||||
Mon Mar 23 18:08:59 PST 1998 Manish Singh <yosh@gimp.org>
|
Mon Mar 23 18:08:59 PST 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* app/gimage_mask.c
|
* app/gimage_mask.c
|
||||||
|
@ -19,18 +19,18 @@
|
|||||||
/*
|
/*
|
||||||
* TODO for Convert:
|
* TODO for Convert:
|
||||||
*
|
*
|
||||||
* Make GRAYSCALE->INDEXED sane again (done?)
|
|
||||||
*
|
|
||||||
* Use palette of another open INDEXED image
|
* Use palette of another open INDEXED image
|
||||||
*
|
*
|
||||||
* Post-1.0 TODO:
|
|
||||||
*
|
|
||||||
* Different dither types
|
* Different dither types
|
||||||
*
|
*
|
||||||
* Alpha dithering
|
* Alpha dithering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* 98/03/23 - fixed a longstanding fencepost - hopefully the *right*
|
||||||
|
* way, *again*. (anyone ELSE want a go? okay, just kidding... :))
|
||||||
|
* [Adam]
|
||||||
|
*
|
||||||
* 97/11/14 - added a proper pdb interface and support for dithering
|
* 97/11/14 - added a proper pdb interface and support for dithering
|
||||||
* to custom palettes (based on a patch by Eric Hernes) [Yosh]
|
* to custom palettes (based on a patch by Eric Hernes) [Yosh]
|
||||||
*
|
*
|
||||||
@ -54,6 +54,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "appenv.h"
|
#include "appenv.h"
|
||||||
#include "actionarea.h"
|
#include "actionarea.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
@ -532,7 +533,7 @@ indexed_ok_callback (GtkWidget *widget,
|
|||||||
dialog->dither, palette_type);
|
dialog->dither, palette_type);
|
||||||
gdisplays_flush ();
|
gdisplays_flush ();
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_destroy (dialog->shell);
|
gtk_widget_destroy (dialog->shell);
|
||||||
g_free (dialog);
|
g_free (dialog);
|
||||||
dialog = NULL;
|
dialog = NULL;
|
||||||
@ -1013,7 +1014,10 @@ generate_histogram_rgb (Histogram histogram,
|
|||||||
|
|
||||||
g_print ("col_limit = %d, nfc = %d\n", col_limit, num_found_cols);
|
g_print ("col_limit = %d, nfc = %d\n", col_limit, num_found_cols);
|
||||||
|
|
||||||
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
|
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0,
|
||||||
|
GIMP_DRAWABLE(layer)->width,
|
||||||
|
GIMP_DRAWABLE(layer)->height,
|
||||||
|
FALSE);
|
||||||
for (pr = pixel_regions_register (1, &srcPR);
|
for (pr = pixel_regions_register (1, &srcPR);
|
||||||
pr != NULL;
|
pr != NULL;
|
||||||
pr = pixel_regions_process (pr))
|
pr = pixel_regions_process (pr))
|
||||||
@ -1066,8 +1070,8 @@ generate_histogram_rgb (Histogram histogram,
|
|||||||
* existing colours
|
* existing colours
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Remember the new colour we just found.
|
num_found_cols++;
|
||||||
*/
|
|
||||||
if (num_found_cols > col_limit)
|
if (num_found_cols > col_limit)
|
||||||
{
|
{
|
||||||
/* There are more colours in the image
|
/* There are more colours in the image
|
||||||
@ -1076,16 +1080,17 @@ generate_histogram_rgb (Histogram histogram,
|
|||||||
* quantizing at a later stage.
|
* quantizing at a later stage.
|
||||||
*/
|
*/
|
||||||
needs_quantize = TRUE;
|
needs_quantize = TRUE;
|
||||||
g_print ("max colours exceeded - needs quantize.\n");
|
g_print ("\nmax colours exceeded - needs quantize.\n");
|
||||||
goto already_found;
|
goto already_found;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
found_cols[num_found_cols][0] = data[RED_PIX];
|
{
|
||||||
found_cols[num_found_cols][1] = data[GREEN_PIX];
|
/* Remember the new colour we just found.
|
||||||
found_cols[num_found_cols][2] = data[BLUE_PIX];
|
*/
|
||||||
|
found_cols[num_found_cols-1][0] = data[RED_PIX];
|
||||||
num_found_cols++;
|
found_cols[num_found_cols-1][1] = data[GREEN_PIX];
|
||||||
|
found_cols[num_found_cols-1][2] = data[BLUE_PIX];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
already_found:
|
already_found:
|
||||||
|
@ -19,18 +19,18 @@
|
|||||||
/*
|
/*
|
||||||
* TODO for Convert:
|
* TODO for Convert:
|
||||||
*
|
*
|
||||||
* Make GRAYSCALE->INDEXED sane again (done?)
|
|
||||||
*
|
|
||||||
* Use palette of another open INDEXED image
|
* Use palette of another open INDEXED image
|
||||||
*
|
*
|
||||||
* Post-1.0 TODO:
|
|
||||||
*
|
|
||||||
* Different dither types
|
* Different dither types
|
||||||
*
|
*
|
||||||
* Alpha dithering
|
* Alpha dithering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* 98/03/23 - fixed a longstanding fencepost - hopefully the *right*
|
||||||
|
* way, *again*. (anyone ELSE want a go? okay, just kidding... :))
|
||||||
|
* [Adam]
|
||||||
|
*
|
||||||
* 97/11/14 - added a proper pdb interface and support for dithering
|
* 97/11/14 - added a proper pdb interface and support for dithering
|
||||||
* to custom palettes (based on a patch by Eric Hernes) [Yosh]
|
* to custom palettes (based on a patch by Eric Hernes) [Yosh]
|
||||||
*
|
*
|
||||||
@ -54,6 +54,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "appenv.h"
|
#include "appenv.h"
|
||||||
#include "actionarea.h"
|
#include "actionarea.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
@ -532,7 +533,7 @@ indexed_ok_callback (GtkWidget *widget,
|
|||||||
dialog->dither, palette_type);
|
dialog->dither, palette_type);
|
||||||
gdisplays_flush ();
|
gdisplays_flush ();
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_destroy (dialog->shell);
|
gtk_widget_destroy (dialog->shell);
|
||||||
g_free (dialog);
|
g_free (dialog);
|
||||||
dialog = NULL;
|
dialog = NULL;
|
||||||
@ -1013,7 +1014,10 @@ generate_histogram_rgb (Histogram histogram,
|
|||||||
|
|
||||||
g_print ("col_limit = %d, nfc = %d\n", col_limit, num_found_cols);
|
g_print ("col_limit = %d, nfc = %d\n", col_limit, num_found_cols);
|
||||||
|
|
||||||
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
|
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0,
|
||||||
|
GIMP_DRAWABLE(layer)->width,
|
||||||
|
GIMP_DRAWABLE(layer)->height,
|
||||||
|
FALSE);
|
||||||
for (pr = pixel_regions_register (1, &srcPR);
|
for (pr = pixel_regions_register (1, &srcPR);
|
||||||
pr != NULL;
|
pr != NULL;
|
||||||
pr = pixel_regions_process (pr))
|
pr = pixel_regions_process (pr))
|
||||||
@ -1066,8 +1070,8 @@ generate_histogram_rgb (Histogram histogram,
|
|||||||
* existing colours
|
* existing colours
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Remember the new colour we just found.
|
num_found_cols++;
|
||||||
*/
|
|
||||||
if (num_found_cols > col_limit)
|
if (num_found_cols > col_limit)
|
||||||
{
|
{
|
||||||
/* There are more colours in the image
|
/* There are more colours in the image
|
||||||
@ -1076,16 +1080,17 @@ generate_histogram_rgb (Histogram histogram,
|
|||||||
* quantizing at a later stage.
|
* quantizing at a later stage.
|
||||||
*/
|
*/
|
||||||
needs_quantize = TRUE;
|
needs_quantize = TRUE;
|
||||||
g_print ("max colours exceeded - needs quantize.\n");
|
g_print ("\nmax colours exceeded - needs quantize.\n");
|
||||||
goto already_found;
|
goto already_found;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
found_cols[num_found_cols][0] = data[RED_PIX];
|
{
|
||||||
found_cols[num_found_cols][1] = data[GREEN_PIX];
|
/* Remember the new colour we just found.
|
||||||
found_cols[num_found_cols][2] = data[BLUE_PIX];
|
*/
|
||||||
|
found_cols[num_found_cols-1][0] = data[RED_PIX];
|
||||||
num_found_cols++;
|
found_cols[num_found_cols-1][1] = data[GREEN_PIX];
|
||||||
|
found_cols[num_found_cols-1][2] = data[BLUE_PIX];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
already_found:
|
already_found:
|
||||||
|
@ -19,18 +19,18 @@
|
|||||||
/*
|
/*
|
||||||
* TODO for Convert:
|
* TODO for Convert:
|
||||||
*
|
*
|
||||||
* Make GRAYSCALE->INDEXED sane again (done?)
|
|
||||||
*
|
|
||||||
* Use palette of another open INDEXED image
|
* Use palette of another open INDEXED image
|
||||||
*
|
*
|
||||||
* Post-1.0 TODO:
|
|
||||||
*
|
|
||||||
* Different dither types
|
* Different dither types
|
||||||
*
|
*
|
||||||
* Alpha dithering
|
* Alpha dithering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* 98/03/23 - fixed a longstanding fencepost - hopefully the *right*
|
||||||
|
* way, *again*. (anyone ELSE want a go? okay, just kidding... :))
|
||||||
|
* [Adam]
|
||||||
|
*
|
||||||
* 97/11/14 - added a proper pdb interface and support for dithering
|
* 97/11/14 - added a proper pdb interface and support for dithering
|
||||||
* to custom palettes (based on a patch by Eric Hernes) [Yosh]
|
* to custom palettes (based on a patch by Eric Hernes) [Yosh]
|
||||||
*
|
*
|
||||||
@ -54,6 +54,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "appenv.h"
|
#include "appenv.h"
|
||||||
#include "actionarea.h"
|
#include "actionarea.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
@ -532,7 +533,7 @@ indexed_ok_callback (GtkWidget *widget,
|
|||||||
dialog->dither, palette_type);
|
dialog->dither, palette_type);
|
||||||
gdisplays_flush ();
|
gdisplays_flush ();
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_destroy (dialog->shell);
|
gtk_widget_destroy (dialog->shell);
|
||||||
g_free (dialog);
|
g_free (dialog);
|
||||||
dialog = NULL;
|
dialog = NULL;
|
||||||
@ -1013,7 +1014,10 @@ generate_histogram_rgb (Histogram histogram,
|
|||||||
|
|
||||||
g_print ("col_limit = %d, nfc = %d\n", col_limit, num_found_cols);
|
g_print ("col_limit = %d, nfc = %d\n", col_limit, num_found_cols);
|
||||||
|
|
||||||
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
|
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0,
|
||||||
|
GIMP_DRAWABLE(layer)->width,
|
||||||
|
GIMP_DRAWABLE(layer)->height,
|
||||||
|
FALSE);
|
||||||
for (pr = pixel_regions_register (1, &srcPR);
|
for (pr = pixel_regions_register (1, &srcPR);
|
||||||
pr != NULL;
|
pr != NULL;
|
||||||
pr = pixel_regions_process (pr))
|
pr = pixel_regions_process (pr))
|
||||||
@ -1066,8 +1070,8 @@ generate_histogram_rgb (Histogram histogram,
|
|||||||
* existing colours
|
* existing colours
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Remember the new colour we just found.
|
num_found_cols++;
|
||||||
*/
|
|
||||||
if (num_found_cols > col_limit)
|
if (num_found_cols > col_limit)
|
||||||
{
|
{
|
||||||
/* There are more colours in the image
|
/* There are more colours in the image
|
||||||
@ -1076,16 +1080,17 @@ generate_histogram_rgb (Histogram histogram,
|
|||||||
* quantizing at a later stage.
|
* quantizing at a later stage.
|
||||||
*/
|
*/
|
||||||
needs_quantize = TRUE;
|
needs_quantize = TRUE;
|
||||||
g_print ("max colours exceeded - needs quantize.\n");
|
g_print ("\nmax colours exceeded - needs quantize.\n");
|
||||||
goto already_found;
|
goto already_found;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
found_cols[num_found_cols][0] = data[RED_PIX];
|
{
|
||||||
found_cols[num_found_cols][1] = data[GREEN_PIX];
|
/* Remember the new colour we just found.
|
||||||
found_cols[num_found_cols][2] = data[BLUE_PIX];
|
*/
|
||||||
|
found_cols[num_found_cols-1][0] = data[RED_PIX];
|
||||||
num_found_cols++;
|
found_cols[num_found_cols-1][1] = data[GREEN_PIX];
|
||||||
|
found_cols[num_found_cols-1][2] = data[BLUE_PIX];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
already_found:
|
already_found:
|
||||||
|
Reference in New Issue
Block a user