[evince] pdf: Correctly process rectangles whose points are not in the right order



commit e973f54f4d3f81facb0fd904da357d9ec30836fa
Author: José Aliste <jaliste src gnome org>
Date:   Mon Sep 15 13:06:11 2014 -0300

    pdf: Correctly process rectangles whose points are not in the right order
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736688

 backend/pdf/ev-poppler.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index 52f4c4d5..ed344be9 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -2404,6 +2404,16 @@ create_region_from_poppler_region (GList *region, gdouble xscale, gdouble yscale
                cairo_rectangle_int_t rect;
 
                rectangle = (PopplerRectangle *)l->data;
+               if (rectangle->x2 < rectangle->x1) {
+                       double tmp = rectangle->x2;
+                       rectangle->x2 = rectangle->x1;
+                       rectangle->x1 = tmp;
+               }
+               if (rectangle->y2 < rectangle->y1) {
+                       double tmp = rectangle->y2;
+                       rectangle->y2 = rectangle->y1;
+                       rectangle->y1 = tmp;
+               }
 
                rect.x = (gint) ((rectangle->x1 * xscale) + 0.5);
                rect.y = (gint) ((rectangle->y1 * yscale) + 0.5);


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