]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOP-2393: only the gradient's transform should be used. Other transforms will have...
authorVincent Hennebert <vhennebert@apache.org>
Fri, 1 Aug 2014 15:30:26 +0000 (15:30 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Fri, 1 Aug 2014 15:30:26 +0000 (15:30 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1615142 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
test/java/org/apache/fop/render/ps/svg/GradientTestCase.java

index 28fa4ec9c62dff1cce109394d293a6a9b3de48eb..a1e7cf9dc701d67d10b3f3f3679d53c3d656a06b 100644 (file)
@@ -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 <code>Graphics</code> object that is
      * a copy of this <code>Graphics</code> object.
index 397dbed0f98f29dbef212ee6da899e95f6165538..908c603501ef8f144139742c9bd4377b2abc51f0 100644 (file)
@@ -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));