From: Vincent Hennebert Date: Fri, 1 Aug 2014 15:30:26 +0000 (+0000) Subject: FOP-2393: only the gradient's transform should be used. Other transforms will have... X-Git-Tag: fop-2_0~87 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a012da374a99ca4216f48ff5a5bf2c5c6c111c41;p=xmlgraphics-fop.git FOP-2393: only the gradient's transform should be used. Other transforms will have already been applied to the user space. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1615142 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java b/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java index 28fa4ec9c..a1e7cf9dc 100644 --- a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java @@ -76,7 +76,7 @@ public class PSSVGGraphics2D extends PSGraphics2D { super.applyPaint(paint, fill); if (paint instanceof LinearGradientPaint) { Pattern pattern = GradientMaker.makeLinearGradient((LinearGradientPaint) paint, - getBaseTransform(), getTransform()); + new AffineTransform(), new AffineTransform()); try { gen.write(outputPattern(pattern)); } catch (IOException ioe) { @@ -84,7 +84,7 @@ public class PSSVGGraphics2D extends PSGraphics2D { } } else if (paint instanceof RadialGradientPaint) { Pattern pattern = GradientMaker.makeRadialGradient((RadialGradientPaint) paint, - getBaseTransform(), getTransform()); + new AffineTransform(), new AffineTransform()); try { gen.write(outputPattern(pattern)); } catch (IOException ioe) { @@ -142,11 +142,6 @@ public class PSSVGGraphics2D extends PSGraphics2D { shading.output(out, doubleFormatter, functionRenderer); } - protected AffineTransform getBaseTransform() { - AffineTransform at = new AffineTransform(this.getTransform()); - return at; - } - /** * Creates a new Graphics object that is * a copy of this Graphics object. diff --git a/test/java/org/apache/fop/render/ps/svg/GradientTestCase.java b/test/java/org/apache/fop/render/ps/svg/GradientTestCase.java index 397dbed0f..908c60350 100644 --- a/test/java/org/apache/fop/render/ps/svg/GradientTestCase.java +++ b/test/java/org/apache/fop/render/ps/svg/GradientTestCase.java @@ -66,6 +66,7 @@ public class GradientTestCase { ByteArrayOutputStream out = new ByteArrayOutputStream(); PSSVGGraphics2D svgGraphics2D = new PSSVGGraphics2D(false, new PSGenerator(out)); svgGraphics2D.setGraphicContext(new GraphicContext()); + svgGraphics2D.translate(100, 100); svgGraphics2D.applyPaint(gradient, true); byte[] actual = out.toByteArray(); byte[] expected = IOUtils.toByteArray(getClass().getResourceAsStream(expectedResourceName));