[gimp] Bug 771851 - Vertical ruler shows artifacts if the status bar isn't showing
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 771851 - Vertical ruler shows artifacts if the status bar isn't showing
- Date: Thu, 22 Sep 2016 21:10:24 +0000 (UTC)
commit e909b77969ea29c882ee38b622c4507e7302c705
Author: Michael Natterer <mitch gimp org>
Date: Thu Sep 22 23:03:53 2016 +0200
Bug 771851 - Vertical ruler shows artifacts if the status bar isn't showing
gimp_ruler_draw_pos(): when remembering the just drawn rectangle's
position, don't just unconditionally overwrite the previous position's
rectangle. Instead, if the previous position's rectangle has not been
cleared yet (has a non-zero size), remember the union of old and new
rectangle.
Why this only happened to the vertical ruler with statusbar off is
beyond my mind, it should have always produced artifacts.
Unrelated: make sure the idle function is removed if we decide to
immediately redraw in gimp_ruler_set_position().
libgimpwidgets/gimpruler.c | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/libgimpwidgets/gimpruler.c b/libgimpwidgets/gimpruler.c
index c5dbd0e..28b428a 100644
--- a/libgimpwidgets/gimpruler.c
+++ b/libgimpwidgets/gimpruler.c
@@ -659,6 +659,12 @@ gimp_ruler_set_position (GimpRuler *ruler,
(ABS (xdiff) > IMMEDIATE_REDRAW_THRESHOLD ||
ABS (ydiff) > IMMEDIATE_REDRAW_THRESHOLD))
{
+ if (priv->pos_redraw_idle_id)
+ {
+ g_source_remove (priv->pos_redraw_idle_id);
+ priv->pos_redraw_idle_id = 0;
+ }
+
gimp_ruler_queue_pos_redraw (ruler);
}
else if (! priv->pos_redraw_idle_id)
@@ -1289,15 +1295,16 @@ gimp_ruler_queue_pos_redraw (GimpRuler *ruler)
GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler);
const GdkRectangle rect = gimp_ruler_get_pos_rect (ruler, priv->position);
- gtk_widget_queue_draw_area (GTK_WIDGET(ruler),
+ gtk_widget_queue_draw_area (GTK_WIDGET (ruler),
rect.x,
rect.y,
rect.width,
rect.height);
- if (priv->last_pos_rect.width != 0 || priv->last_pos_rect.height != 0)
+ if (priv->last_pos_rect.width != 0 &&
+ priv->last_pos_rect.height != 0)
{
- gtk_widget_queue_draw_area (GTK_WIDGET(ruler),
+ gtk_widget_queue_draw_area (GTK_WIDGET (ruler),
priv->last_pos_rect.x,
priv->last_pos_rect.y,
priv->last_pos_rect.width,
@@ -1349,7 +1356,17 @@ gimp_ruler_draw_pos (GimpRuler *ruler,
cairo_fill (cr);
}
- priv->last_pos_rect = pos_rect;
+ if (priv->last_pos_rect.width != 0 &&
+ priv->last_pos_rect.height != 0)
+ {
+ gdk_rectangle_union (&priv->last_pos_rect,
+ &pos_rect,
+ &priv->last_pos_rect);
+ }
+ else
+ {
+ priv->last_pos_rect = pos_rect;
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]