[poppler] glib/poppler-page.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sat Jun 19 01:40:18 PDT 2010


 glib/poppler-page.cc |   25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

New commits:
commit 9365c05c1f66b3000febf32c45cef2ffe79e041a
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sat Jun 19 10:36:39 2010 +0200

    [glib] Fix links/annots area for rotated documents with page CropBox not starting at 0,0
    
    Fixes bug #28588.

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 01d5540..a3f378b 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -1261,6 +1261,11 @@ poppler_page_get_link_mapping (PopplerPage *page)
       mapping->action = _poppler_action_new (page->document, link_action, NULL);
 
       link->getRect (&rect.x1, &rect.y1, &rect.x2, &rect.y2);
+
+      rect.x1 -= page->page->getCropBox()->x1;
+      rect.x2 -= page->page->getCropBox()->x1;
+      rect.y1 -= page->page->getCropBox()->y1;
+      rect.y2 -= page->page->getCropBox()->y1;
       
       switch (page->page->getRotate ())
         {
@@ -1291,12 +1296,7 @@ poppler_page_get_link_mapping (PopplerPage *page)
 	  mapping->area.x2 = rect.x2;
 	  mapping->area.y2 = rect.y2;
 	}
-			
-      mapping->area.x1 -= page->page->getCropBox()->x1;
-      mapping->area.x2 -= page->page->getCropBox()->x1;
-      mapping->area.y1 -= page->page->getCropBox()->y1;
-      mapping->area.y2 -= page->page->getCropBox()->y1;
-      
+
       map_list = g_list_prepend (map_list, mapping);
     }
   
@@ -1449,10 +1449,10 @@ poppler_page_get_annot_mapping (PopplerPage *page)
       }
 
     annot_rect = annot->getRect ();
-    rect.x1 = annot_rect->x1;
-    rect.y1 = annot_rect->y1;
-    rect.x2 = annot_rect->x2;
-    rect.y2 = annot_rect->y2;
+    rect.x1 = annot_rect->x1 - page->page->getCropBox()->x1;
+    rect.y1 = annot_rect->y1 - page->page->getCropBox()->y1;
+    rect.x2 = annot_rect->x2 - page->page->getCropBox()->x1;
+    rect.y2 = annot_rect->y2 - page->page->getCropBox()->y1;
 
     if (! (annot->getFlags () & Annot::flagNoRotate))
       rotation = page->page->getRotate ();
@@ -1484,11 +1484,6 @@ poppler_page_get_annot_mapping (PopplerPage *page)
         mapping->area.y2 = rect.y2;
       }
 
-    mapping->area.x1 -= page->page->getCropBox()->x1;
-    mapping->area.x2 -= page->page->getCropBox()->x1;
-    mapping->area.y1 -= page->page->getCropBox()->y1;
-    mapping->area.y2 -= page->page->getCropBox()->y1;
-
     map_list = g_list_prepend (map_list, mapping);
   }
 


More information about the poppler mailing list