diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2011-01-24 18:35:15 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2011-01-24 18:35:15 +0000 |
commit | 5d677308df2545985dcf053f99703c506314a6e8 (patch) | |
tree | 3f2cee8451b745e8a633c9fdbfe0f712e688716f | |
parent | 59933c342db81b1409d1c9d3cfdb466e194e4649 (diff) | |
download | xmlgraphics-fop-5d677308df2545985dcf053f99703c506314a6e8.tar.gz xmlgraphics-fop-5d677308df2545985dcf053f99703c506314a6e8.zip |
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
-rw-r--r-- | src/java/org/apache/fop/area/AreaTreeModel.java | 16 | ||||
-rw-r--r-- | 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<PageSequence> 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. --> <release version="FOP Trunk" date="TBD"> + <action context="Code" dev="AD" type="fix" fixes-bug="50636"> + Bugfix: fix performance issue when adding pages, if the total number of pages + is significantly large. + </action> + <action context="Code" dev="AD" type="fix" fixes-bug="50626"> + Bugfix: fix performance issue when adding nodes, if the number of children + is significantly large. + </action> <action context="Config" dev="SP" type="fix"> Bugfix: relative URIs in the configuration file (base, font-base, hyphenation-base) are evaluated relative to the base URI of the configuration file. </action> |