pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1648336 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading: AxialShadingContext.java RadialShadingContext.java
Date Mon, 29 Dec 2014 13:37:51 GMT
Author: tilman
Date: Mon Dec 29 13:37:51 2014
New Revision: 1648336

URL: http://svn.apache.org/r1648336
Log:
PDFBOX-2217: remove factor min value, as it doesn't make much visual difference

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/AxialShadingContext.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/AxialShadingContext.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/AxialShadingContext.java?rev=1648336&r1=1648335&r2=1648336&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/AxialShadingContext.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/AxialShadingContext.java
Mon Dec 29 13:37:51 2014
@@ -56,7 +56,7 @@ public class AxialShadingContext extends
     private final float d1d0;
     private double denom;
 
-    private int factor;
+    private final int factor;
     private final int[] colorTable;
 
     private AffineTransform rat;
@@ -111,8 +111,8 @@ public class AxialShadingContext extends
         y1y0 = coords[3] - coords[1];
         d1d0 = domain[1] - domain[0];
         denom = Math.pow(x1x0, 2) + Math.pow(y1y0, 2);
-        double axialLength = Math.sqrt(denom);
-        
+        double longestDistance = Math.sqrt(denom);
+
         try
         {
             // get inverse transform to be independent of current user / device space 
@@ -126,8 +126,8 @@ public class AxialShadingContext extends
         }
 
         // transform the distance to actual pixel space
-        double maxX = Math.max(10, Math.abs(ctm.getXScale() * xform.getScaleX() * axialLength));
-        double maxY = Math.max(10, Math.abs(ctm.getYScale() * xform.getScaleY() * axialLength));
+        double maxX = Math.abs(ctm.getXScale() * xform.getScaleX() * longestDistance);
+        double maxY = Math.abs(ctm.getYScale() * xform.getScaleY() * longestDistance);
         factor = (int) Math.max(maxX, maxY);
         colorTable = calcColorTable();
     }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java?rev=1648336&r1=1648335&r2=1648336&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingContext.java
Mon Dec 29 13:37:51 2014
@@ -59,7 +59,7 @@ public class RadialShadingContext extend
     private final float d1d0;
     private final double denom;
 
-    private int factor;
+    private final int factor;
     private final int[] colorTable;
 
     private AffineTransform rat;
@@ -137,10 +137,6 @@ public class RadialShadingContext extend
         double maxX = Math.abs(ctm.getXScale() * xform.getScaleX() * longestDistance);
         double maxY = Math.abs(ctm.getYScale() * xform.getScaleY() * longestDistance);
         factor = (int) Math.max(maxX, maxY);
-        if (factor > 0 && factor < 10)
-        {
-            factor = 10;
-        }
         colorTable = calcColorTable();
     }
 
@@ -170,8 +166,8 @@ public class RadialShadingContext extend
     }
 
     /**
-     * Calculate the color on the line connects two circles' centers and store
-     * the result in an array.
+     * Calculate the color on the line that connects two circles' centers and
+     * store the result in an array.
      *
      * @return an array, index denotes the relative position, the corresponding
      * value the color



Mime
View raw message