[gnome-photos/wip/rishi/edit-mode: 1/27] gegl-gtk-view-helper: Simplify the arithmetic
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/edit-mode: 1/27] gegl-gtk-view-helper: Simplify the arithmetic
- Date: Wed, 4 Nov 2015 19:16:22 +0000 (UTC)
commit 7a9e95a5a240cae5208f6383d0f458564a25528a
Author: Debarshi Ray <debarshir gnome org>
Date: Sun Jun 21 21:50:52 2015 +0200
gegl-gtk-view-helper: Simplify the arithmetic
src/gegl-gtk-view-helper.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/gegl-gtk-view-helper.c b/src/gegl-gtk-view-helper.c
index 0013007..4638f1f 100644
--- a/src/gegl-gtk-view-helper.c
+++ b/src/gegl-gtk-view-helper.c
@@ -135,8 +135,6 @@ update_autoscale(ViewHelper *self)
} else if (self->autoscale_policy == GEGL_GTK_VIEW_AUTOSCALE_CONTENT) {
/* Calculate and set scaling factor to make the content fit inside */
- float delta_x;
- float delta_y;
float scale = 1.0;
const gint real_viewport_height = viewport.height * self->scale_factor;
const gint real_viewport_width = viewport.width * self->scale_factor;
@@ -155,10 +153,8 @@ update_autoscale(ViewHelper *self)
self->scale = scale;
/* At this point, viewport is definitely bigger than bbox. */
- delta_x = (real_viewport_width - bbox.width) / 2.0;
- delta_y = (real_viewport_height - bbox.height) / 2.0;
- self->x = -delta_x;
- self->y = -delta_y;
+ self->x = (bbox.width - real_viewport_width) / 2.0;
+ self->y = (bbox.height - real_viewport_height) / 2.0;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]