Author: jeremias
Date: Thu Jun 30 10:00:28 2011
New Revision: 1141464
URL: http://svn.apache.org/viewvc?rev=1141464&view=rev
Log:
Fixed a typo and two FindBugs issues.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java?rev=1141464&r1=1141463&r2=1141464&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java
Thu Jun 30 10:00:28 2011
@@ -86,7 +86,7 @@ public abstract class AbstractFOPImageEl
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 AbstractFOPImageEl
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 AbstractFOPImageEl
/**
* A node that holds a Graphics2D image.
*/
- public class Graphics2DNode extends AbstractGraphicsNode {
+ public static class Graphics2DNode extends AbstractGraphicsNode {
private final ImageGraphics2D image;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]