summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/kitfox/svg/SVGRoot.java
diff options
context:
space:
mode:
authorkitfox2014-06-25 18:49:44 +0200
committerkitfox2014-06-25 18:49:44 +0200
commit21f4905a7440f21965fb447ae30f1ed4e856b289 (patch)
tree710133c1f73a4726b090d1ef87742f8c13d320db /src/main/java/com/kitfox/svg/SVGRoot.java
parentClipPath now propegates updateTime() to children. (diff)
downloadsvg-salamander-core-21f4905a7440f21965fb447ae30f1ed4e856b289.tar.gz
svg-salamander-core-21f4905a7440f21965fb447ae30f1ed4e856b289.tar.xz
svg-salamander-core-21f4905a7440f21965fb447ae30f1ed4e856b289.zip
Fixing JIRA SVGSALAMANDER-37 and SVGSALAMANDER-38. Viewbox now maps to full viewport. Calculating the group bounding box now ignores rectangles of zero size. (This is itself an error - shapes with no content should instead indicate a bounding box of null, but making that change would likely break a lot of things).
git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@177 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
Diffstat (limited to 'src/main/java/com/kitfox/svg/SVGRoot.java')
-rw-r--r--src/main/java/com/kitfox/svg/SVGRoot.java35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/main/java/com/kitfox/svg/SVGRoot.java b/src/main/java/com/kitfox/svg/SVGRoot.java
index fdd5065..a4ccfb0 100644
--- a/src/main/java/com/kitfox/svg/SVGRoot.java
+++ b/src/main/java/com/kitfox/svg/SVGRoot.java
@@ -241,22 +241,43 @@ public class SVGRoot extends Group
clipRect.setRect(xx, yy, ww, hh);
+// if (viewBox == null)
+// {
+// viewXform.setToIdentity();
+// }
+// else
+// {
+// //If viewport window is set, we are drawing to entire viewport
+// clipRect.setRect(deviceViewport);
+//
+// viewXform.setToIdentity();
+// viewXform.setToTranslation(deviceViewport.x, deviceViewport.y);
+// viewXform.scale(deviceViewport.width, deviceViewport.height);
+// viewXform.scale(1 / viewBox.width, 1 / viewBox.height);
+// viewXform.translate(-viewBox.x, -viewBox.y);
+// }
+ }
+
+ public void render(Graphics2D g) throws SVGException
+ {
+ prepareViewport();
+
if (viewBox == null)
{
viewXform.setToIdentity();
}
else
{
- viewXform.setToTranslation(clipRect.x, clipRect.y);
- viewXform.scale(clipRect.width, clipRect.height);
+ Rectangle deviceViewport = g.getClipBounds();
+ //If viewport window is set, we are drawing to entire viewport
+ clipRect.setRect(deviceViewport);
+
+ viewXform.setToIdentity();
+ viewXform.setToTranslation(deviceViewport.x, deviceViewport.y);
+ viewXform.scale(deviceViewport.width, deviceViewport.height);
viewXform.scale(1 / viewBox.width, 1 / viewBox.height);
viewXform.translate(-viewBox.x, -viewBox.y);
}
- }
-
- public void render(Graphics2D g) throws SVGException
- {
- prepareViewport();
AffineTransform cachedXform = g.getTransform();
g.transform(viewXform);