[poppler] glib/poppler-page.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sat Nov 24 05:15:54 PST 2012


 glib/poppler-page.cc |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit c93702bea0718d67660f2255344dcf9b0f502d57
Author: José Aliste <jaliste at src.gnome.org>
Date:   Tue Nov 20 11:25:41 2012 +0100

    glib: Ensure text is only computed on first render
    
    Getting the text on a page could be quite slow on
    complex pages without structured text. Before this patch,
    poppler_page_render would reprocess the text each time
    is called.

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 52dab5f..84ceb7e 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -342,9 +342,11 @@ _poppler_page_render (PopplerPage      *page,
   output_dev->setCairo (cairo);
   output_dev->setPrinting (printing);
 
-  if (!printing)
-    output_dev->setTextPage (page->text);
 
+  if (!printing && page->text == NULL) {
+    page->text = new TextPage(gFalse);
+    output_dev->setTextPage (page->text);
+  }
   /* NOTE: instead of passing -1 we should/could use cairo_clip_extents()
    * to get a bounding box */
   cairo_save (cairo);
@@ -380,9 +382,6 @@ poppler_page_render (PopplerPage *page,
 {
   g_return_if_fail (POPPLER_IS_PAGE (page));
 
-  if (!page->text)
-    page->text = new TextPage(gFalse);
-
   _poppler_page_render (page, cairo, gFalse, (PopplerPrintFlags)0);
 }
 


More information about the poppler mailing list