Commit 1a8edbed authored by Jehan's avatar Jehan

app: replace GimpHistogramEditor's "valid" by "recompute" flag.

Having to sync the "valid" flag with the presence of a histogram is
error-prone (cf. previous commit).
Instead gimp_histogram_editor_validate() return value will just depend
on the presence of the histogram. And "valid" becomes "recompute", i.e.
a flag to request for "recomputation" of the histogram.
parent 35352519
......@@ -252,7 +252,6 @@ gimp_histogram_editor_set_property (GObject *object,
if (editor->histogram)
{
g_clear_object (&editor->histogram);
editor->valid = FALSE;
gimp_histogram_view_set_histogram (view, NULL);
}
......@@ -350,7 +349,6 @@ gimp_histogram_editor_set_image (GimpImageEditor *image_editor,
if (editor->histogram)
{
g_clear_object (&editor->histogram);
editor->valid = FALSE;
gimp_histogram_view_set_histogram (view, NULL);
}
......@@ -396,7 +394,6 @@ gimp_histogram_editor_layer_changed (GimpImage *image,
if (editor->histogram)
{
g_clear_object (&editor->histogram);
editor->valid = FALSE;
gimp_histogram_view_set_histogram (view, NULL);
}
......@@ -451,7 +448,7 @@ gimp_histogram_editor_layer_changed (GimpImage *image,
}
else if (editor->histogram)
{
editor->valid = FALSE;
editor->recompute = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (editor->box));
}
......@@ -462,7 +459,7 @@ gimp_histogram_editor_layer_changed (GimpImage *image,
static gboolean
gimp_histogram_editor_validate (GimpHistogramEditor *editor)
{
if (! editor->valid)
if (editor->recompute || ! editor->histogram)
{
if (editor->drawable)
{
......@@ -479,19 +476,16 @@ gimp_histogram_editor_validate (GimpHistogramEditor *editor)
editor->histogram,
TRUE);
}
else
else if (editor->histogram)
{
if (editor->histogram)
gimp_histogram_clear_values (editor->histogram);
gimp_histogram_clear_values (editor->histogram);
}
gimp_histogram_editor_info_update (editor);
if (editor->histogram)
editor->valid = TRUE;
editor->recompute = FALSE;
}
return editor->valid;
return (editor->histogram != NULL);
}
static void
......@@ -552,11 +546,10 @@ gimp_histogram_editor_idle_update (GimpHistogramEditor *editor)
{
editor->idle_id = 0;
/* Mark the histogram as invalid and queue a redraw.
/* Mark the histogram for recomputation and queue a redraw.
* We will then recalculate the histogram when the view is exposed.
*/
editor->valid = FALSE;
editor->recompute = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (editor->box));
return FALSE;
......
......@@ -43,7 +43,7 @@ struct _GimpHistogramEditor
GimpHistogram *bg_histogram;
guint idle_id;
gboolean valid;
gboolean recompute;
GtkWidget *menu;
GtkWidget *box;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment