[evince] libview: Make sure we never use negative coordinates in selection rectangle



commit 4a889046215efc8826e75127c083c986b3fb096d
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Wed Jun 26 10:23:15 2013 +0200

    libview: Make sure we never use negative coordinates in selection rectangle
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702874

 libview/ev-view.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 9ea049c..a723623 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -7140,8 +7140,8 @@ compute_new_selection_text (EvView          *view,
                        _ev_view_transform_view_point_to_doc_point (view, point, &page_area,
                                                                    &selection->rect.x1,
                                                                    &selection->rect.y1);
-                       selection->rect.x1 -= border.left;
-                       selection->rect.y1 -= border.top;
+                       selection->rect.x1 = MAX (selection->rect.x1 - border.left, 0);
+                       selection->rect.y1 = MAX (selection->rect.y1 - border.top, 0);
                }
 
                /* If the selection is contained within just one page,
@@ -7154,8 +7154,8 @@ compute_new_selection_text (EvView          *view,
                        _ev_view_transform_view_point_to_doc_point (view, point, &page_area,
                                                                    &selection->rect.x2,
                                                                    &selection->rect.y2);
-                       selection->rect.x2 -= border.right;
-                       selection->rect.y2 -= border.bottom;
+                       selection->rect.x2 = MAX (selection->rect.x2 - border.right, 0);
+                       selection->rect.y2 = MAX (selection->rect.y2 - border.bottom, 0);
                }
 
                list = g_list_prepend (list, selection);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]