Author: adelmelle
Date: Mon Jan 24 18:35:15 2011
New Revision: 1062913
URL: http://svn.apache.org/viewvc?rev=1062913&view=rev
Log:
Bugzilla 50636: fix performance issue when adding pages in very large documents
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeModel.java
xmlgraphics/fop/trunk/status.xml
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeModel.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeModel.java?rev=1062913&r1=1062912&r2=1062913&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeModel.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeModel.java Mon
Jan 24 18:35:15 2011
@@ -37,10 +37,10 @@ import org.apache.commons.logging.LogFac
*/
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);
}
Modified: xmlgraphics/fop/trunk/status.xml
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=1062913&r1=1062912&r2=1062913&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Mon Jan 24 18:35:15 2011
@@ -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>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]