gimp r26563 - in trunk: . app/display
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26563 - in trunk: . app/display
- Date: Thu, 14 Aug 2008 19:45:35 +0000 (UTC)
Author: martinn
Date: Thu Aug 14 19:45:35 2008
New Revision: 26563
URL: http://svn.gnome.org/viewvc/gimp?rev=26563&view=rev
Log:
2008-08-14 Martin Nordholts <martinn svn gnome org>
* app/display/gimpdisplayshell-scale.c
(gimp_display_shell_scale_image_stops_to_fit): New function.
(gimp_display_shell_scale_get_zoom_focus): If the image stops
to fit the viewport, we can already now use the mouse cursor
as the zoom focus point.
Modified:
trunk/ChangeLog
trunk/app/display/gimpdisplayshell-scale.c
Modified: trunk/app/display/gimpdisplayshell-scale.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scale.c (original)
+++ trunk/app/display/gimpdisplayshell-scale.c Thu Aug 14 19:45:35 2008
@@ -75,6 +75,7 @@
gdouble y);
static void gimp_display_shell_scale_get_zoom_focus (GimpDisplayShell *shell,
gdouble new_scale,
+ gdouble current_scale,
gint *x,
gint *y);
@@ -329,13 +330,19 @@
}
}
-static void
+static gboolean
gimp_display_shell_scale_image_starts_to_fit (GimpDisplayShell *shell,
gdouble new_scale,
gdouble current_scale,
gboolean *vertically,
gboolean *horizontally)
{
+ gboolean vertically_dummy;
+ gboolean horizontally_dummy;
+
+ if (! vertically) vertically = &vertically_dummy;
+ if (! horizontally) horizontally = &horizontally_dummy;
+
/* The image can only start to fit if we zoom out */
if (new_scale > current_scale)
{
@@ -366,6 +373,22 @@
new_scale_height < shell->disp_height;
}
+
+ return *vertically && *horizontally;
+}
+
+static gboolean
+gimp_display_shell_scale_image_stops_to_fit (GimpDisplayShell *shell,
+ gdouble new_scale,
+ gdouble current_scale,
+ gboolean *vertically,
+ gboolean *horizontally)
+{
+ return gimp_display_shell_scale_image_starts_to_fit (shell,
+ current_scale,
+ new_scale,
+ vertically,
+ horizontally);
}
/**
@@ -412,7 +435,11 @@
&vertically,
&horizontally);
- gimp_display_shell_scale_get_zoom_focus (shell, real_new_scale, &x, &y);
+ gimp_display_shell_scale_get_zoom_focus (shell,
+ real_new_scale,
+ current_scale,
+ &x,
+ &y);
gimp_display_shell_scale_to (shell, real_new_scale, x, y);
@@ -976,16 +1003,19 @@
static void
gimp_display_shell_scale_get_zoom_focus (GimpDisplayShell *shell,
gdouble new_scale,
+ gdouble current_scale,
gint *x,
gint *y)
{
GdkEvent *event;
- if (gimp_display_shell_scale_image_is_within_viewport (shell))
+ if (gimp_display_shell_scale_image_is_within_viewport (shell) &&
+ ! gimp_display_shell_scale_image_stops_to_fit (shell,
+ new_scale,
+ current_scale,
+ NULL,
+ NULL))
{
- /* If the image is within the viewport and we are zooming out, put
- * the zoom focus in the center of the image
- */
gint sw, sh;
gimp_display_shell_draw_get_scaled_image_size (shell,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]