You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2014/04/28 21:24:59 UTC
svn commit: r1590758 - in
/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr:
PageBreakingAlgorithm.java WhitespaceManagementPenalty.java
Author: vhennebert
Date: Mon Apr 28 19:24:59 2014
New Revision: 1590758
URL: http://svn.apache.org/r1590758
Log:
Create penalty only once and store it in WhitespaceManagementPenalty
Modified:
xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java
Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java?rev=1590758&r1=1590757&r2=1590758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java Mon Apr 28 19:24:59 2014
@@ -600,7 +600,7 @@ class PageBreakingAlgorithm extends Brea
private int handleWhitespaceManagementPenalty(KnuthPageNode activeNode,
WhitespaceManagementPenalty penalty, int elementIndex) {
for (Variant var : penalty.getVariants()) {
- int difference = computeDifference(activeNode, var.toPenalty(), elementIndex);
+ int difference = computeDifference(activeNode, var.getPenalty(), elementIndex);
double r = computeAdjustmentRatio(activeNode, difference);
if (r >= -1.0) {
activeNode.addVariant(var);
Modified: xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java?rev=1590758&r1=1590757&r2=1590758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java (original)
+++ xmlgraphics/fop/branches/Temp_WhitespaceManagement/src/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java Mon Apr 28 19:24:59 2014
@@ -36,14 +36,16 @@ public class WhitespaceManagementPenalty
public final List<ListElement> knuthList;
public final int width;
+ private final KnuthPenalty penalty;
public Variant(List<ListElement> knuthList, int width) {
this.knuthList = knuthList;
this.width = width;
+ this.penalty = new KnuthPenalty(width, 0, false, null, false);
}
- public KnuthElement toPenalty() {
- return new KnuthPenalty(width, 0, false, null, false);
+ public KnuthElement getPenalty() {
+ return penalty;
}
public WhitespaceManagementPenalty getWhitespaceManagementPenalty() {
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org