From 81cb3459c963b8cf2ec18e7c361ba0154321928c Mon Sep 17 00:00:00 2001 From: kitfox Date: Wed, 23 Apr 2008 07:14:46 +0000 Subject: Fixed problem with rendering patterns based on images set with 0 width or height. Also fixed problem reading id of attributes. git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@56 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b --- src/main/java/com/kitfox/svg/PatternSVG.java | 7 ++++++- src/main/java/com/kitfox/svg/SVGElement.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/kitfox/svg/PatternSVG.java b/src/main/java/com/kitfox/svg/PatternSVG.java index c1a32e9..e2bc93b 100644 --- a/src/main/java/com/kitfox/svg/PatternSVG.java +++ b/src/main/java/com/kitfox/svg/PatternSVG.java @@ -239,7 +239,12 @@ public class PatternSVG extends FillElement { tileHeight *= stretchY; } - + if (tileWidth == 0 || tileHeight == 0) + { + //Use defaults if tile has degenerate size + return; + } + BufferedImage buf = new BufferedImage(tileWidth, tileHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D g = buf.createGraphics(); g.setClip(0, 0, tileWidth, tileHeight); diff --git a/src/main/java/com/kitfox/svg/SVGElement.java b/src/main/java/com/kitfox/svg/SVGElement.java index 2370906..4a330f4 100644 --- a/src/main/java/com/kitfox/svg/SVGElement.java +++ b/src/main/java/com/kitfox/svg/SVGElement.java @@ -486,7 +486,7 @@ abstract public class SVGElement implements Serializable } //Alter layout for relevant attributes - if ("id".equals(styAttr.getStringValue())) + if ("id".equals(styAttr.getName())) { diagram.removeElement(this.id); this.id = name; -- cgit v1.2.3-55-g7522