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:

committed by
Martin Nordholts

parent
a81790d789
commit
65ff34a540
11
ChangeLog
11
ChangeLog
@ -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>
|
2008-08-10 Martin Nordholts <martinn@svn.gnome.org>
|
||||||
|
|
||||||
* app/display/gimpdisplayshell-draw.[ch]
|
* app/display/gimpdisplayshell-draw.[ch]
|
||||||
|
@ -63,6 +63,42 @@ static GdkGC * gimp_display_shell_get_pen_gc (GimpDisplayShell *shell,
|
|||||||
|
|
||||||
/* public functions */
|
/* 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
|
void
|
||||||
gimp_display_shell_draw_guide (const GimpDisplayShell *shell,
|
gimp_display_shell_draw_guide (const GimpDisplayShell *shell,
|
||||||
GimpGuide *guide,
|
GimpGuide *guide,
|
||||||
@ -511,7 +547,7 @@ gimp_display_shell_draw_area (const GimpDisplayShell *shell,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
gimp_display_shell_scroll_get_scaled_viewport_offset (shell, &sx, &sy);
|
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
|
/* check if the passed in area intersects with
|
||||||
* both the display and the image
|
* both the display and the image
|
||||||
|
@ -20,31 +20,34 @@
|
|||||||
#define __GIMP_DISPLAY_SHELL_DRAW_H__
|
#define __GIMP_DISPLAY_SHELL_DRAW_H__
|
||||||
|
|
||||||
|
|
||||||
void gimp_display_shell_draw_guide (const GimpDisplayShell *shell,
|
void gimp_display_shell_draw_get_scaled_image_size (const GimpDisplayShell *shell,
|
||||||
GimpGuide *guide,
|
gint *w,
|
||||||
gboolean active);
|
gint *h);
|
||||||
void gimp_display_shell_draw_guides (const GimpDisplayShell *shell);
|
void gimp_display_shell_draw_guide (const GimpDisplayShell *shell,
|
||||||
void gimp_display_shell_draw_grid (GimpDisplayShell *shell,
|
GimpGuide *guide,
|
||||||
const GdkRectangle *area);
|
gboolean active);
|
||||||
void gimp_display_shell_draw_pen (GimpDisplayShell *shell,
|
void gimp_display_shell_draw_guides (const GimpDisplayShell *shell);
|
||||||
const GimpVector2 *points,
|
void gimp_display_shell_draw_grid (GimpDisplayShell *shell,
|
||||||
gint num_points,
|
const GdkRectangle *area);
|
||||||
GimpContext *context,
|
void gimp_display_shell_draw_pen (GimpDisplayShell *shell,
|
||||||
GimpActiveColor color,
|
const GimpVector2 *points,
|
||||||
gint width);
|
gint num_points,
|
||||||
void gimp_display_shell_draw_sample_point (const GimpDisplayShell *shell,
|
GimpContext *context,
|
||||||
GimpSamplePoint *sample_point,
|
GimpActiveColor color,
|
||||||
gboolean active);
|
gint width);
|
||||||
void gimp_display_shell_draw_sample_points (const GimpDisplayShell *shell);
|
void gimp_display_shell_draw_sample_point (const GimpDisplayShell *shell,
|
||||||
void gimp_display_shell_draw_vector (const GimpDisplayShell *shell,
|
GimpSamplePoint *sample_point,
|
||||||
GimpVectors *vectors);
|
gboolean active);
|
||||||
void gimp_display_shell_draw_vectors (const GimpDisplayShell *shell);
|
void gimp_display_shell_draw_sample_points (const GimpDisplayShell *shell);
|
||||||
void gimp_display_shell_draw_cursor (const GimpDisplayShell *shell);
|
void gimp_display_shell_draw_vector (const GimpDisplayShell *shell,
|
||||||
void gimp_display_shell_draw_area (const GimpDisplayShell *shell,
|
GimpVectors *vectors);
|
||||||
gint x,
|
void gimp_display_shell_draw_vectors (const GimpDisplayShell *shell);
|
||||||
gint y,
|
void gimp_display_shell_draw_cursor (const GimpDisplayShell *shell);
|
||||||
gint w,
|
void gimp_display_shell_draw_area (const GimpDisplayShell *shell,
|
||||||
gint h);
|
gint x,
|
||||||
|
gint y,
|
||||||
|
gint w,
|
||||||
|
gint h);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_DISPLAY_SHELL_DRAW_H__ */
|
#endif /* __GIMP_DISPLAY_SHELL_DRAW_H__ */
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "gimpdisplay.h"
|
#include "gimpdisplay.h"
|
||||||
#include "gimpdisplay-foreach.h"
|
#include "gimpdisplay-foreach.h"
|
||||||
#include "gimpdisplayshell.h"
|
#include "gimpdisplayshell.h"
|
||||||
|
#include "gimpdisplayshell-draw.h"
|
||||||
#include "gimpdisplayshell-private.h"
|
#include "gimpdisplayshell-private.h"
|
||||||
#include "gimpdisplayshell-scale.h"
|
#include "gimpdisplayshell-scale.h"
|
||||||
#include "gimpdisplayshell-scroll.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_x = shell->offset_x;
|
||||||
target_offset_y = shell->offset_y;
|
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)
|
if (horizontally)
|
||||||
{
|
{
|
||||||
@ -359,42 +360,6 @@ gimp_display_shell_scroll_get_scaled_viewport_offset (const GimpDisplayShell *sh
|
|||||||
if (y) *y = -shell->offset_y;
|
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:
|
* gimp_display_shell_scroll_get_disp_offset:
|
||||||
* @shell:
|
* @shell:
|
||||||
@ -478,7 +443,7 @@ gimp_display_shell_scroll_setup_hscrollbar (GimpDisplayShell *shell,
|
|||||||
! shell->display->image)
|
! shell->display->image)
|
||||||
return;
|
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)
|
if (shell->disp_width < sw)
|
||||||
{
|
{
|
||||||
@ -520,7 +485,7 @@ gimp_display_shell_scroll_setup_vscrollbar (GimpDisplayShell *shell,
|
|||||||
! shell->display->image)
|
! shell->display->image)
|
||||||
return;
|
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)
|
if (shell->disp_height < sh)
|
||||||
{
|
{
|
||||||
|
@ -49,10 +49,6 @@ void gimp_display_shell_scroll_get_scaled_viewport_offset (const GimpDisplaySh
|
|||||||
gint *x,
|
gint *x,
|
||||||
gint *y);
|
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,
|
void gimp_display_shell_scroll_get_disp_offset (const GimpDisplayShell *shell,
|
||||||
gint *disp_xoffset,
|
gint *disp_xoffset,
|
||||||
gint *disp_yoffset);
|
gint *disp_yoffset);
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
#include "gimpdisplayshell-cursor.h"
|
#include "gimpdisplayshell-cursor.h"
|
||||||
#include "gimpdisplayshell-dnd.h"
|
#include "gimpdisplayshell-dnd.h"
|
||||||
#include "gimpdisplayshell-draw.h"
|
#include "gimpdisplayshell-draw.h"
|
||||||
|
#include "gimpdisplayshell-draw.h"
|
||||||
#include "gimpdisplayshell-filter.h"
|
#include "gimpdisplayshell-filter.h"
|
||||||
#include "gimpdisplayshell-handlers.h"
|
#include "gimpdisplayshell-handlers.h"
|
||||||
#include "gimpdisplayshell-progress.h"
|
#include "gimpdisplayshell-progress.h"
|
||||||
@ -1334,7 +1335,7 @@ gimp_display_shell_center_image_callback (GimpDisplayShell *shell,
|
|||||||
gboolean center_horizontally;
|
gboolean center_horizontally;
|
||||||
gboolean center_vertically;
|
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
|
/* 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
|
* than the display canvas. If it is larger, it will be centered on
|
||||||
|
Reference in New Issue
Block a user