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



commit cc71c28e9579ad935ac288dcc2b0ea2aa600a03c
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 5e2ac4a..ef9dc0c 100644
--- a/libgimpwidgets/gimpruler.c
+++ b/libgimpwidgets/gimpruler.c
@@ -1249,9 +1249,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;
 }
 
@@ -1273,10 +1270,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);
 
@@ -1284,8 +1284,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]