summaryrefslogtreecommitdiff
path: root/libview
diff options
context:
space:
mode:
authorCarlos Garcia Campos <[email protected]>2013-06-27 14:34:14 +0200
committerraveit65 <[email protected]>2017-09-06 18:25:34 +0200
commit88d064b76c75c2d33b744c9d18e094dcb47d7c97 (patch)
tree7782c88dfc22cdca982cdb631dca85de4d7ade05 /libview
parent00a113c585f09c89aa2af55ef4070b03061490aa (diff)
downloadatril-88d064b76c75c2d33b744c9d18e094dcb47d7c97.tar.bz2
atril-88d064b76c75c2d33b744c9d18e094dcb47d7c97.tar.xz
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
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-view.c50
1 files changed, 26 insertions, 24 deletions
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);