app: add support for show-all mode in GimpCanvasPassePartout

Don't clip the outer rect to the size of the canvas in show-all
mode.
This commit is contained in:
Ell
2019-09-04 18:32:21 +03:00
parent f5ffc7d831
commit 5b428a115d

View File

@ -26,6 +26,7 @@
#include "display-types.h"
#include "gimpcanvas-style.h"
#include "gimpcanvasitem-utils.h"
#include "gimpcanvaspassepartout.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-scale.h"
@ -142,10 +143,22 @@ gimp_canvas_passe_partout_draw (GimpCanvasItem *item,
cairo_t *cr)
{
GimpDisplayShell *shell = gimp_canvas_item_get_shell (item);
gint x, y;
gint w, h;
if (! shell->show_all)
{
x = -shell->offset_x;
y = -shell->offset_y;
gimp_display_shell_scale_get_image_size (shell, &w, &h);
cairo_rectangle (cr, - shell->offset_x, - shell->offset_y, w, h);
}
else
{
gimp_canvas_item_untransform_viewport (item, &x, &y, &w, &h);
}
cairo_rectangle (cr, x, y, w, h);
GIMP_CANVAS_ITEM_CLASS (parent_class)->draw (item, cr);
}
@ -155,6 +168,9 @@ gimp_canvas_passe_partout_get_extents (GimpCanvasItem *item)
{
GimpDisplayShell *shell = gimp_canvas_item_get_shell (item);
cairo_rectangle_int_t rectangle;
if (! shell->show_all)
{
cairo_region_t *inner;
cairo_region_t *outer;
@ -174,6 +190,17 @@ gimp_canvas_passe_partout_get_extents (GimpCanvasItem *item)
return outer;
}
else
{
gimp_canvas_item_untransform_viewport (item,
&rectangle.x,
&rectangle.y,
&rectangle.width,
&rectangle.height);
return cairo_region_create_rectangle (&rectangle);
}
}
static void
gimp_canvas_passe_partout_fill (GimpCanvasItem *item,