xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sstei...@apache.org
Subject svn commit: r1797012 - in /xmlgraphics/fop/trunk/fop-core/src: main/java/org/apache/fop/render/gradient/GradientMaker.java test/java/org/apache/fop/render/gradient/GradientTestCase.java
Date Wed, 31 May 2017 11:03:05 GMT
Author: ssteiner
Date: Wed May 31 11:03:05 2017
New Revision: 1797012

URL: http://svn.apache.org/viewvc?rev=1797012&view=rev
Log:
FOP-2710: SVG Gradient missing

Modified:
    xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/render/gradient/GradientMaker.java
    xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/render/gradient/GradientTestCase.java

Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/render/gradient/GradientMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/render/gradient/GradientMaker.java?rev=1797012&r1=1797011&r2=1797012&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/render/gradient/GradientMaker.java
(original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/render/gradient/GradientMaker.java
Wed May 31 11:03:05 2017
@@ -114,12 +114,16 @@ public final class GradientMaker {
 
     private static List<Float> makeBounds(MultipleGradientPaint gradient) {
         float[] fractions = gradient.getFractions();
-        List<Float> bounds = new java.util.ArrayList<Float>(fractions.length);
+        List<Float> bounds = new ArrayList<Float>(fractions.length);
         for (float offset : fractions) {
-            if (0f < offset && offset < 1f) {
+            if (0f < offset) {
                 bounds.add(offset);
             }
         }
+        float last = bounds.get(bounds.size() - 1);
+        if (last == 1f) {
+            bounds.remove(bounds.size() - 1);
+        }
         return bounds;
     }
 

Modified: xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/render/gradient/GradientTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/render/gradient/GradientTestCase.java?rev=1797012&r1=1797011&r2=1797012&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/render/gradient/GradientTestCase.java
(original)
+++ xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/render/gradient/GradientTestCase.java
Wed May 31 11:03:05 2017
@@ -288,4 +288,18 @@ public class GradientTestCase {
         return colors;
     }
 
+    @Test
+    public void testMakeBounds() {
+        RadialGradientPaint gradient = new RadialGradientPaint(0, 0, 100, 100, 100,
+                fractions(0f, 1f, 0.9f), colors(Color.WHITE, Color.RED, Color.GREEN));
+        Pattern pattern = GradientMaker.makeRadialGradient(gradient, new AffineTransform(),
new AffineTransform());
+        ShadingChecker shadingChecker = new PatternChecker(pattern).shading()
+                .coords(70.7036, 70.7036, 0.0, 0.0, 0.0, 100.0);
+        shadingChecker.function()
+                .functionType(3)
+                .bounds(1f, 0.9f)
+                .encode(0.0, 1.0, 0.0, 1.0, 0.0, 1.0)
+                .functions(3);
+    }
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message