From 88d064b76c75c2d33b744c9d18e094dcb47d7c97 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Thu, 27 Jun 2013 14:34:14 +0200 Subject: libview: Don't queue a redraw when damaged region hasn't changed When the region covered by old and new selection is the same, don't schedule a new redraw for the union. origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=4093541 --- libview/ev-view.c | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'libview') diff --git a/libview/ev-view.c b/libview/ev-view.c index b4755494..e8f85957 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -7598,30 +7598,32 @@ merge_selection_region (EvView *view, /* Now we figure out what needs redrawing */ if (old_sel && new_sel) { if (old_sel->covered_region && new_sel->covered_region) { - /* Anything that was previously or currently selected may - * have changed */ - region = cairo_region_copy (old_sel->covered_region); - cairo_region_union (region, new_sel->covered_region); - - if (cairo_region_is_empty (region)) { - cairo_region_destroy (region); - region = NULL; - } else { - gint num_rectangles = cairo_region_num_rectangles (region); - GdkRectangle r; - - /* We need to make the damage region a little bigger - * because the edges of the old selection might change - */ - cairo_region_get_rectangle (region, 0, &r); - r.x -= 5; - r.width = 5; - cairo_region_union_rectangle (region, &r); - - cairo_region_get_rectangle (region, num_rectangles - 1, &r); - r.x += r.width; - r.width = 5; - cairo_region_union_rectangle (region, &r); + if (!cairo_region_equal (old_sel->covered_region, new_sel->covered_region)) { + /* Anything that was previously or currently selected may + * have changed */ + region = cairo_region_copy (old_sel->covered_region); + cairo_region_union (region, new_sel->covered_region); + + if (cairo_region_is_empty (region)) { + cairo_region_destroy (region); + region = NULL; + } else { + gint num_rectangles = cairo_region_num_rectangles (region); + GdkRectangle r; + + /* We need to make the damage region a little bigger + * because the edges of the old selection might change + */ + cairo_region_get_rectangle (region, 0, &r); + r.x -= 5; + r.width = 5; + cairo_region_union_rectangle (region, &r); + + cairo_region_get_rectangle (region, num_rectangles - 1, &r); + r.x += r.width; + r.width = 5; + cairo_region_union_rectangle (region, &r); + } } } else if (old_sel->covered_region) { region = cairo_region_copy (old_sel->covered_region); -- cgit v1.2.1