]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugzilla 50636: fix performance issue when adding pages in very large documents
authorAndreas L. Delmelle <adelmelle@apache.org>
Mon, 24 Jan 2011 18:35:15 +0000 (18:35 +0000)
committerAndreas L. Delmelle <adelmelle@apache.org>
Mon, 24 Jan 2011 18:35:15 +0000 (18:35 +0000)
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
status.xml

index b829d89a2913a5af56e81665b8a9303b8c10df15..2a1f14ab5d4f0ad9d305a961b99c1fb32f46f376 100644 (file)
@@ -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);
     }
 
index c80ba0668263bf5127d89dfc6820c68b534cf805..b604971e5120cd2562de7c3c4c4b9fd293b0092b 100644 (file)
       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>