[gimp/gtk3-port: 226/234] libgimpwidgets: Draw marker in correct position on ruler.



commit 82d699411277b69ded7fa44b7f80509be0e42934
Author: Michael Henning <drawoc darkrefraction com>
Date:   Mon Sep 28 22:10:30 2015 -0400

    libgimpwidgets: Draw marker in correct position on ruler.
    
    With gtk+3, the cairo context is offset by allocation.x/y for us,
    so we no longer need to add that factor in while drawing.

 libgimpwidgets/gimpruler.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/libgimpwidgets/gimpruler.c b/libgimpwidgets/gimpruler.c
index 3d4f19a..151295e 100644
--- a/libgimpwidgets/gimpruler.c
+++ b/libgimpwidgets/gimpruler.c
@@ -1251,9 +1251,6 @@ gimp_ruler_get_pos_rect (GimpRuler *ruler,
       rect.y = ROUND ((position - lower) * increment) + (border.top + border.bottom - rect.height) / 2 - 1;
     }
 
-  rect.x += allocation.x;
-  rect.y += allocation.y;
-
   return rect;
 }
 
@@ -1275,10 +1272,13 @@ 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);
+  GtkAllocation      allocation;
+
+  gtk_widget_get_allocation (GTK_WIDGET(ruler), &allocation);
 
   gtk_widget_queue_draw_area (GTK_WIDGET (ruler),
-                              rect.x,
-                              rect.y,
+                              rect.x + allocation.x,
+                              rect.y + allocation.y,
                               rect.width,
                               rect.height);
 
@@ -1286,8 +1286,8 @@ gimp_ruler_queue_pos_redraw (GimpRuler *ruler)
       priv->last_pos_rect.height != 0)
     {
       gtk_widget_queue_draw_area (GTK_WIDGET (ruler),
-                                  priv->last_pos_rect.x,
-                                  priv->last_pos_rect.y,
+                                  priv->last_pos_rect.x + allocation.x,
+                                  priv->last_pos_rect.y + allocation.y,
                                   priv->last_pos_rect.width,
                                   priv->last_pos_rect.height);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]