[gnome-photos/wip/rishi/gesture-zoom: 1/12] image-view: Move some code around



commit a8308be26f822841bbf9948ed4301122f30a7a1f
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Oct 15 19:41:15 2017 +0200

    image-view: Move some code around
    
    This clarifies the control and data flow required to initiate a
    best-fit animation for a zoomed in GeglBuffer.

 src/photos-image-view.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/src/photos-image-view.c b/src/photos-image-view.c
index 3f3cfd1..6b3f715 100644
--- a/src/photos-image-view.c
+++ b/src/photos-image-view.c
@@ -296,11 +296,6 @@ photos_image_view_update (PhotosImageView *self)
           zoom_scaled = 1.0 / max_ratio;
         }
 
-      bbox_zoomed.width = (gint) (zoom_scaled * bbox.width + 0.5);
-      bbox_zoomed.height = (gint) (zoom_scaled * bbox.height + 0.5);
-      bbox_zoomed.x = (gint) (zoom_scaled * bbox.x + 0.5);
-      bbox_zoomed.y = (gint) (zoom_scaled * bbox.y + 0.5);
-
       self->zoom = zoom_scaled / (gdouble) scale_factor;
       g_object_notify (G_OBJECT (self), "zoom");
 
@@ -329,11 +324,14 @@ photos_image_view_update (PhotosImageView *self)
           g_object_unref (helper);
           goto out;
         }
-      else
-        {
-          self->zoom_visible = self->zoom;
-          self->zoom_visible_scaled = zoom_scaled;
-        }
+
+      bbox_zoomed.width = (gint) (zoom_scaled * bbox.width + 0.5);
+      bbox_zoomed.height = (gint) (zoom_scaled * bbox.height + 0.5);
+      bbox_zoomed.x = (gint) (zoom_scaled * bbox.x + 0.5);
+      bbox_zoomed.y = (gint) (zoom_scaled * bbox.y + 0.5);
+
+      self->zoom_visible = self->zoom;
+      self->zoom_visible_scaled = zoom_scaled;
 
       self->x_scaled = (bbox_zoomed.width - viewport_width_real) / 2.0;
       self->y_scaled = (bbox_zoomed.height - viewport_height_real) / 2.0;


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