aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2011-06-30 10:00:28 +0000
committerJeremias Maerki <jeremias@apache.org>2011-06-30 10:00:28 +0000
commit679802c4764120eba54ad1e38e230bfe237363fa (patch)
treea1a8a64a9df821077b07e5a127820dd78d990d02 /src
parent6c398f41ee39093674c2d62cf62d689c2ac41911 (diff)
downloadxmlgraphics-fop-679802c4764120eba54ad1e38e230bfe237363fa.tar.gz
xmlgraphics-fop-679802c4764120eba54ad1e38e230bfe237363fa.zip
Fixed a typo and two FindBugs issues.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1141464 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java b/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java
index 5d10a7d1b..b7e82b858 100644
--- a/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java
+++ b/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java
@@ -86,7 +86,7 @@ public abstract class AbstractFOPImageElementBridge extends SVGImageElementBridg
ImageXMLDOM xmlImage = (ImageXMLDOM)image;
if (xmlImage.getDocument() instanceof SVGDocument) {
//Clone DOM because the Batik's CSS Parser attaches to the DOM and is therefore
- //no thread-safe.
+ //not thread-safe.
SVGDocument clonedDoc = (SVGDocument)BatikUtil.cloneSVGDocument(
xmlImage.getDocument());
return createSVGImageNode(ctx, imageElement, clonedDoc);
@@ -108,22 +108,25 @@ public abstract class AbstractFOPImageElementBridge extends SVGImageElementBridg
new ImageException("Cannot convert an image to a usable format: " + purl));
}
- Rectangle2D imgBounds = getImageBounds(ctx, imageElement);
- Rectangle2D bounds = specializedNode.getPrimitiveBounds();
- float [] vb = new float[4];
- vb[0] = 0; // x
- vb[1] = 0; // y
- vb[2] = (float) bounds.getWidth(); // width
- vb[3] = (float) bounds.getHeight(); // height
-
- // handles the 'preserveAspectRatio', 'overflow' and 'clip'
- // and sets the appropriate AffineTransform to the image node
- initializeViewport(ctx, imageElement, specializedNode, vb, imgBounds);
- return specializedNode;
+ if (specializedNode != null) {
+ Rectangle2D imgBounds = getImageBounds(ctx, imageElement);
+ Rectangle2D bounds = specializedNode.getPrimitiveBounds();
+ float [] vb = new float[4];
+ vb[0] = 0; // x
+ vb[1] = 0; // y
+ vb[2] = (float) bounds.getWidth(); // width
+ vb[3] = (float) bounds.getHeight(); // height
+
+ // handles the 'preserveAspectRatio', 'overflow' and 'clip'
+ // and sets the appropriate AffineTransform to the image node
+ initializeViewport(ctx, imageElement, specializedNode, vb, imgBounds);
+ return specializedNode;
+ }
} catch (Exception e) {
ctx.getUserAgent().displayError(e);
}
+ //Fallback
return superCreateGraphicsNode(ctx, imageElement, purl);
}
@@ -249,7 +252,7 @@ public abstract class AbstractFOPImageElementBridge extends SVGImageElementBridg
/**
* A node that holds a Graphics2D image.
*/
- public class Graphics2DNode extends AbstractGraphicsNode {
+ public static class Graphics2DNode extends AbstractGraphicsNode {
private final ImageGraphics2D image;