[gtk+/wip/baedert/gtkimageview: 561/625] GtkImageView: Don't invalidate the size if fit-allocation is set...



commit b905e7226684efddf454d2e580b0f3242da81ae4
Author: Timm Bäder <mail baedert org>
Date:   Sat Jan 23 11:17:47 2016 +0100

    GtkImageView: Don't invalidate the size if fit-allocation is set...
    
    ... and we're just changing the angle. In that case, update_adjustments
    won't recalculate it, because the transformed surface will fit into the
    widget allocation anyway.

 gtk/gtkimageview.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkimageview.c b/gtk/gtkimageview.c
index 9941521..e0ec5f6 100644
--- a/gtk/gtkimageview.c
+++ b/gtk/gtkimageview.c
@@ -1165,26 +1165,31 @@ gtk_image_view_set_angle (GtkImageView *image_view,
   gtk_image_view_get_current_state (image_view, &state);
 
   priv->angle = angle;
-  priv->size_valid = FALSE;
-
 
+  /* Setting the angle while fit-allocation is TRUE
+   * does not invalidate the bounding box size. */
+  if (!priv->fit_allocation)
+    priv->size_valid = FALSE;
 
   gtk_image_view_update_adjustments (image_view);
 
-
   g_object_notify_by_pspec (G_OBJECT (image_view),
                             widget_props[PROP_ANGLE]);
 
+  if (!priv->image_surface)
+    return;
+
   // XXX Pass a width/2, height/2 anchor here.
   //
   // TODO: Would we have to document this behavior? Or make it configurable?
 
 
-  if (priv->hadjustment != NULL && priv->vadjustment != NULL)
+  if (priv->hadjustment != NULL && priv->vadjustment != NULL &&
+      !priv->fit_allocation)
     gtk_image_view_fix_anchor (image_view,
-                                priv->anchor_x,
-                                priv->anchor_y,
-                                &state);
+                               priv->anchor_x,
+                               priv->anchor_y,
+                               &state);
 
   if (priv->fit_allocation)
     gtk_widget_queue_draw (GTK_WIDGET (image_view));


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