Bug 735810 - performance shrinkage of Paths tool

In gimp_display_shell_expose_region(), invalidate each rect rather
than rebuilding the cairo_region_t as GdkRegion and then invalidating
the entire GdkRegion. Improves performance for tools that invalidate
complex regions.
This commit is contained in:
Massimo Valentini 2015-09-05 10:04:33 +02:00 committed by Michael Natterer
parent 4920033c42
commit 6cf8bda49b
1 changed files with 5 additions and 7 deletions

View File

@ -42,7 +42,7 @@ void
gimp_display_shell_expose_region (GimpDisplayShell *shell,
cairo_region_t *region)
{
GdkRegion *gdk_region;
GdkWindow *window;
gint n_rectangles;
gint i;
@ -52,7 +52,7 @@ gimp_display_shell_expose_region (GimpDisplayShell *shell,
if (! gtk_widget_get_realized (shell->canvas))
return;
gdk_region = gdk_region_new ();
window = gtk_widget_get_window (shell->canvas);
n_rectangles = cairo_region_num_rectangles (region);
for (i = 0; i < n_rectangles; i++)
@ -61,12 +61,10 @@ gimp_display_shell_expose_region (GimpDisplayShell *shell,
cairo_region_get_rectangle (region, i, &rectangle);
gdk_region_union_with_rect (gdk_region, (GdkRectangle *) &rectangle);
gdk_window_invalidate_rect (window,
(GdkRectangle *) &rectangle,
TRUE);
}
gdk_window_invalidate_region (gtk_widget_get_window (shell->canvas),
gdk_region, TRUE);
gdk_region_destroy (gdk_region);
}
void