app: add gimp_display_shell_show_image()

... which controls whether or not the image is rendered by the
shell.  We'll use this to hide the image while showing its
transform preview in the next commits.
This commit is contained in:
Ell 2019-08-10 22:00:14 +03:00
parent c45f1b4148
commit 539d666ae2
3 changed files with 34 additions and 9 deletions

View File

@ -509,17 +509,20 @@ gimp_display_shell_canvas_draw_image (GimpDisplayShell *shell,
gimp_display_shell_draw_checkerboard (shell, cr);
cairo_restore (cr);
cairo_set_matrix (cr, &matrix);
for (i = 0; i < clip_rectangles->num_rectangles; i++)
if (shell->show_image)
{
cairo_rectangle_t rect = clip_rectangles->rectangles[i];
cairo_set_matrix (cr, &matrix);
gimp_display_shell_draw_image (shell, cr,
floor (rect.x),
floor (rect.y),
ceil (rect.width),
ceil (rect.height));
for (i = 0; i < clip_rectangles->num_rectangles; i++)
{
cairo_rectangle_t rect = clip_rectangles->rectangles[i];
gimp_display_shell_draw_image (shell, cr,
floor (rect.x),
floor (rect.y),
ceil (rect.width),
ceil (rect.height));
}
}
}

View File

@ -314,6 +314,8 @@ gimp_display_shell_init (GimpDisplayShell *shell)
shell->scale_x = 1.0;
shell->scale_y = 1.0;
shell->show_image = TRUE;
gimp_display_shell_items_init (shell);
shell->icon_size = 128;
@ -1725,6 +1727,20 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
return (*width > 0) && (*height > 0);
}
void
gimp_display_shell_set_show_image (GimpDisplayShell *shell,
gboolean show_image)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (show_image != shell->show_image)
{
shell->show_image = show_image;
gimp_display_shell_expose_full (shell);
}
}
void
gimp_display_shell_flush (GimpDisplayShell *shell)
{

View File

@ -90,6 +90,8 @@ struct _GimpDisplayShell
gboolean proximity; /* is a device in proximity */
gboolean show_image; /* whether to show the image */
Selection *selection; /* Selection (marching ants) */
GList *children;
@ -302,6 +304,10 @@ gboolean gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
gint *width,
gint *height);
void gimp_display_shell_set_show_image
(GimpDisplayShell *shell,
gboolean show_image);
void gimp_display_shell_flush (GimpDisplayShell *shell);
void gimp_display_shell_pause (GimpDisplayShell *shell);