[poppler] glib/demo

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sun Feb 9 06:00:45 PST 2014


 glib/demo/annots.c |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

New commits:
commit 46b7470ae9846d7e6dbb72bbb3ff831acd954168
Author: Germán Poo-Caamaño <gpoo at gnome.org>
Date:   Thu Jan 30 14:42:51 2014 -0800

    glib-demo: Fix performance in text markup annotations
    
    Fix https://bugs.freedesktop.org/show_bug.cgi?id=51487#c45

diff --git a/glib/demo/annots.c b/glib/demo/annots.c
index 696297c..2e843fc 100644
--- a/glib/demo/annots.c
+++ b/glib/demo/annots.c
@@ -1009,7 +1009,7 @@ pgd_annots_update_selected_text (PgdAnnotsDemo *demo)
     gdouble               width, height;
     GArray               *quads_array = NULL;
     guint                 n_rects;
-    gint                  i, lines = 1;
+    gint                  i, lines = 0;
     GList                 *l_rects = NULL, *list;
 
     poppler_page_get_size (demo->page, &width, &height);
@@ -1037,15 +1037,15 @@ pgd_annots_update_selected_text (PgdAnnotsDemo *demo)
                 l_rects = g_list_append (l_rects, r);
             r = g_slice_new (PopplerRectangle);
             r->x1 = rects[i].x1;
-            r->y1 = height - rects[i].y1;
+            r->y1 = rects[i].y1;
             r->x2 = rects[i].x2;
-            r->y2 = height - rects[i].y2;
+            r->y2 = rects[i].y2;
             lines++;
         } else {
             r->x1 = MIN(r->x1, rects[i].x1);
-            r->y1 = height - MIN(r->y1, rects[i].y1);
+            r->y1 = MIN(r->y1, rects[i].y1);
             r->x2 = MAX(r->x2, rects[i].x2);
-            r->y2 = height - MAX(r->y2, rects[i].y2);
+            r->y2 = MAX(r->y2, rects[i].y2);
         }
     }
 
@@ -1062,7 +1062,14 @@ pgd_annots_update_selected_text (PgdAnnotsDemo *demo)
 
         quad = &g_array_index (quads_array, PopplerQuadrilateral, i);
         r = (PopplerRectangle *)list->data;
-        pgd_annots_set_poppler_quad_from_rectangle (quad, r);
+        quad->p1.x = r->x1;
+        quad->p1.y = height - r->y1;
+        quad->p2.x = r->x2;
+        quad->p2.y = height - r->y1;
+        quad->p3.x = r->x1;
+        quad->p3.y = height - r->y2;
+        quad->p4.x = r->x2;
+        quad->p4.y = height - r->y2;
         g_slice_free (PopplerRectangle, r);
     }
 


More information about the poppler mailing list