diff options
author | Finn Bock <bckfnn@apache.org> | 2004-10-20 11:55:32 +0000 |
---|---|---|
committer | Finn Bock <bckfnn@apache.org> | 2004-10-20 11:55:32 +0000 |
commit | d5a7a89f11b2d6a4251cf9826d8cc71c1574fe3e (patch) | |
tree | a9bf86a3ca8d674f0ecaa009417a12992500bd66 | |
parent | abf59e19e944ece15e8daa8c46f25e45c6f614bf (diff) | |
download | xmlgraphics-fop-d5a7a89f11b2d6a4251cf9826d8cc71c1574fe3e.tar.gz xmlgraphics-fop-d5a7a89f11b2d6a4251cf9826d8cc71c1574fe3e.zip |
Third phase of performance improvement.
- Use the new CommonXXX fields.
PR: 31699
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198078 13f79535-47bb-0310-9956-ffa450edef68
10 files changed, 47 insertions, 56 deletions
diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java index 9b32a40f4..29299be67 100644 --- a/src/java/org/apache/fop/fo/PropertyList.java +++ b/src/java/org/apache/fop/fo/PropertyList.java @@ -488,7 +488,7 @@ abstract public class PropertyList { * @return a HyphenationProps object */ public CommonHyphenation getHyphenationProps() { - return new CommonHyphenation(); + return new CommonHyphenation(this); } /** @@ -496,7 +496,7 @@ abstract public class PropertyList { * @return a MarginProps object */ public CommonMarginBlock getMarginBlockProps() { - return new CommonMarginBlock(); + return new CommonMarginBlock(this); } /** @@ -504,7 +504,7 @@ abstract public class PropertyList { * @return a MarginInlineProps object */ public CommonMarginInline getMarginInlineProps() { - return new CommonMarginInline(); + return new CommonMarginInline(this); } /** @@ -512,7 +512,7 @@ abstract public class PropertyList { * @return a AccessibilityProps object */ public CommonAccessibility getAccessibilityProps() { - return new CommonAccessibility(); + return new CommonAccessibility(this); } /** @@ -520,7 +520,7 @@ abstract public class PropertyList { * @return a AuralProps object */ public CommonAural getAuralProps() { - CommonAural props = new CommonAural(); + CommonAural props = new CommonAural(this); return props; } @@ -529,7 +529,7 @@ abstract public class PropertyList { * @return a RelativePositionProps object */ public CommonRelativePosition getRelativePositionProps() { - return new CommonRelativePosition(); + return new CommonRelativePosition(this); } /** @@ -537,7 +537,7 @@ abstract public class PropertyList { * @return a AbsolutePositionProps object */ public CommonAbsolutePosition getAbsolutePositionProps() { - return new CommonAbsolutePosition(); + return new CommonAbsolutePosition(this); } diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index 87cd555ec..c6cdf15b6 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -160,7 +160,7 @@ public class Leader extends FObjMixed { } public Font getFontState() { - return propMgr.getFontState(getFOEventHandler().getFontInfo()); + return commonFont.getFontState(getFOEventHandler().getFontInfo()); } public int getPatternWidth() { diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index a48e65e20..7b9d86bb5 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -137,7 +137,7 @@ public class PageNumber extends FObj { * @return the FontState object for this PageNumber */ public Font getFontState() { - return propMgr.getFontState(getFOEventHandler().getFontInfo()); + return commonFont.getFontState(getFOEventHandler().getFontInfo()); } diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java index 4b732fb67..483c28b0c 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java @@ -94,10 +94,13 @@ public class RegionBody extends Region { * writing-mode on the page (not on the region-body!). If that's not * set but indent is explicitly set, it will return that. */ - CommonMarginBlock mProps = propMgr.getMarginProps(); - return new Rectangle(mProps.startIndent, mProps.spaceBefore, - reldims.ipd - mProps.startIndent - mProps.endIndent, - reldims.bpd - mProps.spaceBefore - mProps.spaceAfter); + int start = commonMarginBlock.startIndent.getValue(); + int end = commonMarginBlock.endIndent.getValue(); + int before = commonMarginBlock.spaceBefore.getOptimum().getLength().getValue(); + int after = commonMarginBlock.spaceAfter.getOptimum().getLength().getValue(); + return new Rectangle(start, before, + reldims.ipd - start - end, + reldims.bpd - before - after); } /** diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java index 3894144c6..edf25f17c 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -23,14 +23,12 @@ import java.util.ArrayList; import java.util.List; import org.apache.fop.datatypes.PercentBase; -import org.apache.fop.fo.PropertyManager; import org.apache.fop.fonts.Font; import org.apache.fop.area.Area; import org.apache.fop.area.Block; import org.apache.fop.area.BlockParent; import org.apache.fop.area.LineArea; -import org.apache.fop.traits.LayoutProps; -import org.apache.fop.fo.properties.CommonMarginBlock; +import org.apache.fop.traits.SpaceVal; import org.apache.fop.traits.MinOptMax; /** @@ -43,9 +41,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { protected ListIterator proxyLMiter; - private LayoutProps layoutProps; - private CommonMarginBlock marginProps; - /* holds the (one-time use) fo:block space-before and -after properties. Large fo:blocks are split into multiple Area.Blocks to accomodate the subsequent @@ -85,10 +80,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { * if defined for the block. */ protected void initProperties() { - PropertyManager pm = fobj.getPropertyManager(); - layoutProps = pm.getLayoutProps(); - marginProps = pm.getMarginProps(); - foBlockSpaceBefore = layoutProps.spaceBefore.getSpace(); + foBlockSpaceBefore = new SpaceVal(fobj.getCommonMarginBlock().spaceBefore).getSpace(); prevFoBlockSpaceAfter = foBlockSpaceAfter; } @@ -170,7 +162,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { LayoutManager curLM; // currently active LM int ipd = context.getRefIPD(); - int iIndents = marginProps.startIndent + marginProps.endIndent; + int iIndents = fobj.getCommonMarginBlock().startIndent.getValue() + fobj.getCommonMarginBlock().endIndent.getValue(); int bIndents = fobj.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false); ipd -= iIndents; @@ -249,7 +241,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { if (getChildLM() == null || over) { if (getChildLM() == null) { setFinished(true); - stackSize.add(layoutProps.spaceAfter.getSpace()); + stackSize.add(new SpaceVal(fobj.getCommonMarginBlock().spaceAfter).getSpace()); } BreakPoss breakPoss = new BreakPoss( new LeafPosition(this, childBreaks.size() - 1)); @@ -275,7 +267,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { addBlockSpacing(adjust, foBlockSpaceBefore); foBlockSpaceBefore = null; - addID(); + addID(fobj.getId()); addMarkers(true, true); LayoutManager childLM; @@ -297,14 +289,12 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { } } - int bIndents = fobj.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false); - addMarkers(false, true); flush(); // if adjusted space after - foBlockSpaceAfter = layoutProps.spaceAfter.getSpace(); + foBlockSpaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter).getSpace(); addBlockSpacing(adjust, foBlockSpaceAfter); curBlockArea = null; @@ -327,8 +317,8 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { // set traits TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground()); TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground()); - TraitSetter.addMargins(curBlockArea, fobj.getCommonBorderPaddingBackground(), marginProps); - TraitSetter.addBreaks(curBlockArea, layoutProps); + TraitSetter.addMargins(curBlockArea, fobj.getCommonBorderPaddingBackground(), fobj.getCommonMarginBlock()); + TraitSetter.addBreaks(curBlockArea, fobj.getBreakBefore(), fobj.getBreakAfter()); // Set up dimensions // Must get dimensions from parent area @@ -347,7 +337,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { if (parentwidth == 0) { parentwidth = referenceIPD; } - parentwidth -= marginProps.startIndent + marginProps.endIndent; + parentwidth -= fobj.getCommonMarginBlock().startIndent.getValue() + fobj.getCommonMarginBlock().endIndent.getValue(); curBlockArea.setIPD(parentwidth); setCurrentArea(curBlockArea); // ??? for generic operations } diff --git a/src/java/org/apache/fop/layoutmgr/CharacterLayoutManager.java b/src/java/org/apache/fop/layoutmgr/CharacterLayoutManager.java index 57d110567..a1432b4c5 100644 --- a/src/java/org/apache/fop/layoutmgr/CharacterLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/CharacterLayoutManager.java @@ -52,7 +52,7 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager { SpaceVal ls = SpaceVal.makeLetterSpacing(fobj.getLetterSpacing()); letterSpaceIPD = ls.getSpace(); - hyphIPD = fs.getCharWidth(fobj.getCommonHyphenation().hyphenationChar); + hyphIPD = fs.getCharWidth(fobj.getCommonHyphenation().hyphenationCharacter); } private InlineArea getCharacterInlineArea(Character node) { diff --git a/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java index b0d8c6629..92c278ad7 100644 --- a/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java @@ -32,7 +32,7 @@ import org.apache.fop.fonts.Font; */ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager { - PageNumberCitation pncNode; + PageNumberCitation fobj; Font font = null; // whether the page referred to by the citation has been resolved yet @@ -46,8 +46,8 @@ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager { */ public PageNumberCitationLayoutManager(PageNumberCitation node) { super(node); - font = node.getPropertyManager().getFontState(node.getFOEventHandler().getFontInfo()); - pncNode = node; + fobj = node; + font = fobj.getCommonFont().getFontState(fobj.getFOEventHandler().getFontInfo()); } public InlineArea get(LayoutContext context) { @@ -58,8 +58,7 @@ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager { public void addAreas(PositionIterator posIter, LayoutContext context) { super.addAreas(posIter, context); if (!resolved) { - parentLM.addUnresolvedArea(pncNode.getPropString(PR_REF_ID), - (Resolveable) curArea); + parentLM.addUnresolvedArea(fobj.getRefId(), (Resolveable) curArea); } } @@ -72,7 +71,7 @@ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager { * return a resolveable area */ private InlineArea getPageNumberCitationInlineArea(LayoutManager parentLM) { - PageViewport page = parentLM.resolveRefID(pncNode.getPropString(PR_REF_ID)); + PageViewport page = parentLM.resolveRefID(fobj.getRefId()); InlineArea inline = null; if (page != null) { String str = page.getPageNumber(); @@ -91,7 +90,7 @@ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager { resolved = true; } else { resolved = false; - inline = new UnresolvedPageNumber(pncNode.getPropString(PR_REF_ID)); + inline = new UnresolvedPageNumber(fobj.getRefId()); String str = "MMM"; // reserve three spaces for page number int width = getStringWidth(str); inline.setIPD(width); diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java index 4d9497beb..b068836f3 100644 --- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java @@ -781,7 +781,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements ((FObj) fobj.getParent()).setLayoutDimension(PercentBase.BLOCK_BPD, pageHeight); // Get absolute margin properties (top, left, bottom, right) - CommonMarginBlock mProps = spm.getPropertyManager().getMarginProps(); + CommonMarginBlock mProps = spm.getCommonMarginBlock(); /* Create the page reference area rectangle (0,0 is at top left * of the "page media" and y increases @@ -789,17 +789,17 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements * The media rectangle itself is (0,0,pageWidth,pageHeight). */ Rectangle pageRefRect = - new Rectangle(mProps.marginLeft, mProps.marginTop, - pageWidth - mProps.marginLeft - mProps.marginRight, - pageHeight - mProps.marginTop - mProps.marginBottom); + new Rectangle(mProps.marginLeft.getValue(), mProps.marginTop.getValue(), + pageWidth - mProps.marginLeft.getValue() - mProps.marginRight.getValue(), + pageHeight - mProps.marginTop.getValue() - mProps.marginBottom.getValue()); Page page = new Page(); // page reference area // Set up the CTM on the page reference area based on writing-mode // and reference-orientation FODimension reldims = new FODimension(0, 0); - CTM pageCTM = CTM.getCTMandRelDims(spm.getPropertyManager().getAbsRefOrient(), - spm.getPropertyManager().getWritingMode(), pageRefRect, reldims); + CTM pageCTM = CTM.getCTMandRelDims(spm.getReferenceOrientation(), + spm.getWritingMode(), pageRefRect, reldims); // Create a RegionViewport/ reference area pair for each page region for (Iterator regenum = spm.getRegions().values().iterator(); @@ -894,8 +894,8 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements private void setRegionPosition(Region r, RegionReference rr, Rectangle2D absRegVPRect) { FODimension reldims = new FODimension(0, 0); - rr.setCTM(CTM.getCTMandRelDims(r.getPropertyManager().getAbsRefOrient(), - r.getPropertyManager().getWritingMode(), absRegVPRect, reldims)); + rr.setCTM(CTM.getCTMandRelDims(r.getReferenceOrientation(), + r.getWritingMode(), absRegVPRect, reldims)); rr.setIPD(reldims.ipd); rr.setBPD(reldims.bpd); } diff --git a/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java index bcd153f2a..42ccb865a 100644 --- a/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/TextLayoutManager.java @@ -137,7 +137,7 @@ public class TextLayoutManager extends AbstractLayoutManager { // With CID fonts, space isn't neccesary currentFontState.width(32) spaceCharIPD = fs.getCharWidth(' '); // Use hyphenationChar property - hyphIPD = fs.getCharWidth(foText.getCommonHyphenation().hyphenationChar); + hyphIPD = fs.getCharWidth(foText.getCommonHyphenation().hyphenationCharacter); // Make half-space: <space> on either side of a word-space) SpaceVal ls = SpaceVal.makeLetterSpacing(foText.getLetterSpacing()); SpaceVal ws = SpaceVal.makeWordSpacing(foText.getWordSpacing(), ls, fs); @@ -532,7 +532,7 @@ public class TextLayoutManager extends AbstractLayoutManager { // add hyphenation character if the last word is hyphenated if (context.isLastArea() && ai.bHyphenated) { - str += foText.getCommonHyphenation().hyphenationChar; + str += foText.getCommonHyphenation().hyphenationCharacter; realWidth.add(new MinOptMax(hyphIPD)); } diff --git a/src/java/org/apache/fop/layoutmgr/TraitSetter.java b/src/java/org/apache/fop/layoutmgr/TraitSetter.java index f4e3b6004..b68861d77 100644 --- a/src/java/org/apache/fop/layoutmgr/TraitSetter.java +++ b/src/java/org/apache/fop/layoutmgr/TraitSetter.java @@ -19,7 +19,6 @@ package org.apache.fop.layoutmgr; import org.apache.fop.traits.BorderProps; -import org.apache.fop.traits.LayoutProps; import org.apache.fop.area.Area; import org.apache.fop.area.Trait; import org.apache.fop.fo.properties.CommonMarginBlock; @@ -184,14 +183,14 @@ public class TraitSetter { public static void addMargins(Area curBlock, CommonBorderPaddingBackground bpProps, CommonMarginBlock marginProps) { - int spaceStart = marginProps.startIndent + int spaceStart = marginProps.startIndent.getValue() - bpProps.getBorderStartWidth(false) - bpProps.getPaddingStart(false); if (spaceStart != 0) { curBlock.addTrait(Trait.SPACE_START, new Integer(spaceStart)); } - int spaceEnd = marginProps.endIndent + int spaceEnd = marginProps.endIndent.getValue() - bpProps.getBorderEndWidth(false) - bpProps.getPaddingEnd(false); if (spaceEnd != 0) { @@ -199,8 +198,8 @@ public class TraitSetter { } } - public static void addBreaks(Area curArea, LayoutProps layoutProps) { - curArea.addTrait(Trait.BREAK_AFTER, new Integer(layoutProps.breakAfter)); - curArea.addTrait(Trait.BREAK_BEFORE, new Integer(layoutProps.breakBefore)); + public static void addBreaks(Area curArea, int breakBefore, int breakAfter) { + curArea.addTrait(Trait.BREAK_AFTER, new Integer(breakAfter)); + curArea.addTrait(Trait.BREAK_BEFORE, new Integer(breakBefore)); } } |