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



commit 9e380e549270874030976a4626f783ad3283e358
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 e66fe5c..4938927 100644
--- a/libgimpwidgets/gimpruler.c
+++ b/libgimpwidgets/gimpruler.c
@@ -1243,9 +1243,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;
 }
 
@@ -1267,18 +1264,21 @@ 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);
 
   if (priv->last_pos_rect.width != 0 || 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]