Commit 611fcf2e authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

improved preformance by rendering the buffer only when needed for an

2002-11-01  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpcolorscale.[ch]: improved preformance by
	rendering the buffer only when needed for an expose instead of
	after each color/channel change.
parent 349289dc
2002-11-01 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpcolorscale.[ch]: improved preformance by
rendering the buffer only when needed for an expose instead of
after each color/channel change.
2002-11-01 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpcolorscale.c (gimp_color_scale_render): no
......
......@@ -105,8 +105,10 @@ gimp_color_scale_init (GimpColorScale *scale)
range->slider_size_fixed = TRUE;
range->orientation = GTK_ORIENTATION_HORIZONTAL;
range->flippable = TRUE;
/* range->update_policy = GTK_UPDATE_DELAYED; */
scale->channel = GIMP_COLOR_SELECTOR_VALUE;
scale->channel = GIMP_COLOR_SELECTOR_VALUE;
scale->needs_render = TRUE;
gimp_rgba_set (&scale->rgb, 0.0, 0.0, 0.0, 1.0);
gimp_rgb_to_hsv (&scale->rgb, &scale->hsv);
......@@ -188,7 +190,7 @@ gimp_color_scale_size_allocate (GtkWidget *widget,
g_free (scale->buf);
scale->buf = g_new (guchar, scale->rowstride * scale->height);
gimp_color_scale_render (scale);
scale->needs_render = TRUE;
}
}
......@@ -250,6 +252,12 @@ gimp_color_scale_expose (GtkWidget *widget,
{
gboolean sensitive;
if (scale->needs_render)
{
gimp_color_scale_render (scale);
scale->needs_render = FALSE;
}
area.x += widget->allocation.x;
area.y += widget->allocation.y;
......@@ -390,7 +398,7 @@ gimp_color_scale_set_channel (GimpColorScale *scale,
{
scale->channel = channel;
gimp_color_scale_render (scale);
scale->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (scale));
}
}
......@@ -407,7 +415,7 @@ gimp_color_scale_set_color (GimpColorScale *scale,
scale->rgb = *rgb;
scale->hsv = *hsv;
gimp_color_scale_render (scale);
scale->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (scale));
}
......
......@@ -57,6 +57,8 @@ struct _GimpColorScale
guint width;
guint height;
guint rowstride;
gboolean needs_render;
};
struct _GimpColorScaleClass
......
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