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 ad...@apache.org on 2008/02/02 23:11:15 UTC
svn commit: r617907 - in
/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties:
BorderWidthPropertyMaker.java FixedLength.java IndentPropertyMaker.java
LengthRangeProperty.java
Author: adelmelle
Date: Sat Feb 2 14:11:12 2008
New Revision: 617907
URL: http://svn.apache.org/viewvc?rev=617907&view=rev
Log:
Further improvement in FixedLength:
* added a special ZERO_FIXED_LENGTH instance
* store only non-zero values in the PropertyCache
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FixedLength.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java?rev=617907&r1=617906&r2=617907&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java Sat Feb 2 14:11:12 2008
@@ -63,7 +63,7 @@
// Calculate the values as described in 7.7.20.
Property style = propertyList.get(borderStyleId);
if (style.getEnum() == Constants.EN_NONE) {
- return FixedLength.getInstance(0);
+ return FixedLength.ZERO_FIXED_LENGTH;
}
return p;
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FixedLength.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FixedLength.java?rev=617907&r1=617906&r2=617907&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FixedLength.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FixedLength.java Sat Feb 2 14:11:12 2008
@@ -29,6 +29,9 @@
/** cache holding all canonical FixedLength instances */
private static final PropertyCache cache = new PropertyCache();
+ /** canonical zero-length instance */
+ public static final FixedLength ZERO_FIXED_LENGTH = new FixedLength(0, "mpt", 1.0f);
+
private int millipoints;
/**
@@ -57,8 +60,12 @@
public static FixedLength getInstance(double numUnits,
String units,
float sourceResolution) {
- return (FixedLength)cache.fetch(
+ if (numUnits == 0.0) {
+ return ZERO_FIXED_LENGTH;
+ } else {
+ return (FixedLength)cache.fetch(
new FixedLength(numUnits, units, sourceResolution));
+ }
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java?rev=617907&r1=617906&r2=617907&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java Sat Feb 2 14:11:12 2008
@@ -108,7 +108,7 @@
//Margin is used
Numeric margin = propertyList.get(marginProp).getNumeric();
- Numeric v = FixedLength.getInstance(0, "mpt");
+ Numeric v = FixedLength.ZERO_FIXED_LENGTH;
if (!propertyList.getFObj().generatesReferenceAreas()) {
// The inherited_value_of([start|end]-indent)
v = NumericOp.addition(v, propertyList.getInherited(baseMaker.propId).getNumeric());
@@ -173,7 +173,7 @@
if (isInherited(propertyList) || !marginNearest) {
return null;
} else {
- return FixedLength.getInstance(0);
+ return FixedLength.ZERO_FIXED_LENGTH;
}
} else {
return indent;
@@ -182,7 +182,7 @@
//Margin is used
Numeric margin = propertyList.get(marginProp).getNumeric();
- Numeric v = FixedLength.getInstance(0);
+ Numeric v = FixedLength.ZERO_FIXED_LENGTH;
if (isInherited(propertyList)) {
// The inherited_value_of([start|end]-indent)
v = NumericOp.addition(v, propertyList.getInherited(baseMaker.propId).getNumeric());
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java?rev=617907&r1=617906&r2=617907&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java Sat Feb 2 14:11:12 2008
@@ -82,7 +82,7 @@
log.warn(FObj.decorateWithContextInfo(
"Replaced negative value (" + len + ") for " + getName()
+ " with 0mpt", fo));
- p = FixedLength.getInstance(0);
+ p = FixedLength.ZERO_FIXED_LENGTH;
}
}
}
@@ -105,7 +105,7 @@
log.warn("Replaced negative value (" + len + ") for " + getName()
+ " with 0mpt");
val.setComponent(subpropertyId,
- FixedLength.getInstance(0), false);
+ FixedLength.ZERO_FIXED_LENGTH, false);
return baseProperty;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org