From 5d677308df2545985dcf053f99703c506314a6e8 Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Mon, 24 Jan 2011 18:35:15 +0000 Subject: [PATCH] Bugzilla 50636: fix performance issue when adding pages in very large documents git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1062913 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/AreaTreeModel.java | 16 +++++++--------- status.xml | 8 ++++++++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/java/org/apache/fop/area/AreaTreeModel.java b/src/java/org/apache/fop/area/AreaTreeModel.java index b829d89a2..2a1f14ab5 100644 --- a/src/java/org/apache/fop/area/AreaTreeModel.java +++ b/src/java/org/apache/fop/area/AreaTreeModel.java @@ -37,10 +37,10 @@ import org.apache.commons.logging.LogFactory; */ public class AreaTreeModel { private List pageSequenceList = null; - private int currentPageSequenceIndex = -1; + private int currentPageIndex = 0; + /** the current page sequence */ protected PageSequence currentPageSequence; -// private List offDocumentItems = new java.util.ArrayList(); /** logger instance */ protected static final Log log = LogFactory.getLog(AreaTreeModel.class); @@ -59,9 +59,11 @@ public class AreaTreeModel { if (pageSequence == null) { throw new NullPointerException("pageSequence must not be null"); } + if (currentPageSequence != null) { + currentPageIndex += currentPageSequence.getPageCount(); + } this.currentPageSequence = pageSequence; pageSequenceList.add(currentPageSequence); - currentPageSequenceIndex = pageSequenceList.size() - 1; } /** @@ -70,12 +72,8 @@ public class AreaTreeModel { */ public void addPage(PageViewport page) { currentPageSequence.addPage(page); - int pageIndex = 0; - for (int i = 0; i < currentPageSequenceIndex; i++) { - pageIndex += pageSequenceList.get(i).getPageCount(); - } - pageIndex += currentPageSequence.getPageCount() - 1; - page.setPageIndex(pageIndex); + page.setPageIndex(currentPageIndex + + currentPageSequence.getPageCount() - 1); page.setPageSequence(currentPageSequence); } diff --git a/status.xml b/status.xml index c80ba0668..b604971e5 100644 --- a/status.xml +++ b/status.xml @@ -59,6 +59,14 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Bugfix: fix performance issue when adding pages, if the total number of pages + is significantly large. + + + Bugfix: fix performance issue when adding nodes, if the number of children + is significantly large. + Bugfix: relative URIs in the configuration file (base, font-base, hyphenation-base) are evaluated relative to the base URI of the configuration file. -- 2.39.5