pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1646662 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading: CoonsPatch.java TensorPatch.java
Date Fri, 19 Dec 2014 10:14:21 GMT
Author: tilman
Date: Fri Dec 19 10:14:21 2014
New Revision: 1646662

URL: http://svn.apache.org/r1646662
Log:
PDFBOX-2576: avoid use of non-short-circuit logic

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/CoonsPatch.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/TensorPatch.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/CoonsPatch.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/CoonsPatch.java?rev=1646662&r1=1646661&r2=1646662&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/CoonsPatch.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/CoonsPatch.java
Fri Dec 19 10:14:21 2014
@@ -71,13 +71,14 @@ class CoonsPatch extends Patch
             4, 4
         };
         // if two opposite edges are both lines, there is a possibility to reduce the dividing
level
-        if (isEdgeALine(controlPoints[0]) & isEdgeALine(controlPoints[1]))
+        if (isEdgeALine(controlPoints[0]) && isEdgeALine(controlPoints[1]))
         {
             double lc1 = getLen(controlPoints[0][0], controlPoints[0][3]),
                     lc2 = getLen(controlPoints[1][0], controlPoints[1][3]);
             // determine the dividing level by the lengths of edges
             if (lc1 > 800 || lc2 > 800)
             {
+                // keeps init value 4
             }
             else if (lc1 > 400 || lc2 > 400)
             {
@@ -94,12 +95,13 @@ class CoonsPatch extends Patch
         }
 
         // the other two opposite edges
-        if (isEdgeALine(controlPoints[2]) & isEdgeALine(controlPoints[3]))
+        if (isEdgeALine(controlPoints[2]) && isEdgeALine(controlPoints[3]))
         {
             double ld1 = getLen(controlPoints[2][0], controlPoints[2][3]),
                     ld2 = getLen(controlPoints[3][0], controlPoints[3][3]);
             if (ld1 > 800 || ld2 > 800)
             {
+                // keeps init value 4
             }
             else if (ld1 > 400 || ld2 > 400)
             {

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/TensorPatch.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/TensorPatch.java?rev=1646662&r1=1646661&r2=1646662&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/TensorPatch.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/TensorPatch.java
Fri Dec 19 10:14:21 2014
@@ -79,15 +79,15 @@ class TensorPatch extends Patch
             ctlC2[j] = controlPoints[j][3];
         }
         // if two opposite edges are both lines, there is a possibility to reduce the dividing
level
-        if (isEdgeALine(ctlC1) & isEdgeALine(ctlC2))
+        if (isEdgeALine(ctlC1) && isEdgeALine(ctlC2))
         {
             /*
              if any of the 4 inner control points is out of the patch formed by the 4 edges,

              keep the high dividing level, 
              otherwise, determine the dividing level by the lengths of edges
              */
-            if (isOnSameSideCC(controlPoints[1][1]) | isOnSameSideCC(controlPoints[1][2])
-                    | isOnSameSideCC(controlPoints[2][1]) | isOnSameSideCC(controlPoints[2][2]))
+            if (isOnSameSideCC(controlPoints[1][1]) || isOnSameSideCC(controlPoints[1][2])
+                    || isOnSameSideCC(controlPoints[2][1]) || isOnSameSideCC(controlPoints[2][2]))
             {
                 // keep the high dividing level
             }
@@ -97,6 +97,7 @@ class TensorPatch extends Patch
                 double lc1 = getLen(ctlC1[0], ctlC1[3]), lc2 = getLen(ctlC2[0], ctlC2[3]);
                 if (lc1 > 800 || lc2 > 800)
                 {
+                    // keeps init value 4
                 }
                 else if (lc1 > 400 || lc2 > 400)
                 {
@@ -114,10 +115,10 @@ class TensorPatch extends Patch
         }
 
         // the other two opposite edges
-        if (isEdgeALine(controlPoints[0]) & isEdgeALine(controlPoints[3]))
+        if (isEdgeALine(controlPoints[0]) && isEdgeALine(controlPoints[3]))
         {
-            if (isOnSameSideDD(controlPoints[1][1]) | isOnSameSideDD(controlPoints[1][2])
-                    | isOnSameSideDD(controlPoints[2][1]) | isOnSameSideDD(controlPoints[2][2]))
+            if (isOnSameSideDD(controlPoints[1][1]) || isOnSameSideDD(controlPoints[1][2])
+                    || isOnSameSideDD(controlPoints[2][1]) || isOnSameSideDD(controlPoints[2][2]))
             {
                 // keep the high dividing level
             }
@@ -127,6 +128,7 @@ class TensorPatch extends Patch
                 double ld2 = getLen(controlPoints[3][0], controlPoints[3][3]);
                 if (ld1 > 800 || ld2 > 800)
                 {
+                    // keeps init value 4
                 }
                 else if (ld1 > 400 || ld2 > 400)
                 {



Mime
View raw message