[gimp] app: add gimp_display_shell_show_image()
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add gimp_display_shell_show_image()
- Date: Sat, 10 Aug 2019 21:36:09 +0000 (UTC)
commit 539d666ae23e35c85d11fc0e2619bcfe1bb6dcda
Author: Ell <ell_se yahoo com>
Date: Sat Aug 10 22:00:14 2019 +0300
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.
app/display/gimpdisplayshell-callbacks.c | 21 ++++++++++++---------
app/display/gimpdisplayshell.c | 16 ++++++++++++++++
app/display/gimpdisplayshell.h | 6 ++++++
3 files changed, 34 insertions(+), 9 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index e40bc27100..31a5ae00c5 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -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);
+
+ 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));
+ gimp_display_shell_draw_image (shell, cr,
+ floor (rect.x),
+ floor (rect.y),
+ ceil (rect.width),
+ ceil (rect.height));
+ }
}
}
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index edf197c4b3..c580fe9537 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -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)
{
diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h
index 00176344aa..3afbe3d164 100644
--- a/app/display/gimpdisplayshell.h
+++ b/app/display/gimpdisplayshell.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]