1 /* GIMP - The GNU Image Manipulation Program
2 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18 #include "config.h"
19
20 #include <gegl.h>
21 #include <gtk/gtk.h>
22
23 #include "display-types.h"
24
25 #include "gimpdisplayshell.h"
26 #include "gimpdisplayshell-expose.h"
27
28
29 void
gimp_display_shell_expose_area(GimpDisplayShell * shell,gint x,gint y,gint w,gint h)30 gimp_display_shell_expose_area (GimpDisplayShell *shell,
31 gint x,
32 gint y,
33 gint w,
34 gint h)
35 {
36 g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
37
38 gtk_widget_queue_draw_area (shell->canvas, x, y, w, h);
39 }
40
41 void
gimp_display_shell_expose_region(GimpDisplayShell * shell,cairo_region_t * region)42 gimp_display_shell_expose_region (GimpDisplayShell *shell,
43 cairo_region_t *region)
44 {
45 GdkWindow *window;
46 gint n_rectangles;
47 gint i;
48
49 g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
50 g_return_if_fail (region != NULL);
51
52 if (! gtk_widget_get_realized (shell->canvas))
53 return;
54
55 window = gtk_widget_get_window (shell->canvas);
56 n_rectangles = cairo_region_num_rectangles (region);
57
58 for (i = 0; i < n_rectangles; i++)
59 {
60 cairo_rectangle_int_t rectangle;
61
62 cairo_region_get_rectangle (region, i, &rectangle);
63
64 gdk_window_invalidate_rect (window,
65 (GdkRectangle *) &rectangle,
66 TRUE);
67 }
68 }
69
70 void
gimp_display_shell_expose_full(GimpDisplayShell * shell)71 gimp_display_shell_expose_full (GimpDisplayShell *shell)
72 {
73 g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
74
75 gtk_widget_queue_draw (shell->canvas);
76 }
77