diff --git a/ChangeLog b/ChangeLog index 222e9d749b..0e900e8b96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-07-11 Martin Nordholts + + * 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 * app/display/gimpdisplayshell-scroll.[ch] diff --git a/app/display/gimpdisplayshell-scroll.c b/app/display/gimpdisplayshell-scroll.c index 6008f280d5..b4a740fba4 100644 --- a/app/display/gimpdisplayshell-scroll.c +++ b/app/display/gimpdisplayshell-scroll.c @@ -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; } diff --git a/app/display/gimpdisplayshell-transform.c b/app/display/gimpdisplayshell-transform.c index 86ab0471a1..0b2aa0efc1 100644 --- a/app/display/gimpdisplayshell-transform.c +++ b/app/display/gimpdisplayshell-transform.c @@ -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; } /**