app: add "clip" parameter to gimp_display_shell_untransform_viewport()
... which specifies whether to clip the viewport to the canvas (previously, it would always be clipped). Use the appropriate value in all callers, depending on the shell's "show all" mode. In particular, this commit avoids clipping the image projection's priority rect to the canvas in "show all" mode.
This commit is contained in:
@ -74,7 +74,7 @@ buffers_paste_cmd_callback (GimpAction *action,
|
|||||||
{
|
{
|
||||||
GimpDisplayShell *shell = gimp_display_get_shell (display);
|
GimpDisplayShell *shell = gimp_display_get_shell (display);
|
||||||
|
|
||||||
gimp_display_shell_untransform_viewport (shell,
|
gimp_display_shell_untransform_viewport (shell, ! shell->show_all,
|
||||||
&x, &y, &width, &height);
|
&x, &y, &width, &height);
|
||||||
|
|
||||||
image = gimp_display_get_image (display);
|
image = gimp_display_get_image (display);
|
||||||
|
@ -609,7 +609,8 @@ edit_paste (GimpDisplay *display,
|
|||||||
/* the actual paste-type conversion happens in gimp_edit_paste() */
|
/* the actual paste-type conversion happens in gimp_edit_paste() */
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
|
gimp_display_shell_untransform_viewport (shell, ! shell->show_all,
|
||||||
|
&x, &y, &width, &height);
|
||||||
|
|
||||||
if (gimp_edit_paste (image, drawable, paste,
|
if (gimp_edit_paste (image, drawable, paste,
|
||||||
paste_type, x, y, width, height))
|
paste_type, x, y, width, height))
|
||||||
|
@ -179,7 +179,8 @@ gimp_display_shell_dnd_position_item (GimpDisplayShell *shell,
|
|||||||
gint x, y;
|
gint x, y;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
|
||||||
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
|
gimp_display_shell_untransform_viewport (shell, ! shell->show_all,
|
||||||
|
&x, &y, &width, &height);
|
||||||
|
|
||||||
off_x = x + (width - item_width) / 2;
|
off_x = x + (width - item_width) / 2;
|
||||||
off_y = y + (height - item_height) / 2;
|
off_y = y + (height - item_height) / 2;
|
||||||
@ -495,7 +496,8 @@ gimp_display_shell_drop_buffer (GtkWidget *widget,
|
|||||||
|
|
||||||
buffer = GIMP_BUFFER (viewable);
|
buffer = GIMP_BUFFER (viewable);
|
||||||
|
|
||||||
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
|
gimp_display_shell_untransform_viewport (shell, ! shell->show_all,
|
||||||
|
&x, &y, &width, &height);
|
||||||
|
|
||||||
/* FIXME: popup a menu for selecting "Paste Into" */
|
/* FIXME: popup a menu for selecting "Paste Into" */
|
||||||
|
|
||||||
@ -567,7 +569,9 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
|
|||||||
gint height = gimp_image_get_height (image);
|
gint height = gimp_image_get_height (image);
|
||||||
|
|
||||||
if (gimp_display_get_image (shell->display))
|
if (gimp_display_get_image (shell->display))
|
||||||
gimp_display_shell_untransform_viewport (shell, &x, &y,
|
gimp_display_shell_untransform_viewport (shell,
|
||||||
|
! shell->show_all,
|
||||||
|
&x, &y,
|
||||||
&width, &height);
|
&width, &height);
|
||||||
|
|
||||||
gimp_image_add_layers (image, new_layers,
|
gimp_image_add_layers (image, new_layers,
|
||||||
|
@ -956,6 +956,7 @@ gimp_display_shell_untransform_bounds_with_scale (GimpDisplayShell *shell,
|
|||||||
/**
|
/**
|
||||||
* gimp_display_shell_untransform_viewport:
|
* gimp_display_shell_untransform_viewport:
|
||||||
* @shell: a #GimpDisplayShell
|
* @shell: a #GimpDisplayShell
|
||||||
|
* @clip: whether to clip the result to the image bounds
|
||||||
* @x: returns image x coordinate of display upper left corner
|
* @x: returns image x coordinate of display upper left corner
|
||||||
* @y: returns image y coordinate of display upper left corner
|
* @y: returns image y coordinate of display upper left corner
|
||||||
* @width: returns width of display measured in image coordinates
|
* @width: returns width of display measured in image coordinates
|
||||||
@ -966,13 +967,13 @@ gimp_display_shell_untransform_bounds_with_scale (GimpDisplayShell *shell,
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gimp_display_shell_untransform_viewport (GimpDisplayShell *shell,
|
gimp_display_shell_untransform_viewport (GimpDisplayShell *shell,
|
||||||
|
gboolean clip,
|
||||||
gint *x,
|
gint *x,
|
||||||
gint *y,
|
gint *y,
|
||||||
gint *width,
|
gint *width,
|
||||||
gint *height)
|
gint *height)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
gdouble x1, y1, x2, y2;
|
||||||
gdouble x1, y1, x2, y2;
|
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||||
|
|
||||||
@ -987,19 +988,15 @@ gimp_display_shell_untransform_viewport (GimpDisplayShell *shell,
|
|||||||
x2 = ceil (x2);
|
x2 = ceil (x2);
|
||||||
y2 = ceil (y2);
|
y2 = ceil (y2);
|
||||||
|
|
||||||
image = gimp_display_get_image (shell->display);
|
if (clip)
|
||||||
|
{
|
||||||
|
GimpImage *image = gimp_display_get_image (shell->display);
|
||||||
|
|
||||||
if (x1 < 0)
|
x1 = MAX (x1, 0);
|
||||||
x1 = 0;
|
y1 = MAX (y1, 0);
|
||||||
|
x2 = MIN (x2, gimp_image_get_width (image));
|
||||||
if (y1 < 0)
|
y2 = MIN (y2, gimp_image_get_height (image));
|
||||||
y1 = 0;
|
}
|
||||||
|
|
||||||
if (x2 > gimp_image_get_width (image))
|
|
||||||
x2 = gimp_image_get_width (image);
|
|
||||||
|
|
||||||
if (y2 > gimp_image_get_height (image))
|
|
||||||
y2 = gimp_image_get_height (image);
|
|
||||||
|
|
||||||
if (x) *x = x1;
|
if (x) *x = x1;
|
||||||
if (y) *y = y1;
|
if (y) *y = y1;
|
||||||
|
@ -190,6 +190,7 @@ void gimp_display_shell_untransform_bounds_with_scale (GimpDisplayShell *shel
|
|||||||
gdouble *ny2);
|
gdouble *ny2);
|
||||||
|
|
||||||
void gimp_display_shell_untransform_viewport (GimpDisplayShell *shell,
|
void gimp_display_shell_untransform_viewport (GimpDisplayShell *shell,
|
||||||
|
gboolean clip,
|
||||||
gint *x,
|
gint *x,
|
||||||
gint *y,
|
gint *y,
|
||||||
gint *width,
|
gint *width,
|
||||||
|
@ -1050,7 +1050,8 @@ gimp_display_shell_set_priority_viewport (GimpDisplayShell *shell)
|
|||||||
gint x, y;
|
gint x, y;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
|
||||||
gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
|
gimp_display_shell_untransform_viewport (shell, ! shell->show_all,
|
||||||
|
&x, &y, &width, &height);
|
||||||
gimp_projection_set_priority_rect (projection, x, y, width, height);
|
gimp_projection_set_priority_rect (projection, x, y, width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1847,6 +1848,8 @@ gimp_display_shell_set_show_all (GimpDisplayShell *shell,
|
|||||||
|
|
||||||
gimp_display_update_bounding_box (shell->display);
|
gimp_display_update_bounding_box (shell->display);
|
||||||
|
|
||||||
|
gimp_display_shell_set_priority_viewport (shell);
|
||||||
|
|
||||||
gimp_display_shell_expose_full (shell);
|
gimp_display_shell_expose_full (shell);
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (shell), "show-all");
|
g_object_notify (G_OBJECT (shell), "show-all");
|
||||||
|
@ -739,7 +739,7 @@ gimp_filter_tool_options_notify (GimpTool *tool,
|
|||||||
GimpItem *item = GIMP_ITEM (tool->drawable);
|
GimpItem *item = GIMP_ITEM (tool->drawable);
|
||||||
gint x, y, width, height;
|
gint x, y, width, height;
|
||||||
|
|
||||||
gimp_display_shell_untransform_viewport (shell,
|
gimp_display_shell_untransform_viewport (shell, TRUE,
|
||||||
&x, &y, &width, &height);
|
&x, &y, &width, &height);
|
||||||
|
|
||||||
if (gimp_rectangle_intersect (gimp_item_get_offset_x (item),
|
if (gimp_rectangle_intersect (gimp_item_get_offset_x (item),
|
||||||
|
@ -792,7 +792,8 @@ gimp_seamless_clone_tool_filter_update (GimpSeamlessCloneTool *sc)
|
|||||||
|
|
||||||
/* Find out at which x,y is the top left corner of the currently
|
/* Find out at which x,y is the top left corner of the currently
|
||||||
* displayed part */
|
* displayed part */
|
||||||
gimp_display_shell_untransform_viewport (shell, &x, &y, &w, &h);
|
gimp_display_shell_untransform_viewport (shell, ! shell->show_all,
|
||||||
|
&x, &y, &w, &h);
|
||||||
|
|
||||||
/* Find out where is our drawable positioned */
|
/* Find out where is our drawable positioned */
|
||||||
gimp_item_get_offset (item, &off_x, &off_y);
|
gimp_item_get_offset (item, &off_x, &off_y);
|
||||||
|
Reference in New Issue
Block a user