[gtk+/wip/baedert/gtkimageview: 165/228] GtkImageView: Refactor anchor fixing in _set_scale



commit 6773d412971f8344eaeb1ea07f9c22024abcc760
Author: Timm Bäder <mail baedert org>
Date:   Mon Jan 25 17:24:36 2016 +0100

    GtkImageView: Refactor anchor fixing in _set_scale

 gtk/gtkimageview.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkimageview.c b/gtk/gtkimageview.c
index 99b72ac..1cf306f 100644
--- a/gtk/gtkimageview.c
+++ b/gtk/gtkimageview.c
@@ -1151,20 +1151,17 @@ gtk_image_view_set_scale (GtkImageView *image_view,
 {
   GtkImageViewPrivate *priv = gtk_image_view_get_instance_private (image_view);
   State state;
-  double pointer_x;
-  double pointer_y;
 
   g_return_if_fail (GTK_IS_IMAGE_VIEW (image_view));
   g_return_if_fail (scale > 0.0);
 
-  pointer_x = gtk_widget_get_allocated_width (GTK_WIDGET (image_view))  / 2;
-  pointer_y = gtk_widget_get_allocated_height (GTK_WIDGET (image_view)) / 2;
-
   gtk_image_view_get_current_state (image_view, &state);
   gtk_image_view_set_scale_internal (image_view, scale);
 
   if (priv->hadjustment != NULL && priv->vadjustment != NULL)
     {
+      int pointer_x = gtk_widget_get_allocated_width (GTK_WIDGET (image_view)) / 2;
+      int pointer_y = gtk_widget_get_allocated_height (GTK_WIDGET (image_view)) / 2;
       gtk_image_view_fix_anchor (image_view,
                                  pointer_x,
                                  pointer_y,


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