mirror of https://github.com/GNOME/gimp.git
Applied patch from David Hodson <hodsond@ozemail.com.au> to fix Bug#33399:
2000-11-29 Austin Donnelly <austin@gimp.org> * app/curves.c: Applied patch from David Hodson <hodsond@ozemail.com.au> to fix Bug#33399: GIMP crashes when applying curve to Grayscaled image when preview is off. Previously the curves tool attempted a reset when changing image, but didn't correctly do this. Now it has the (more useful) behaviour of doing a partial reset, where the curve remains the same across multiple invocations, allowing you to apply the same tweak to multiple images. The internal state relevant to image type/depth is correctly reset, stopping the segfault behaviour seen before. Still no fix for Bug#33403: Curves/Levels Tool does not work on GRAYA-Images.
This commit is contained in:
parent
4dadc09cb9
commit
9a3f33f6f0
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2000-11-29 Austin Donnelly <austin@gimp.org>
|
||||
|
||||
* app/curves.c: Applied patch from David Hodson
|
||||
<hodsond@ozemail.com.au> to fix Bug#33399: GIMP crashes when
|
||||
applying curve to Grayscaled image when preview is off.
|
||||
Previously the curves tool attempted a reset when changing
|
||||
image, but didn't correctly do this. Now it has the
|
||||
(more useful) behaviour of doing a partial reset, where the
|
||||
curve remains the same across multiple invocations, allowing
|
||||
you to apply the same tweak to multiple images. The internal
|
||||
state relevant to image type/depth is correctly reset,
|
||||
stopping the segfault behaviour seen before.
|
||||
|
||||
Still no fix for Bug#33403: Curves/Levels Tool does not work
|
||||
on GRAYA-Images.
|
||||
|
||||
2000-11-27 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimp/gimpwidgets.c (gimp_int_adjustment_update): use rint().
|
||||
|
|
|
@ -113,6 +113,7 @@ static void curves_channel_callback (GtkWidget *, gpointer);
|
|||
static void curves_smooth_callback (GtkWidget *, gpointer);
|
||||
static void curves_free_callback (GtkWidget *, gpointer);
|
||||
|
||||
static void curves_channel_reset (int);
|
||||
static void curves_reset_callback (GtkWidget *, gpointer);
|
||||
static void curves_ok_callback (GtkWidget *, gpointer);
|
||||
static void curves_cancel_callback (GtkWidget *, gpointer);
|
||||
|
@ -442,29 +443,19 @@ curves_initialize (GDisplay *gdisp)
|
|||
|
||||
/* The curves dialog */
|
||||
if (!curves_dialog)
|
||||
curves_dialog = curves_dialog_new ();
|
||||
else
|
||||
if (!GTK_WIDGET_VISIBLE (curves_dialog->shell))
|
||||
gtk_widget_show (curves_dialog->shell);
|
||||
|
||||
/* Initialize the values */
|
||||
curves_dialog->channel = HISTOGRAM_VALUE;
|
||||
for (i = 0; i < 5; i++)
|
||||
for (j = 0; j < 256; j++)
|
||||
curves_dialog->curve[i][j] = j;
|
||||
|
||||
curves_dialog->grab_point = -1;
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
for (j = 0; j < 17; j++)
|
||||
{
|
||||
curves_dialog->points[i][j][0] = -1;
|
||||
curves_dialog->points[i][j][1] = -1;
|
||||
}
|
||||
curves_dialog->points[i][0][0] = 0;
|
||||
curves_dialog->points[i][0][1] = 0;
|
||||
curves_dialog->points[i][16][0] = 255;
|
||||
curves_dialog->points[i][16][1] = 255;
|
||||
curves_dialog = curves_dialog_new ();
|
||||
|
||||
/* Initialize the values */
|
||||
curves_dialog->channel = HISTOGRAM_VALUE;
|
||||
for (i = 0; i < 5; i++)
|
||||
for (j = 0; j < 256; j++)
|
||||
curves_dialog->curve[i][j] = j;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
curves_channel_reset (i);
|
||||
}
|
||||
}
|
||||
|
||||
curves_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
@ -489,6 +480,9 @@ curves_initialize (GDisplay *gdisp)
|
|||
gtk_option_menu_set_history (GTK_OPTION_MENU (curves_dialog->channel_menu),
|
||||
curves_dialog->channel);
|
||||
|
||||
gimp_lut_setup (curves_dialog->lut, (GimpLutFunc) curves_lut_func,
|
||||
(void *) curves_dialog, gimp_drawable_bytes (curves_dialog->drawable));
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (curves_dialog->shell))
|
||||
gtk_widget_show (curves_dialog->shell);
|
||||
|
||||
|
@ -1182,6 +1176,25 @@ curves_free_callback (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
curves_channel_reset (int i)
|
||||
{
|
||||
int j;
|
||||
|
||||
curves_dialog->grab_point = -1;
|
||||
|
||||
for (j = 0; j < 17; j++)
|
||||
{
|
||||
curves_dialog->points[i][j][0] = -1;
|
||||
curves_dialog->points[i][j][1] = -1;
|
||||
}
|
||||
curves_dialog->points[i][0][0] = 0;
|
||||
curves_dialog->points[i][0][1] = 0;
|
||||
curves_dialog->points[i][16][0] = 255;
|
||||
curves_dialog->points[i][16][1] = 255;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
curves_reset_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -1195,16 +1208,7 @@ curves_reset_callback (GtkWidget *widget,
|
|||
for (i = 0; i < 256; i++)
|
||||
cd->curve[cd->channel][i] = i;
|
||||
|
||||
cd->grab_point = -1;
|
||||
for (i = 0; i < 17; i++)
|
||||
{
|
||||
cd->points[cd->channel][i][0] = -1;
|
||||
cd->points[cd->channel][i][1] = -1;
|
||||
}
|
||||
cd->points[cd->channel][0][0] = 0;
|
||||
cd->points[cd->channel][0][1] = 0;
|
||||
cd->points[cd->channel][16][0] = 255;
|
||||
cd->points[cd->channel][16][1] = 255;
|
||||
curves_channel_reset (cd->channel);
|
||||
|
||||
curves_calculate_curve (cd);
|
||||
curves_update (cd, GRAPH | XRANGE_TOP | DRAW);
|
||||
|
|
68
app/curves.c
68
app/curves.c
|
@ -113,6 +113,7 @@ static void curves_channel_callback (GtkWidget *, gpointer);
|
|||
static void curves_smooth_callback (GtkWidget *, gpointer);
|
||||
static void curves_free_callback (GtkWidget *, gpointer);
|
||||
|
||||
static void curves_channel_reset (int);
|
||||
static void curves_reset_callback (GtkWidget *, gpointer);
|
||||
static void curves_ok_callback (GtkWidget *, gpointer);
|
||||
static void curves_cancel_callback (GtkWidget *, gpointer);
|
||||
|
@ -442,29 +443,19 @@ curves_initialize (GDisplay *gdisp)
|
|||
|
||||
/* The curves dialog */
|
||||
if (!curves_dialog)
|
||||
curves_dialog = curves_dialog_new ();
|
||||
else
|
||||
if (!GTK_WIDGET_VISIBLE (curves_dialog->shell))
|
||||
gtk_widget_show (curves_dialog->shell);
|
||||
|
||||
/* Initialize the values */
|
||||
curves_dialog->channel = HISTOGRAM_VALUE;
|
||||
for (i = 0; i < 5; i++)
|
||||
for (j = 0; j < 256; j++)
|
||||
curves_dialog->curve[i][j] = j;
|
||||
|
||||
curves_dialog->grab_point = -1;
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
for (j = 0; j < 17; j++)
|
||||
{
|
||||
curves_dialog->points[i][j][0] = -1;
|
||||
curves_dialog->points[i][j][1] = -1;
|
||||
}
|
||||
curves_dialog->points[i][0][0] = 0;
|
||||
curves_dialog->points[i][0][1] = 0;
|
||||
curves_dialog->points[i][16][0] = 255;
|
||||
curves_dialog->points[i][16][1] = 255;
|
||||
curves_dialog = curves_dialog_new ();
|
||||
|
||||
/* Initialize the values */
|
||||
curves_dialog->channel = HISTOGRAM_VALUE;
|
||||
for (i = 0; i < 5; i++)
|
||||
for (j = 0; j < 256; j++)
|
||||
curves_dialog->curve[i][j] = j;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
curves_channel_reset (i);
|
||||
}
|
||||
}
|
||||
|
||||
curves_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
@ -489,6 +480,9 @@ curves_initialize (GDisplay *gdisp)
|
|||
gtk_option_menu_set_history (GTK_OPTION_MENU (curves_dialog->channel_menu),
|
||||
curves_dialog->channel);
|
||||
|
||||
gimp_lut_setup (curves_dialog->lut, (GimpLutFunc) curves_lut_func,
|
||||
(void *) curves_dialog, gimp_drawable_bytes (curves_dialog->drawable));
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (curves_dialog->shell))
|
||||
gtk_widget_show (curves_dialog->shell);
|
||||
|
||||
|
@ -1182,6 +1176,25 @@ curves_free_callback (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
curves_channel_reset (int i)
|
||||
{
|
||||
int j;
|
||||
|
||||
curves_dialog->grab_point = -1;
|
||||
|
||||
for (j = 0; j < 17; j++)
|
||||
{
|
||||
curves_dialog->points[i][j][0] = -1;
|
||||
curves_dialog->points[i][j][1] = -1;
|
||||
}
|
||||
curves_dialog->points[i][0][0] = 0;
|
||||
curves_dialog->points[i][0][1] = 0;
|
||||
curves_dialog->points[i][16][0] = 255;
|
||||
curves_dialog->points[i][16][1] = 255;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
curves_reset_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -1195,16 +1208,7 @@ curves_reset_callback (GtkWidget *widget,
|
|||
for (i = 0; i < 256; i++)
|
||||
cd->curve[cd->channel][i] = i;
|
||||
|
||||
cd->grab_point = -1;
|
||||
for (i = 0; i < 17; i++)
|
||||
{
|
||||
cd->points[cd->channel][i][0] = -1;
|
||||
cd->points[cd->channel][i][1] = -1;
|
||||
}
|
||||
cd->points[cd->channel][0][0] = 0;
|
||||
cd->points[cd->channel][0][1] = 0;
|
||||
cd->points[cd->channel][16][0] = 255;
|
||||
cd->points[cd->channel][16][1] = 255;
|
||||
curves_channel_reset (cd->channel);
|
||||
|
||||
curves_calculate_curve (cd);
|
||||
curves_update (cd, GRAPH | XRANGE_TOP | DRAW);
|
||||
|
|
|
@ -113,6 +113,7 @@ static void curves_channel_callback (GtkWidget *, gpointer);
|
|||
static void curves_smooth_callback (GtkWidget *, gpointer);
|
||||
static void curves_free_callback (GtkWidget *, gpointer);
|
||||
|
||||
static void curves_channel_reset (int);
|
||||
static void curves_reset_callback (GtkWidget *, gpointer);
|
||||
static void curves_ok_callback (GtkWidget *, gpointer);
|
||||
static void curves_cancel_callback (GtkWidget *, gpointer);
|
||||
|
@ -442,29 +443,19 @@ curves_initialize (GDisplay *gdisp)
|
|||
|
||||
/* The curves dialog */
|
||||
if (!curves_dialog)
|
||||
curves_dialog = curves_dialog_new ();
|
||||
else
|
||||
if (!GTK_WIDGET_VISIBLE (curves_dialog->shell))
|
||||
gtk_widget_show (curves_dialog->shell);
|
||||
|
||||
/* Initialize the values */
|
||||
curves_dialog->channel = HISTOGRAM_VALUE;
|
||||
for (i = 0; i < 5; i++)
|
||||
for (j = 0; j < 256; j++)
|
||||
curves_dialog->curve[i][j] = j;
|
||||
|
||||
curves_dialog->grab_point = -1;
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
for (j = 0; j < 17; j++)
|
||||
{
|
||||
curves_dialog->points[i][j][0] = -1;
|
||||
curves_dialog->points[i][j][1] = -1;
|
||||
}
|
||||
curves_dialog->points[i][0][0] = 0;
|
||||
curves_dialog->points[i][0][1] = 0;
|
||||
curves_dialog->points[i][16][0] = 255;
|
||||
curves_dialog->points[i][16][1] = 255;
|
||||
curves_dialog = curves_dialog_new ();
|
||||
|
||||
/* Initialize the values */
|
||||
curves_dialog->channel = HISTOGRAM_VALUE;
|
||||
for (i = 0; i < 5; i++)
|
||||
for (j = 0; j < 256; j++)
|
||||
curves_dialog->curve[i][j] = j;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
curves_channel_reset (i);
|
||||
}
|
||||
}
|
||||
|
||||
curves_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
@ -489,6 +480,9 @@ curves_initialize (GDisplay *gdisp)
|
|||
gtk_option_menu_set_history (GTK_OPTION_MENU (curves_dialog->channel_menu),
|
||||
curves_dialog->channel);
|
||||
|
||||
gimp_lut_setup (curves_dialog->lut, (GimpLutFunc) curves_lut_func,
|
||||
(void *) curves_dialog, gimp_drawable_bytes (curves_dialog->drawable));
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (curves_dialog->shell))
|
||||
gtk_widget_show (curves_dialog->shell);
|
||||
|
||||
|
@ -1182,6 +1176,25 @@ curves_free_callback (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
curves_channel_reset (int i)
|
||||
{
|
||||
int j;
|
||||
|
||||
curves_dialog->grab_point = -1;
|
||||
|
||||
for (j = 0; j < 17; j++)
|
||||
{
|
||||
curves_dialog->points[i][j][0] = -1;
|
||||
curves_dialog->points[i][j][1] = -1;
|
||||
}
|
||||
curves_dialog->points[i][0][0] = 0;
|
||||
curves_dialog->points[i][0][1] = 0;
|
||||
curves_dialog->points[i][16][0] = 255;
|
||||
curves_dialog->points[i][16][1] = 255;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
curves_reset_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -1195,16 +1208,7 @@ curves_reset_callback (GtkWidget *widget,
|
|||
for (i = 0; i < 256; i++)
|
||||
cd->curve[cd->channel][i] = i;
|
||||
|
||||
cd->grab_point = -1;
|
||||
for (i = 0; i < 17; i++)
|
||||
{
|
||||
cd->points[cd->channel][i][0] = -1;
|
||||
cd->points[cd->channel][i][1] = -1;
|
||||
}
|
||||
cd->points[cd->channel][0][0] = 0;
|
||||
cd->points[cd->channel][0][1] = 0;
|
||||
cd->points[cd->channel][16][0] = 255;
|
||||
cd->points[cd->channel][16][1] = 255;
|
||||
curves_channel_reset (cd->channel);
|
||||
|
||||
curves_calculate_curve (cd);
|
||||
curves_update (cd, GRAPH | XRANGE_TOP | DRAW);
|
||||
|
|
|
@ -113,6 +113,7 @@ static void curves_channel_callback (GtkWidget *, gpointer);
|
|||
static void curves_smooth_callback (GtkWidget *, gpointer);
|
||||
static void curves_free_callback (GtkWidget *, gpointer);
|
||||
|
||||
static void curves_channel_reset (int);
|
||||
static void curves_reset_callback (GtkWidget *, gpointer);
|
||||
static void curves_ok_callback (GtkWidget *, gpointer);
|
||||
static void curves_cancel_callback (GtkWidget *, gpointer);
|
||||
|
@ -442,29 +443,19 @@ curves_initialize (GDisplay *gdisp)
|
|||
|
||||
/* The curves dialog */
|
||||
if (!curves_dialog)
|
||||
curves_dialog = curves_dialog_new ();
|
||||
else
|
||||
if (!GTK_WIDGET_VISIBLE (curves_dialog->shell))
|
||||
gtk_widget_show (curves_dialog->shell);
|
||||
|
||||
/* Initialize the values */
|
||||
curves_dialog->channel = HISTOGRAM_VALUE;
|
||||
for (i = 0; i < 5; i++)
|
||||
for (j = 0; j < 256; j++)
|
||||
curves_dialog->curve[i][j] = j;
|
||||
|
||||
curves_dialog->grab_point = -1;
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
for (j = 0; j < 17; j++)
|
||||
{
|
||||
curves_dialog->points[i][j][0] = -1;
|
||||
curves_dialog->points[i][j][1] = -1;
|
||||
}
|
||||
curves_dialog->points[i][0][0] = 0;
|
||||
curves_dialog->points[i][0][1] = 0;
|
||||
curves_dialog->points[i][16][0] = 255;
|
||||
curves_dialog->points[i][16][1] = 255;
|
||||
curves_dialog = curves_dialog_new ();
|
||||
|
||||
/* Initialize the values */
|
||||
curves_dialog->channel = HISTOGRAM_VALUE;
|
||||
for (i = 0; i < 5; i++)
|
||||
for (j = 0; j < 256; j++)
|
||||
curves_dialog->curve[i][j] = j;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
curves_channel_reset (i);
|
||||
}
|
||||
}
|
||||
|
||||
curves_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
||||
|
@ -489,6 +480,9 @@ curves_initialize (GDisplay *gdisp)
|
|||
gtk_option_menu_set_history (GTK_OPTION_MENU (curves_dialog->channel_menu),
|
||||
curves_dialog->channel);
|
||||
|
||||
gimp_lut_setup (curves_dialog->lut, (GimpLutFunc) curves_lut_func,
|
||||
(void *) curves_dialog, gimp_drawable_bytes (curves_dialog->drawable));
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (curves_dialog->shell))
|
||||
gtk_widget_show (curves_dialog->shell);
|
||||
|
||||
|
@ -1182,6 +1176,25 @@ curves_free_callback (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
curves_channel_reset (int i)
|
||||
{
|
||||
int j;
|
||||
|
||||
curves_dialog->grab_point = -1;
|
||||
|
||||
for (j = 0; j < 17; j++)
|
||||
{
|
||||
curves_dialog->points[i][j][0] = -1;
|
||||
curves_dialog->points[i][j][1] = -1;
|
||||
}
|
||||
curves_dialog->points[i][0][0] = 0;
|
||||
curves_dialog->points[i][0][1] = 0;
|
||||
curves_dialog->points[i][16][0] = 255;
|
||||
curves_dialog->points[i][16][1] = 255;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
curves_reset_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -1195,16 +1208,7 @@ curves_reset_callback (GtkWidget *widget,
|
|||
for (i = 0; i < 256; i++)
|
||||
cd->curve[cd->channel][i] = i;
|
||||
|
||||
cd->grab_point = -1;
|
||||
for (i = 0; i < 17; i++)
|
||||
{
|
||||
cd->points[cd->channel][i][0] = -1;
|
||||
cd->points[cd->channel][i][1] = -1;
|
||||
}
|
||||
cd->points[cd->channel][0][0] = 0;
|
||||
cd->points[cd->channel][0][1] = 0;
|
||||
cd->points[cd->channel][16][0] = 255;
|
||||
cd->points[cd->channel][16][1] = 255;
|
||||
curves_channel_reset (cd->channel);
|
||||
|
||||
curves_calculate_curve (cd);
|
||||
curves_update (cd, GRAPH | XRANGE_TOP | DRAW);
|
||||
|
|
Loading…
Reference in New Issue