mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 20:12:30 +00:00
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:
parent
dc6f184a17
commit
968fa2b25e
10
ChangeLog
10
ChangeLog
|
@ -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]
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue