We can use gimp_display_shell_get_scaled_image_viewport_offset() here

2008-07-11  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-transform.c
	(gimp_display_shell_transform_xy_f)
	(gimp_display_shell_untransform_xy_f): We can use
	gimp_display_shell_get_scaled_image_viewport_offset() here

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_get_scaled_viewport): and here.

svn path=/trunk/; revision=26141
This commit is contained in:
Martin Nordholts 2008-07-11 20:28:37 +00:00 committed by Martin Nordholts
parent dc6f184a17
commit 968fa2b25e
3 changed files with 33 additions and 8 deletions

View file

@ -1,3 +1,13 @@
2008-07-11 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-transform.c
(gimp_display_shell_transform_xy_f)
(gimp_display_shell_untransform_xy_f): We can use
gimp_display_shell_get_scaled_image_viewport_offset() here
* app/display/gimpdisplayshell-scroll.c
(gimp_display_shell_get_scaled_viewport): and here.
2008-07-11 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scroll.[ch]

View file

@ -153,10 +153,16 @@ gimp_display_shell_get_scaled_viewport (const GimpDisplayShell *shell,
gint *w,
gint *h)
{
gint scaled_image_viewport_offset_x;
gint scaled_image_viewport_offset_y;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (x) *x = -shell->disp_xoffset + shell->offset_x;
if (y) *y = -shell->disp_yoffset + shell->offset_y;
gimp_display_shell_get_scaled_image_viewport_offset (shell,
&scaled_image_viewport_offset_x,
&scaled_image_viewport_offset_y);
if (x) *x = -scaled_image_viewport_offset_x;
if (y) *y = -scaled_image_viewport_offset_y;
if (w) *w = shell->disp_width;
if (h) *h = shell->disp_height;
}

View file

@ -232,6 +232,8 @@ gimp_display_shell_transform_xy_f (GimpDisplayShell *shell,
gdouble *ny,
gboolean use_offsets)
{
gint scaled_image_viewport_offset_x;
gint scaled_image_viewport_offset_y;
gint offset_x = 0;
gint offset_y = 0;
@ -247,11 +249,12 @@ gimp_display_shell_transform_xy_f (GimpDisplayShell *shell,
gimp_item_offsets (item, &offset_x, &offset_y);
}
*nx = SCALEX (shell, x + offset_x) - shell->offset_x;
*ny = SCALEY (shell, y + offset_y) - shell->offset_y;
gimp_display_shell_get_scaled_image_viewport_offset (shell,
&scaled_image_viewport_offset_x,
&scaled_image_viewport_offset_y);
*nx += shell->disp_xoffset;
*ny += shell->disp_yoffset;
*nx = SCALEX (shell, x + offset_x) + scaled_image_viewport_offset_x;
*ny = SCALEY (shell, y + offset_y) + scaled_image_viewport_offset_y;
}
/**
@ -276,6 +279,8 @@ gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
gdouble *ny,
gboolean use_offsets)
{
gint scaled_image_viewport_offset_x;
gint scaled_image_viewport_offset_y;
gint offset_x = 0;
gint offset_y = 0;
@ -294,8 +299,12 @@ gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
gimp_item_offsets (item, &offset_x, &offset_y);
}
*nx = (x + shell->offset_x) / shell->scale_x - offset_x;
*ny = (y + shell->offset_y) / shell->scale_y - offset_y;
gimp_display_shell_get_scaled_image_viewport_offset (shell,
&scaled_image_viewport_offset_x,
&scaled_image_viewport_offset_y);
*nx = (x - scaled_image_viewport_offset_x) / shell->scale_x - offset_x;
*ny = (y - scaled_image_viewport_offset_y) / shell->scale_y - offset_y;
}
/**