diff options
author | José Aliste <jaliste@src.gnome.org> | 2012-11-20 11:25:41 +0100 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2012-11-24 14:12:48 +0100 |
commit | c93702bea0718d67660f2255344dcf9b0f502d57 (patch) | |
tree | c03b36deaf37ddb5352a47e08e5a199b19854d2a | |
parent | b0297110c455eb18096268b59d6095d428380de5 (diff) |
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.
-rw-r--r-- | glib/poppler-page.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 52dab5f8..84ceb7ea 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); } |