From dc6f184a177b4f2055da3e9d83ac8ccea966f830 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Fri, 11 Jul 2008 20:03:36 +0000 Subject: [PATCH] const- and g_return_if_fail-ify. 2008-07-11 Martin Nordholts * app/display/gimpdisplayshell-scroll.[ch] (gimp_display_shell_get_viewport) (gimp_display_shell_get_scaled_viewport) (gimp_display_shell_get_scaled_image_viewport_offset): const- and g_return_if_fail-ify. svn path=/trunk/; revision=26140 --- ChangeLog | 8 +++++++ app/display/gimpdisplayshell-scroll.c | 32 +++++++++++++++---------- app/display/gimpdisplayshell-scroll.h | 34 +++++++++++++-------------- 3 files changed, 44 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 043fff99fd..222e9d749b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-07-11 Martin Nordholts + + * app/display/gimpdisplayshell-scroll.[ch] + (gimp_display_shell_get_viewport) + (gimp_display_shell_get_scaled_viewport) + (gimp_display_shell_get_scaled_image_viewport_offset): const- and + g_return_if_fail-ify. + 2008-07-11 Sven Neumann * app/tools/gimprotatetool.c (gimp_rotate_tool_key_press): simplified. diff --git a/app/display/gimpdisplayshell-scroll.c b/app/display/gimpdisplayshell-scroll.c index f7a7d4842d..6008f280d5 100644 --- a/app/display/gimpdisplayshell-scroll.c +++ b/app/display/gimpdisplayshell-scroll.c @@ -147,12 +147,14 @@ gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell) * **/ void -gimp_display_shell_get_scaled_viewport (GimpDisplayShell *shell, - gint *x, - gint *y, - gint *w, - gint *h) +gimp_display_shell_get_scaled_viewport (const GimpDisplayShell *shell, + gint *x, + gint *y, + gint *w, + gint *h) { + 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; if (w) *w = shell->disp_width; @@ -173,12 +175,14 @@ gimp_display_shell_get_scaled_viewport (GimpDisplayShell *shell, * **/ void -gimp_display_shell_get_viewport (GimpDisplayShell *shell, - gdouble *x, - gdouble *y, - gdouble *w, - gdouble *h) +gimp_display_shell_get_viewport (const GimpDisplayShell *shell, + gdouble *x, + gdouble *y, + gdouble *w, + gdouble *h) { + g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); + if (x) *x = shell->offset_x / shell->scale_x; if (y) *y = shell->offset_y / shell->scale_y; if (w) *w = shell->disp_width / shell->scale_x; @@ -195,10 +199,12 @@ gimp_display_shell_get_viewport (GimpDisplayShell *shell, * **/ void -gimp_display_shell_get_scaled_image_viewport_offset (GimpDisplayShell *shell, - gint *x, - gint *y) +gimp_display_shell_get_scaled_image_viewport_offset (const GimpDisplayShell *shell, + gint *x, + gint *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; } diff --git a/app/display/gimpdisplayshell-scroll.h b/app/display/gimpdisplayshell-scroll.h index 9897dda75f..f2d5364e15 100644 --- a/app/display/gimpdisplayshell-scroll.h +++ b/app/display/gimpdisplayshell-scroll.h @@ -20,27 +20,27 @@ #define __GIMP_DISPLAY_SHELL_SCROLL_H__ -void gimp_display_shell_scroll (GimpDisplayShell *shell, - gdouble x_offset_into_image, - gdouble y_offset_into_image); +void gimp_display_shell_scroll (GimpDisplayShell *shell, + gdouble x_offset_into_image, + gdouble y_offset_into_image); -void gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell); +void gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell); -void gimp_display_shell_get_scaled_viewport (GimpDisplayShell *shell, - gint *x, - gint *y, - gint *w, - gint *h); +void gimp_display_shell_get_scaled_viewport (const GimpDisplayShell *shell, + gint *x, + gint *y, + gint *w, + gint *h); -void gimp_display_shell_get_viewport (GimpDisplayShell *shell, - gdouble *x, - gdouble *y, - gdouble *w, - gdouble *h); +void gimp_display_shell_get_viewport (const GimpDisplayShell *shell, + gdouble *x, + gdouble *y, + gdouble *w, + gdouble *h); -void gimp_display_shell_get_scaled_image_viewport_offset (GimpDisplayShell *shell, - gint *x, - gint *y); +void gimp_display_shell_get_scaled_image_viewport_offset (const GimpDisplayShell *shell, + gint *x, + gint *y); #endif /* __GIMP_DISPLAY_SHELL_SCROLL_H__ */