You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by de...@apache.org on 2005/05/15 20:23:32 UTC
cvs commit: xml-batik/sources/org/apache/batik/transcoder SVGAbstractTranscoder.java
deweese 2005/05/15 11:23:32
Modified: sources/org/apache/batik/transcoder
SVGAbstractTranscoder.java
Log:
1) Fixed bug 34847 - incorrect rendering when given width height match
viewBox width/height.
PR: 34847
Revision Changes Path
1.23 +12 -10 xml-batik/sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
Index: SVGAbstractTranscoder.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- SVGAbstractTranscoder.java 18 Nov 2004 01:47:02 -0000 1.22
+++ SVGAbstractTranscoder.java 15 May 2005 18:23:32 -0000 1.23
@@ -242,16 +242,18 @@
} else {
String ref = new ParsedURL(uri).getRef();
- try {
- Px = ViewBox.getViewTransform(ref, root, width, height);
- } catch (BridgeException ex) {
- throw new TranscoderException(ex);
- }
+ String viewBox = root.getAttributeNS
+ (null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE);
- if (Px.isIdentity() &&
- (width != docWidth || height != docHeight)) {
- // The document has no viewBox, we need to resize it by hand.
- // we want to keep the document size ratio
+ if ((ref != null) && (ref.length() != 0)) {
+ Px = ViewBox.getViewTransform(ref, root, width, height);
+ } else if ((viewBox != null) && (viewBox.length() != 0)) {
+ String aspectRatio = root.getAttributeNS
+ (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE);
+ Px = ViewBox.getPreserveAspectRatioTransform
+ (root, viewBox, aspectRatio, width, height);
+ } else {
+ // no viewBox has been specified, create a scale transform
float xscale, yscale;
xscale = width/docWidth;
yscale = height/docHeight;