From 67a0a3be84ffbf18fa7ea3c3677658aad77cf0df Mon Sep 17 00:00:00 2001 From: kitfox Date: Mon, 2 Apr 2012 23:10:58 +0000 Subject: RenderableElement clipping should now work even if no clip has been set on Graphics2D. git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@110 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b --- src/main/java/com/kitfox/svg/RenderableElement.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main/java/com/kitfox/svg/RenderableElement.java b/src/main/java/com/kitfox/svg/RenderableElement.java index f0fee73..60fac37 100644 --- a/src/main/java/com/kitfox/svg/RenderableElement.java +++ b/src/main/java/com/kitfox/svg/RenderableElement.java @@ -141,9 +141,16 @@ abstract public class RenderableElement extends TransformableElement } cachedClip = g.getClip(); - Area newClip = new Area(cachedClip); - newClip.intersect(new Area(clipPath)); - g.setClip(newClip); + if (cachedClip == null) + { + g.setClip(clipPath); + } + else + { + Area newClip = new Area(cachedClip); + newClip.intersect(new Area(clipPath)); + g.setClip(newClip); + } } } -- cgit v1.2.3-55-g7522