pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1785415 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
Date Fri, 03 Mar 2017 22:20:34 GMT
Author: tilman
Date: Fri Mar  3 22:20:34 2017
New Revision: 1785415

URL: http://svn.apache.org/viewvc?rev=1785415&view=rev
Log:
PDFBOX-2852: use switch

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java?rev=1785415&r1=1785414&r2=1785415&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
Fri Mar  3 22:20:34 2017
@@ -433,27 +433,24 @@ class AppearanceGeneratorHelper
         {
             return new AffineTransform();
         }
-        else
+        float tx = 0, ty = 0;
+        switch (rotation)
         {
-            float tx=0, ty=0;
-
-            if (rotation == 90)
-            {
+            case 90:
                 tx = bbox.getUpperRightY();
-            }
-            else if (rotation == 180)
-            {
+                break;
+            case 180:
                 tx = bbox.getUpperRightY();
                 ty = bbox.getUpperRightX();
-            }
-            else if (rotation == 270)
-            {
+                break;
+            case 270:
                 ty = bbox.getUpperRightX();
-            }
-
-            Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), tx, ty);
-            return matrix.createAffineTransform();
+                break;
+            default:
+                break;
         }
+        Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), tx, ty);
+        return matrix.createAffineTransform();
     }
 
     private boolean isMultiLine()



Mime
View raw message