diff options
author | Glen Mazza <gmazza@apache.org> | 2004-01-13 23:28:31 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2004-01-13 23:28:31 +0000 |
commit | 3c5e2946bb93e544ce909bb9a91250ea28927a59 (patch) | |
tree | 3b14babb1f2b33a579806fce6b87bb09ccbc9963 | |
parent | ec6b7c7b5469dbd7f805ac7c22e5bbbf04667ddf (diff) | |
download | xmlgraphics-fop-3c5e2946bb93e544ce909bb9a91250ea28927a59.tar.gz xmlgraphics-fop-3c5e2946bb93e544ce909bb9a91250ea28927a59.zip |
static boolean array inheritableProperty[] added, to reduce processing costs
of lookups to see if a property is inheritable. Work based on Finn Bock's patch.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197158 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/fo/PropertyList.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java index 343481ded..b0935d42d 100644 --- a/src/java/org/apache/fop/fo/PropertyList.java +++ b/src/java/org/apache/fop/fo/PropertyList.java @@ -69,6 +69,7 @@ public class PropertyList extends HashMap { // writing-mode values private byte[] wmtable = null; private int writingMode; + private static boolean[] inheritableProperty; // absolute directions and dimensions /** constant for direction "left" */ @@ -678,14 +679,16 @@ public class PropertyList extends HashMap { * @return isInherited value from the requested Property.Maker */ private boolean isInherited(int propId) { - boolean b = true; - - Property.Maker propertyMaker = findMaker(propId); - if (propertyMaker != null) { - b = propertyMaker.isInherited(); + if (inheritableProperty == null) { + inheritableProperty = new boolean[Constants.PROPERTY_COUNT + 1]; + Property.Maker maker = null; + for (int prop = 1; prop <= Constants.PROPERTY_COUNT; prop++) { + maker = findMaker(prop); + inheritableProperty[prop] = (maker != null && maker.isInherited()); + } } - - return b; + + return inheritableProperty[propId]; } /** |