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



commit 7a30bd39b74ccc3d27225c5a19091002c7510c0f
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 73d0a9d..5a299be 100644
--- a/libgimpwidgets/gimpruler.c
+++ b/libgimpwidgets/gimpruler.c
@@ -1259,9 +1259,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;
 }
 
@@ -1283,10 +1280,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);
 
@@ -1294,8 +1294,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]