[gimp] libgimpwidgets: merge a small GimpRuler optimization from gtk3-port



commit 64a93c605177dd8087b8939c9b6b0bb616271c33
Author: Michael Natterer <mitch gimp org>
Date:   Fri Sep 9 10:02:53 2016 +0200

    libgimpwidgets: merge a small GimpRuler optimization from gtk3-port
    
    In size_allocate(), call gimp_ruler_make_pixmap() only if the widget
    was resized, not only moved around.

 libgimpwidgets/gimpruler.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/libgimpwidgets/gimpruler.c b/libgimpwidgets/gimpruler.c
index 880a82e..028691b 100644
--- a/libgimpwidgets/gimpruler.c
+++ b/libgimpwidgets/gimpruler.c
@@ -855,6 +855,13 @@ gimp_ruler_size_allocate (GtkWidget     *widget,
 {
   GimpRuler        *ruler = GIMP_RULER (widget);
   GimpRulerPrivate *priv  = GIMP_RULER_GET_PRIVATE (ruler);
+  GtkAllocation     widget_allocation;
+  gboolean          resized;
+
+  gtk_widget_get_allocation (widget, &widget_allocation);
+
+  resized = (widget_allocation.width  != allocation->width ||
+             widget_allocation.height != allocation->height);
 
   gtk_widget_set_allocation (widget, allocation);
 
@@ -864,7 +871,8 @@ gimp_ruler_size_allocate (GtkWidget     *widget,
                               allocation->x, allocation->y,
                               allocation->width, allocation->height);
 
-      gimp_ruler_make_pixmap (ruler);
+      if (resized)
+        gimp_ruler_make_pixmap (ruler);
     }
 }
 


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