pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1803865 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox: pdmodel/graphics/PDLineDashPattern.java rendering/PageDrawer.java
Date Wed, 02 Aug 2017 16:55:30 GMT
Author: tilman
Date: Wed Aug  2 16:55:30 2017
New Revision: 1803865

URL: http://svn.apache.org/viewvc?rev=1803865&view=rev
Log:
PDFBOX-2852: remove unneeded nullcheck; improve javadoc

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDLineDashPattern.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDLineDashPattern.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDLineDashPattern.java?rev=1803865&r1=1803864&r2=1803865&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDLineDashPattern.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/PDLineDashPattern.java
Wed Aug  2 16:55:30 2017
@@ -77,7 +77,7 @@ public final class PDLineDashPattern imp
 
     /**
      * Returns the dash array.
-     * @return the dash array
+     * @return the dash array, never null.
      */
     public float[] getDashArray()
     {

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1803865&r1=1803864&r2=1803865&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Wed Aug
 2 16:55:30 2017
@@ -585,34 +585,31 @@ public class PageDrawer extends PDFGraph
         PDLineDashPattern dashPattern = state.getLineDashPattern();
         int phaseStart = dashPattern.getPhase();
         float[] dashArray = dashPattern.getDashArray();
-        if (dashArray != null)
+        // apply the CTM
+        for (int i = 0; i < dashArray.length; ++i)
         {
-            // apply the CTM
-            for (int i = 0; i < dashArray.length; ++i)
-            {
-                // minimum line dash width avoids JVM crash,
-                // see PDFBOX-2373, PDFBOX-2929, PDFBOX-3204, PDFBOX-3813
-                // also avoid 0 in array like "[ 0 1000 ] 0 d", see PDFBOX-3724
-                float w = transformWidth(dashArray[i]);
-                dashArray[i] = Math.max(w, 0.062f);
-            }
-            phaseStart = (int)transformWidth(phaseStart);
+            // minimum line dash width avoids JVM crash,
+            // see PDFBOX-2373, PDFBOX-2929, PDFBOX-3204, PDFBOX-3813
+            // also avoid 0 in array like "[ 0 1000 ] 0 d", see PDFBOX-3724
+            float w = transformWidth(dashArray[i]);
+            dashArray[i] = Math.max(w, 0.062f);
+        }
+        phaseStart = (int) transformWidth(phaseStart);
 
-            // empty dash array is illegal
-            // avoid also infinite and NaN values (PDFBOX-3360)
-            if (dashArray.length == 0 || Float.isInfinite(phaseStart) || Float.isNaN(phaseStart))
-            {
-                dashArray = null;
-            }
-            else
+        // empty dash array is illegal
+        // avoid also infinite and NaN values (PDFBOX-3360)
+        if (dashArray.length == 0 || Float.isInfinite(phaseStart) || Float.isNaN(phaseStart))
+        {
+            dashArray = null;
+        }
+        else
+        {
+            for (int i = 0; i < dashArray.length; ++i)
             {
-                for (int i = 0; i < dashArray.length; ++i)
+                if (Float.isInfinite(dashArray[i]) || Float.isNaN(dashArray[i]))
                 {
-                    if (Float.isInfinite(dashArray[i]) || Float.isNaN(dashArray[i]))
-                    {
-                        dashArray = null;
-                        break;
-                    }
+                    dashArray = null;
+                    break;
                 }
             }
         }



Mime
View raw message