const- and g_return_if_fail-ify.

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

	* 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
This commit is contained in:
Martin Nordholts
2008-07-11 20:03:36 +00:00
committed by Martin Nordholts
parent 00ef6ab9ec
commit dc6f184a17
3 changed files with 44 additions and 30 deletions

View File

@ -1,3 +1,11 @@
2008-07-11 Martin Nordholts <martinn@svn.gnome.org>
* 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 <sven@gimp.org> 2008-07-11 Sven Neumann <sven@gimp.org>
* app/tools/gimprotatetool.c (gimp_rotate_tool_key_press): simplified. * app/tools/gimprotatetool.c (gimp_rotate_tool_key_press): simplified.

View File

@ -147,12 +147,14 @@ gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell)
* *
**/ **/
void void
gimp_display_shell_get_scaled_viewport (GimpDisplayShell *shell, gimp_display_shell_get_scaled_viewport (const GimpDisplayShell *shell,
gint *x, gint *x,
gint *y, gint *y,
gint *w, gint *w,
gint *h) gint *h)
{ {
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (x) *x = -shell->disp_xoffset + shell->offset_x; if (x) *x = -shell->disp_xoffset + shell->offset_x;
if (y) *y = -shell->disp_yoffset + shell->offset_y; if (y) *y = -shell->disp_yoffset + shell->offset_y;
if (w) *w = shell->disp_width; if (w) *w = shell->disp_width;
@ -173,12 +175,14 @@ gimp_display_shell_get_scaled_viewport (GimpDisplayShell *shell,
* *
**/ **/
void void
gimp_display_shell_get_viewport (GimpDisplayShell *shell, gimp_display_shell_get_viewport (const GimpDisplayShell *shell,
gdouble *x, gdouble *x,
gdouble *y, gdouble *y,
gdouble *w, gdouble *w,
gdouble *h) gdouble *h)
{ {
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (x) *x = shell->offset_x / shell->scale_x; if (x) *x = shell->offset_x / shell->scale_x;
if (y) *y = shell->offset_y / shell->scale_y; if (y) *y = shell->offset_y / shell->scale_y;
if (w) *w = shell->disp_width / shell->scale_x; if (w) *w = shell->disp_width / shell->scale_x;
@ -195,10 +199,12 @@ gimp_display_shell_get_viewport (GimpDisplayShell *shell,
* *
**/ **/
void void
gimp_display_shell_get_scaled_image_viewport_offset (GimpDisplayShell *shell, gimp_display_shell_get_scaled_image_viewport_offset (const GimpDisplayShell *shell,
gint *x, gint *x,
gint *y) gint *y)
{ {
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (x) *x = shell->disp_xoffset - shell->offset_x; if (x) *x = shell->disp_xoffset - shell->offset_x;
if (y) *y = shell->disp_yoffset - shell->offset_y; if (y) *y = shell->disp_yoffset - shell->offset_y;
} }

View File

@ -20,27 +20,27 @@
#define __GIMP_DISPLAY_SHELL_SCROLL_H__ #define __GIMP_DISPLAY_SHELL_SCROLL_H__
void gimp_display_shell_scroll (GimpDisplayShell *shell, void gimp_display_shell_scroll (GimpDisplayShell *shell,
gdouble x_offset_into_image, gdouble x_offset_into_image,
gdouble y_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, void gimp_display_shell_get_scaled_viewport (const GimpDisplayShell *shell,
gint *x, gint *x,
gint *y, gint *y,
gint *w, gint *w,
gint *h); gint *h);
void gimp_display_shell_get_viewport (GimpDisplayShell *shell, void gimp_display_shell_get_viewport (const GimpDisplayShell *shell,
gdouble *x, gdouble *x,
gdouble *y, gdouble *y,
gdouble *w, gdouble *w,
gdouble *h); gdouble *h);
void gimp_display_shell_get_scaled_image_viewport_offset (GimpDisplayShell *shell, void gimp_display_shell_get_scaled_image_viewport_offset (const GimpDisplayShell *shell,
gint *x, gint *x,
gint *y); gint *y);
#endif /* __GIMP_DISPLAY_SHELL_SCROLL_H__ */ #endif /* __GIMP_DISPLAY_SHELL_SCROLL_H__ */