It makes more sense for gimp_display_shell_get_scaled_image_size() to be

2008-08-10  Martin Nordholts  <martinn@svn.gnome.org>

	* app/display/gimpdisplayshell-scroll.[ch]: It makes more sense
	for gimp_display_shell_get_scaled_image_size() to be moved from
	here to

	* app/display/gimpdisplayshell-draw.[ch]: here, and rename it to
	gimp_display_shell_draw_get_scaled_image_size().

	* app/display/gimpdisplayshell.c: Adapt to name change.

svn path=/trunk/; revision=26479
This commit is contained in:
Martin Nordholts
2008-08-10 10:54:00 +00:00
committed by Martin Nordholts
parent a81790d789
commit 65ff34a540
6 changed files with 82 additions and 70 deletions

View File

@ -1,3 +1,14 @@
2008-08-10 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-scroll.[ch]: It makes more sense
for gimp_display_shell_get_scaled_image_size() to be moved from
here to
* app/display/gimpdisplayshell-draw.[ch]: here, and rename it to
gimp_display_shell_draw_get_scaled_image_size().
* app/display/gimpdisplayshell.c: Adapt to name change.
2008-08-10 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-draw.[ch]

View File

@ -63,6 +63,42 @@ static GdkGC * gimp_display_shell_get_pen_gc (GimpDisplayShell *shell,
/* public functions */
/**
* gimp_display_shell_get_scaled_image_size:
* @shell:
* @w:
* @h:
*
* Gets the size of the rendered image after it has been scaled.
*
**/
void
gimp_display_shell_draw_get_scaled_image_size (const GimpDisplayShell *shell,
gint *w,
gint *h)
{
GimpProjection *proj;
TileManager *tiles;
gint level;
gint level_width;
gint level_height;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_IMAGE (shell->display->image));
proj = gimp_image_get_projection (shell->display->image);
level = gimp_projection_get_level (proj, shell->scale_x, shell->scale_y);
tiles = gimp_projection_get_tiles_at_level (proj, level, NULL);
level_width = tile_manager_width (tiles);
level_height = tile_manager_height (tiles);
if (w) *w = PROJ_ROUND (level_width * (shell->scale_x * (1 << level)));
if (h) *h = PROJ_ROUND (level_height * (shell->scale_y * (1 << level)));
}
void
gimp_display_shell_draw_guide (const GimpDisplayShell *shell,
GimpGuide *guide,
@ -511,7 +547,7 @@ gimp_display_shell_draw_area (const GimpDisplayShell *shell,
return;
gimp_display_shell_scroll_get_scaled_viewport_offset (shell, &sx, &sy);
gimp_display_shell_get_scaled_image_size (shell, &sw, &sh);
gimp_display_shell_draw_get_scaled_image_size (shell, &sw, &sh);
/* check if the passed in area intersects with
* both the display and the image

View File

@ -20,31 +20,34 @@
#define __GIMP_DISPLAY_SHELL_DRAW_H__
void gimp_display_shell_draw_guide (const GimpDisplayShell *shell,
GimpGuide *guide,
gboolean active);
void gimp_display_shell_draw_guides (const GimpDisplayShell *shell);
void gimp_display_shell_draw_grid (GimpDisplayShell *shell,
const GdkRectangle *area);
void gimp_display_shell_draw_pen (GimpDisplayShell *shell,
const GimpVector2 *points,
gint num_points,
GimpContext *context,
GimpActiveColor color,
gint width);
void gimp_display_shell_draw_sample_point (const GimpDisplayShell *shell,
GimpSamplePoint *sample_point,
gboolean active);
void gimp_display_shell_draw_sample_points (const GimpDisplayShell *shell);
void gimp_display_shell_draw_vector (const GimpDisplayShell *shell,
GimpVectors *vectors);
void gimp_display_shell_draw_vectors (const GimpDisplayShell *shell);
void gimp_display_shell_draw_cursor (const GimpDisplayShell *shell);
void gimp_display_shell_draw_area (const GimpDisplayShell *shell,
gint x,
gint y,
gint w,
gint h);
void gimp_display_shell_draw_get_scaled_image_size (const GimpDisplayShell *shell,
gint *w,
gint *h);
void gimp_display_shell_draw_guide (const GimpDisplayShell *shell,
GimpGuide *guide,
gboolean active);
void gimp_display_shell_draw_guides (const GimpDisplayShell *shell);
void gimp_display_shell_draw_grid (GimpDisplayShell *shell,
const GdkRectangle *area);
void gimp_display_shell_draw_pen (GimpDisplayShell *shell,
const GimpVector2 *points,
gint num_points,
GimpContext *context,
GimpActiveColor color,
gint width);
void gimp_display_shell_draw_sample_point (const GimpDisplayShell *shell,
GimpSamplePoint *sample_point,
gboolean active);
void gimp_display_shell_draw_sample_points (const GimpDisplayShell *shell);
void gimp_display_shell_draw_vector (const GimpDisplayShell *shell,
GimpVectors *vectors);
void gimp_display_shell_draw_vectors (const GimpDisplayShell *shell);
void gimp_display_shell_draw_cursor (const GimpDisplayShell *shell);
void gimp_display_shell_draw_area (const GimpDisplayShell *shell,
gint x,
gint y,
gint w,
gint h);
#endif /* __GIMP_DISPLAY_SHELL_DRAW_H__ */

View File

@ -36,6 +36,7 @@
#include "gimpdisplay.h"
#include "gimpdisplay-foreach.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-private.h"
#include "gimpdisplayshell-scale.h"
#include "gimpdisplayshell-scroll.h"
@ -229,7 +230,7 @@ gimp_display_shell_scroll_center_image (GimpDisplayShell *shell,
target_offset_x = shell->offset_x;
target_offset_y = shell->offset_y;
gimp_display_shell_get_scaled_image_size (shell, &sw, &sh);
gimp_display_shell_draw_get_scaled_image_size (shell, &sw, &sh);
if (horizontally)
{
@ -359,42 +360,6 @@ gimp_display_shell_scroll_get_scaled_viewport_offset (const GimpDisplayShell *sh
if (y) *y = -shell->offset_y;
}
/**
* gimp_display_shell_get_scaled_image_size:
* @shell:
* @w:
* @h:
*
* Gets the size of the rendered image after it has been scaled.
*
**/
void
gimp_display_shell_get_scaled_image_size (const GimpDisplayShell *shell,
gint *w,
gint *h)
{
GimpProjection *proj;
TileManager *tiles;
gint level;
gint level_width;
gint level_height;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_IMAGE (shell->display->image));
proj = gimp_image_get_projection (shell->display->image);
level = gimp_projection_get_level (proj, shell->scale_x, shell->scale_y);
tiles = gimp_projection_get_tiles_at_level (proj, level, NULL);
level_width = tile_manager_width (tiles);
level_height = tile_manager_height (tiles);
if (w) *w = PROJ_ROUND (level_width * (shell->scale_x * (1 << level)));
if (h) *h = PROJ_ROUND (level_height * (shell->scale_y * (1 << level)));
}
/**
* gimp_display_shell_scroll_get_disp_offset:
* @shell:
@ -478,7 +443,7 @@ gimp_display_shell_scroll_setup_hscrollbar (GimpDisplayShell *shell,
! shell->display->image)
return;
gimp_display_shell_get_scaled_image_size (shell, &sw, NULL);
gimp_display_shell_draw_get_scaled_image_size (shell, &sw, NULL);
if (shell->disp_width < sw)
{
@ -520,7 +485,7 @@ gimp_display_shell_scroll_setup_vscrollbar (GimpDisplayShell *shell,
! shell->display->image)
return;
gimp_display_shell_get_scaled_image_size (shell, NULL, &sh);
gimp_display_shell_draw_get_scaled_image_size (shell, NULL, &sh);
if (shell->disp_height < sh)
{

View File

@ -49,10 +49,6 @@ void gimp_display_shell_scroll_get_scaled_viewport_offset (const GimpDisplaySh
gint *x,
gint *y);
void gimp_display_shell_get_scaled_image_size (const GimpDisplayShell *shell,
gint *w,
gint *h);
void gimp_display_shell_scroll_get_disp_offset (const GimpDisplayShell *shell,
gint *disp_xoffset,
gint *disp_yoffset);

View File

@ -67,6 +67,7 @@
#include "gimpdisplayshell-cursor.h"
#include "gimpdisplayshell-dnd.h"
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-filter.h"
#include "gimpdisplayshell-handlers.h"
#include "gimpdisplayshell-progress.h"
@ -1334,7 +1335,7 @@ gimp_display_shell_center_image_callback (GimpDisplayShell *shell,
gboolean center_horizontally;
gboolean center_vertically;
gimp_display_shell_get_scaled_image_size (shell, &sw, &sh);
gimp_display_shell_draw_get_scaled_image_size (shell, &sw, &sh);
/* We only want to center on the axes on which the image is smaller
* than the display canvas. If it is larger, it will be centered on