[gimp] app: undeprecate gimpdisplayshell-selection.c
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: undeprecate gimpdisplayshell-selection.c
- Date: Fri, 13 Jul 2018 17:10:03 +0000 (UTC)
commit 0fa991fb5f1da2985f60aee90ab98264d54b9363
Author: Michael Natterer <mitch gimp org>
Date: Fri Jul 13 19:09:01 2018 +0200
app: undeprecate gimpdisplayshell-selection.c
app/display/gimpdisplayshell-selection.c | 59 +++++++++++++++++++++++++-------
1 file changed, 46 insertions(+), 13 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-selection.c b/app/display/gimpdisplayshell-selection.c
index 3098ddcb31..5340b9bf80 100644
--- a/app/display/gimpdisplayshell-selection.c
+++ b/app/display/gimpdisplayshell-selection.c
@@ -43,10 +43,10 @@ struct _Selection
{
GimpDisplayShell *shell; /* shell that owns the selection */
- GimpSegment *segs_in; /* gdk segments of area boundary */
+ GimpSegment *segs_in; /* segments of area boundary */
gint n_segs_in; /* number of segments in segs_in */
- GimpSegment *segs_out; /* gdk segments of area boundary */
+ GimpSegment *segs_out; /* segments of area boundary */
gint n_segs_out; /* number of segments in segs_out */
guint index; /* index of current stipple pattern */
@@ -422,10 +422,24 @@ selection_start_timeout (Selection *selection)
/* Draw the ants */
if (selection->show_selection)
{
- GimpDisplayConfig *config = selection->shell->display->config;
- cairo_t *cr;
+ GdkWindow *window;
+ GdkDrawingContext *context;
+ cairo_rectangle_int_t rect;
+ cairo_region_t *region;
+ cairo_t *cr;
- cr = gdk_cairo_create (gtk_widget_get_window (selection->shell->canvas));
+ window = gtk_widget_get_window (selection->shell->canvas);
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = gdk_window_get_width (window);
+ rect.height = gdk_window_get_height (window);
+
+ region = cairo_region_create_rectangle (&rect);
+ context = gdk_window_begin_draw_frame (window, region);
+ cairo_region_destroy (region);
+
+ cr = gdk_drawing_context_get_cairo_context (context);
selection_draw (selection, cr);
@@ -439,13 +453,17 @@ selection_start_timeout (Selection *selection)
selection->n_segs_out);
}
- cairo_destroy (cr);
+ gdk_window_end_draw_frame (window, context);
if (selection->segs_in && selection->shell_visible)
- selection->timeout = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
- config->marching_ants_speed,
- (GSourceFunc) selection_timeout,
- selection, NULL);
+ {
+ GimpDisplayConfig *config = selection->shell->display->config;
+
+ selection->timeout = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
+ config->marching_ants_speed,
+ (GSourceFunc) selection_timeout,
+ selection, NULL);
+ }
}
return FALSE;
@@ -454,14 +472,29 @@ selection_start_timeout (Selection *selection)
static gboolean
selection_timeout (Selection *selection)
{
- cairo_t *cr;
+ GdkWindow *window;
+ GdkDrawingContext *context;
+ cairo_rectangle_int_t rect;
+ cairo_region_t *region;
+ cairo_t *cr;
- cr = gdk_cairo_create (gtk_widget_get_window (selection->shell->canvas));
+ window = gtk_widget_get_window (selection->shell->canvas);
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = gdk_window_get_width (window);
+ rect.height = gdk_window_get_height (window);
+
+ region = cairo_region_create_rectangle (&rect);
+ context = gdk_window_begin_draw_frame (window, region);
+ cairo_region_destroy (region);
+
+ cr = gdk_drawing_context_get_cairo_context (context);
selection->index++;
selection_draw (selection, cr);
- cairo_destroy (cr);
+ gdk_window_end_draw_frame (window, context);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]