Browse Source

Minor cleanup


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_RoundedCorners@1357514 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-2_0
Peter Hancock 12 years ago
parent
commit
476528a0e1

+ 1
- 5
src/java/org/apache/fop/afp/AFPResourceManager.java View File

/** Mapping of resourceInfo to AbstractCachedObject */ /** Mapping of resourceInfo to AbstractCachedObject */
private final Map<AFPResourceInfo, AbstractCachedObject> includeObjectCache private final Map<AFPResourceInfo, AbstractCachedObject> includeObjectCache
= new java.util.HashMap<AFPResourceInfo, AbstractCachedObject>(); = new java.util.HashMap<AFPResourceInfo, AbstractCachedObject>();

private AFPResourceLevelDefaults resourceLevelDefaults = new AFPResourceLevelDefaults(); private AFPResourceLevelDefaults resourceLevelDefaults = new AFPResourceLevelDefaults();


/** /**
resourceInfo.setName(resourceName); resourceInfo.setName(resourceName);
resourceInfo.setUri(uri.toASCIIString()); resourceInfo.setUri(uri.toASCIIString());


AbstractCachedObject cachedObject = (AbstractCachedObject)
includeObjectCache.get(resourceInfo);
AbstractCachedObject cachedObject = (AbstractCachedObject) includeObjectCache.get(resourceInfo);
if (cachedObject == null) { if (cachedObject == null) {


ResourceGroup resourceGroup = streamer.getResourceGroup(resourceLevel); ResourceGroup resourceGroup = streamer.getResourceGroup(resourceLevel);
@Override @Override
protected void writeEnd(OutputStream os) throws IOException { } protected void writeEnd(OutputStream os) throws IOException { }
}; };

resourceGroup.addObject(resourceObject); resourceGroup.addObject(resourceObject);
cachedObject = new CachedObject(resourceName, null); cachedObject = new CachedObject(resourceName, null);
includeObjectCache.put(resourceInfo, cachedObject); includeObjectCache.put(resourceInfo, cachedObject);

+ 0
- 1
src/java/org/apache/fop/fo/Constants.java View File

/** Property constant - FOP proprietary prototype (in XSL-FO 2.0 Requirements) */ /** Property constant - FOP proprietary prototype (in XSL-FO 2.0 Requirements) */
int PR_X_XML_BASE = 275; int PR_X_XML_BASE = 275;



/** Property constant FOP proprietary*/ /** Property constant FOP proprietary*/
int PR_X_BORDER_BEFORE_RADIUS_START = 276; int PR_X_BORDER_BEFORE_RADIUS_START = 276;



+ 0
- 1
src/java/org/apache/fop/fo/FOPropertyMapping.java View File

genericCondCornerRadius.setPercentBase(LengthBase.CONTAINING_BLOCK_HEIGHT); genericCondCornerRadius.setPercentBase(LengthBase.CONTAINING_BLOCK_HEIGHT);
genericCondCornerRadius.addShorthand(generics[PR_X_BORDER_RADIUS]); genericCondCornerRadius.addShorthand(generics[PR_X_BORDER_RADIUS]);



// GenericBreak // GenericBreak
genericBreak = new EnumProperty.Maker(0); genericBreak = new EnumProperty.Maker(0);
genericBreak.setInherited(false); genericBreak.setInherited(false);

+ 0
- 1
src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java View File

PROPERTY_ATTRIBUTES.add("disable-column-balancing"); PROPERTY_ATTRIBUTES.add("disable-column-balancing");
//These are FOP's extension properties for accessibility //These are FOP's extension properties for accessibility
PROPERTY_ATTRIBUTES.add("alt-text"); PROPERTY_ATTRIBUTES.add("alt-text");

//fox:border-*-radius-* //fox:border-*-radius-*
PROPERTY_ATTRIBUTES.add("border-before-radius-start"); PROPERTY_ATTRIBUTES.add("border-before-radius-start");
PROPERTY_ATTRIBUTES.add("border-before-radius-end"); PROPERTY_ATTRIBUTES.add("border-before-radius-end");

+ 11
- 17
src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java View File

if (this == obj) { if (this == obj) {
return true; return true;
} }
if (obj instanceof BorderInfo) {
BorderInfo bi = (BorderInfo)obj;
return (this.mColor == bi.mColor
&& this.mStyle == bi.mStyle
&& this.mWidth == bi.mWidth
&& this.radiusStart == bi.radiusStart
&& this.radiusEnd == bi.radiusEnd);
if (!(obj instanceof BorderInfo)) {
return false;
} }
BorderInfo other = (BorderInfo) obj;
return CompareUtil.equal(mColor, other.mColor)
&& mStyle == other.mStyle
&& CompareUtil.equal(mWidth, other.mWidth);
BorderInfo bi = (BorderInfo)obj;
return (this.mColor == bi.mColor
&& this.mStyle == bi.mStyle
&& this.mWidth == bi.mWidth
&& this.radiusStart == bi.radiusStart
&& this.radiusEnd == bi.radiusEnd);
} }


@Override @Override
* A border info with style "none". Used as a singleton, in the collapsing-border model, * A border info with style "none". Used as a singleton, in the collapsing-border model,
* for elements which don't specify any border on some of their sides. * for elements which don't specify any border on some of their sides.
*/ */
private static final BorderInfo DEFAULT_BORDER_INFO
= BorderInfo.getInstance(Constants.EN_NONE, new ConditionalNullLength(), null,
new ConditionalNullLength(), new ConditionalNullLength());



private static final BorderInfo DEFAULT_BORDER_INFO = BorderInfo.getInstance(
Constants.EN_NONE, new ConditionalNullLength(), null, new ConditionalNullLength(),
new ConditionalNullLength());


/** /**
* A conditional length of value 0. Returned by the * A conditional length of value 0. Returned by the

+ 1
- 1
src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java View File

drawBackground(startx, starty, width, height, drawBackground(startx, starty, width, height,
(Trait.Background) backgroundArea.getTrait(Trait.BACKGROUND), (Trait.Background) backgroundArea.getTrait(Trait.BACKGROUND),
bpsBefore, bpsAfter, bpsStart, bpsEnd, backgroundArea.getBidiLevel()); bpsBefore, bpsAfter, bpsStart, bpsEnd, backgroundArea.getBidiLevel());

// TODO what is the default bg color? Should we serialize it? // TODO what is the default bg color? Should we serialize it?
Color bg = Color.white; Color bg = Color.white;
if (backgroundTrait != null && backgroundTrait.getColor() != null) { if (backgroundTrait != null && backgroundTrait.getColor() != null) {
* @param bpsAfter the border-after traits * @param bpsAfter the border-after traits
* @param bpsStart the border-start traits * @param bpsStart the border-start traits
* @param bpsEnd the border-end traits * @param bpsEnd the border-end traits
* @param innerBackgroundColor the background color of the block
*/ */
protected void clipBackground (float startx, float starty, protected void clipBackground (float startx, float starty,
float width, float height, float width, float height,

+ 1
- 1
src/java/org/apache/fop/render/afp/AFPDocumentHandler.java View File

import java.awt.Dimension; import java.awt.Dimension;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import java.net.URI; import java.net.URI;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

+ 0
- 1
src/java/org/apache/fop/render/afp/AFPPainter.java View File

= new Area[]{new Area(), new Area(), new Area(), new Area()}; = new Area[]{new Area(), new Area(), new Area(), new Area()};


if (roundCorner[TOP_LEFT]) { if (roundCorner[TOP_LEFT]) {

AffineTransform transform = new AffineTransform(); AffineTransform transform = new AffineTransform();
int beforeRadius = (int)(esf * bpsBefore.getRadiusStart()); int beforeRadius = (int)(esf * bpsBefore.getRadiusStart());
int startRadius = (int)(esf * bpsStart.getRadiusStart()); int startRadius = (int)(esf * bpsStart.getRadiusStart());

+ 24
- 25
src/java/org/apache/fop/render/intermediate/BorderPainter.java View File

int width = borderRect.width; int width = borderRect.width;
int height = borderRect.height; int height = borderRect.height;
boolean[] b = new boolean[] { boolean[] b = new boolean[] {
(bpsTop != null), (bpsRight != null),
(bpsBottom != null), (bpsLeft != null)};
if (!b[0] && !b[1] && !b[2] && !b[3]) {
(bpsTop != null), (bpsRight != null),
(bpsBottom != null), (bpsLeft != null)};
if (!b[TOP] && !b[RIGHT] && !b[BOTTOM] && !b[LEFT]) {
return; return;
} }
int[] bw = new int[] { int[] bw = new int[] {
(b[0] ? bpsTop.width : 0),
(b[1] ? bpsRight.width : 0),
(b[2] ? bpsBottom.width : 0),
(b[3] ? bpsLeft.width : 0)};
(b[TOP] ? bpsTop.width : 0),
(b[RIGHT] ? bpsRight.width : 0),
(b[BOTTOM] ? bpsBottom.width : 0),
(b[LEFT] ? bpsLeft.width : 0)};
int[] clipw = new int[] { int[] clipw = new int[] {
BorderProps.getClippedWidth(bpsTop),
BorderProps.getClippedWidth(bpsRight),
BorderProps.getClippedWidth(bpsBottom),
BorderProps.getClippedWidth(bpsLeft)};
starty += clipw[0];
height -= clipw[0];
height -= clipw[2];
startx += clipw[3];
width -= clipw[3];
width -= clipw[1];
BorderProps.getClippedWidth(bpsTop),
BorderProps.getClippedWidth(bpsRight),
BorderProps.getClippedWidth(bpsBottom),
BorderProps.getClippedWidth(bpsLeft)};
starty += clipw[TOP];
height -= clipw[TOP];
height -= clipw[BOTTOM];
startx += clipw[LEFT];
width -= clipw[LEFT];
width -= clipw[RIGHT];


boolean[] slant = new boolean[] { boolean[] slant = new boolean[] {
(b[3] && b[0]), (b[0] && b[1]), (b[1] && b[2]), (b[2] && b[3])};
(b[LEFT] && b[TOP]),
(b[TOP] && b[RIGHT]),
(b[RIGHT] && b[BOTTOM]),
(b[BOTTOM] && b[LEFT])};
if (bpsTop != null) { if (bpsTop != null) {
int sx1 = startx; int sx1 = startx;
int sx2 = (slant[TOP_LEFT] ? sx1 + bw[LEFT] - clipw[LEFT] : sx1); int sx2 = (slant[TOP_LEFT] ? sx1 + bw[LEFT] - clipw[LEFT] : sx1);
int ex1a = ex1; int ex1a = ex1;
if (bpsTop.mode == BorderProps.COLLAPSE_OUTER) { if (bpsTop.mode == BorderProps.COLLAPSE_OUTER) {
if (bpsLeft != null && bpsLeft.mode == BorderProps.COLLAPSE_OUTER) { if (bpsLeft != null && bpsLeft.mode == BorderProps.COLLAPSE_OUTER) {
sx1a -= clipw[3];
sx1a -= clipw[LEFT];
} }
if (bpsRight != null && bpsRight.mode == BorderProps.COLLAPSE_OUTER) { if (bpsRight != null && bpsRight.mode == BorderProps.COLLAPSE_OUTER) {
ex1a += clipw[1];
ex1a += clipw[RIGHT];
} }
lineTo(sx1a, outery); lineTo(sx1a, outery);
lineTo(ex1a, outery); lineTo(ex1a, outery);
int outerx = startx + width + clipw[RIGHT]; int outerx = startx + width + clipw[RIGHT];
int clipx = outerx - clipw[RIGHT]; int clipx = outerx - clipw[RIGHT];
int innerx = outerx - bw[RIGHT]; int innerx = outerx - bw[RIGHT];

saveGraphicsState(); saveGraphicsState();
moveTo(clipx, sy1); moveTo(clipx, sy1);
int sy1a = sy1; int sy1a = sy1;
int outery = starty + height + clipw[BOTTOM]; int outery = starty + height + clipw[BOTTOM];
int clipy = outery - clipw[BOTTOM]; int clipy = outery - clipw[BOTTOM];
int innery = outery - bw[BOTTOM]; int innery = outery - bw[BOTTOM];

saveGraphicsState(); saveGraphicsState();
moveTo(ex1, clipy); moveTo(ex1, clipy);
int sx1a = sx1; int sx1a = sx1;
int outerx = startx - clipw[LEFT]; int outerx = startx - clipw[LEFT];
int clipx = outerx + clipw[LEFT]; int clipx = outerx + clipw[LEFT];
int innerx = outerx + bw[LEFT]; int innerx = outerx + bw[LEFT];
saveGraphicsState(); saveGraphicsState();


moveTo(clipx, ey1); moveTo(clipx, ey1);
(b[RIGHT] ? bpsEnd.width : 0), (b[RIGHT] ? bpsEnd.width : 0),
(b[BOTTOM] ? bpsAfter.width : 0), (b[BOTTOM] ? bpsAfter.width : 0),
(b[LEFT] ? bpsStart.width : 0)}; (b[LEFT] ? bpsStart.width : 0)};

int[] clipw = new int[] { int[] clipw = new int[] {
BorderProps.getClippedWidth(bpsBefore), BorderProps.getClippedWidth(bpsBefore),
BorderProps.getClippedWidth(bpsEnd), BorderProps.getClippedWidth(bpsEnd),
boolean[] slant = new boolean[] { boolean[] slant = new boolean[] {
(b[LEFT] && b[TOP]), (b[TOP] && b[RIGHT]), (b[LEFT] && b[TOP]), (b[TOP] && b[RIGHT]),
(b[RIGHT] && b[BOTTOM]), (b[LEFT] && b[BOTTOM])}; (b[RIGHT] && b[BOTTOM]), (b[LEFT] && b[BOTTOM])};

//Determine scale factor if any adjacent elliptic corners overlap //Determine scale factor if any adjacent elliptic corners overlap
double esf = cornerScaleFactor(width, height, bpsBefore, bpsAfter, bpsStart, bpsEnd); double esf = cornerScaleFactor(width, height, bpsBefore, bpsAfter, bpsStart, bpsEnd);



+ 1
- 0
src/java/org/apache/fop/render/intermediate/IFSerializer.java View File

import java.util.Map; import java.util.Map;


import org.w3c.dom.Document; import org.w3c.dom.Document;

import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.helpers.AttributesImpl;



+ 2
- 3
src/java/org/apache/fop/traits/BorderProps.java View File

public int width; // CSOK: VisibilityModifier public int width; // CSOK: VisibilityModifier


private int radiusStart = 0; private int radiusStart = 0;
private int radiusEnd = 0; private int radiusEnd = 0;



/** Border mode (one of SEPARATE, COLLAPSE_INNER and COLLAPSE_OUTER) */ /** Border mode (one of SEPARATE, COLLAPSE_INNER and COLLAPSE_OUTER) */
public int mode; // CSOK: VisibilityModifier public int mode; // CSOK: VisibilityModifier



Loading…
Cancel
Save