[gnome-photos/wip/rishi/edit-mode: 1/29] gegl-gtk-view-helper: Look at bbox's origin when positioning the image



commit 0b95b83cdf699607312b9079a1c8efff29423167
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Nov 7 21:56:25 2015 +0100

    gegl-gtk-view-helper: Look at bbox's origin when positioning the image
    
    The GeglNode's bounding box can have non-zero x and y values when
    cropping. We need to take that into consideration when positioning the
    image.

 src/gegl-gtk-view-helper.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/gegl-gtk-view-helper.c b/src/gegl-gtk-view-helper.c
index 4638f1f..1df5e3f 100644
--- a/src/gegl-gtk-view-helper.c
+++ b/src/gegl-gtk-view-helper.c
@@ -148,13 +148,15 @@ update_autoscale(ViewHelper *self)
 
             bbox.width = (gint) (scale * bbox.width + 0.5);
             bbox.height = (gint) (scale * bbox.height + 0.5);
+            bbox.x = (gint) (scale * bbox.x + 0.5);
+            bbox.y = (gint) (scale * bbox.y + 0.5);
         }
 
         self->scale = scale;
 
         /* At this point, viewport is definitely bigger than bbox. */
-        self->x = (bbox.width - real_viewport_width) / 2.0;
-        self->y = (bbox.height - real_viewport_height) / 2.0;
+        self->x = (bbox.width - real_viewport_width) / 2.0 + bbox.x;
+        self->y = (bbox.height - real_viewport_height) / 2.0 + bbox.y;
     }
 
 }


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