You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ss...@apache.org on 2018/05/15 12:56:55 UTC

svn commit: r1831630 [2/2] - in /xmlgraphics/batik/trunk: batik-anim/src/main/java/org/apache/batik/anim/dom/ batik-anim/src/main/java/org/apache/batik/anim/timing/ batik-awt-util/src/main/java/org/apache/batik/ext/awt/g2d/ batik-awt-util/src/main/java...

Modified: xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFHeaderProperties.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFHeaderProperties.java?rev=1831630&r1=1831629&r2=1831630&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFHeaderProperties.java (original)
+++ xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFHeaderProperties.java Tue May 15 12:56:55 2018
@@ -169,7 +169,7 @@ public class WMFHeaderProperties extends
             case WMFConstants.META_SETWINDOWEXT: {
                 vpH = readShort( is );
                 vpW = readShort( is );
-                if (! isotropic) scaleXY = (float)vpW / (float)vpH;
+                if (! isotropic) scaleXY = (float)vpW / vpH;
                 vpW = (int)(vpW * scaleXY);                
             }
             break;
@@ -304,14 +304,14 @@ public class WMFHeaderProperties extends
                     int lfHeight = readShort( is );
                     float size = (int)(scaleY * lfHeight);
                     int lfWidth = readShort( is );
-                    int escape = (int)readShort( is );
-                    int orient = (int)readShort( is );
-                    int weight = (int)readShort( is );
-
-                    int italic = (int)is.readByte();
-                    int underline = (int)is.readByte();
-                    int strikeOut = (int)is.readByte();
-                    int charset = (int)(is.readByte() & 0x00ff);
+                    int escape = readShort( is );
+                    int orient = readShort( is );
+                    int weight = readShort( is );
+
+                    int italic = is.readByte();
+                    int underline = is.readByte();
+                    int strikeOut = is.readByte();
+                    int charset = is.readByte() & 0x00ff;
                     int lfOutPrecision = is.readByte();
                     int lfClipPrecision = is.readByte();
                     int lfQuality = is.readByte();
@@ -527,12 +527,12 @@ public class WMFHeaderProperties extends
                     readShort( is ); // widthSrc
                     readShort( is ); // sy
                     readShort( is ); // sx
-                    float heightDst = (float)readShort( is );
-                    float widthDst = (float)readShort( is ) * scaleXY;       
-                    float dy = (float)readShort( is ) * getVpWFactor() * (float)inch / PIXEL_PER_INCH;
-                    float dx = (float)readShort( is ) * getVpWFactor() * (float)inch / PIXEL_PER_INCH * scaleXY; 
-                    widthDst = widthDst * getVpWFactor() * (float)inch / PIXEL_PER_INCH;
-                    heightDst = heightDst * getVpHFactor() * (float)inch / PIXEL_PER_INCH;
+                    float heightDst = readShort( is );
+                    float widthDst = readShort( is ) * scaleXY;
+                    float dy = readShort( is ) * getVpWFactor() * inch / PIXEL_PER_INCH;
+                    float dx = readShort( is ) * getVpWFactor() * inch / PIXEL_PER_INCH * scaleXY;
+                    widthDst = widthDst * getVpWFactor() * inch / PIXEL_PER_INCH;
+                    heightDst = heightDst * getVpHFactor() * inch / PIXEL_PER_INCH;
                     resizeImageBounds((int)dx, (int)dy);
                     resizeImageBounds((int)(dx + widthDst), (int)(dy + heightDst));
 
@@ -547,12 +547,12 @@ public class WMFHeaderProperties extends
                 readShort( is ); // widthSrc
                 readShort( is ); // sy
                 readShort( is ); // sx
-                float heightDst = (float)readShort( is );
-                float widthDst = (float)readShort( is ) * scaleXY;                    
-                float dy = (float)readShort( is ) * getVpHFactor() * (float)inch / PIXEL_PER_INCH;                                         
-                float dx = (float)readShort( is ) * getVpHFactor() * (float)inch / PIXEL_PER_INCH * scaleXY;  
-                widthDst = widthDst * getVpWFactor() * (float)inch / PIXEL_PER_INCH;
-                heightDst = heightDst * getVpHFactor() * (float)inch / PIXEL_PER_INCH;                                            
+                float heightDst = readShort( is );
+                float widthDst = readShort( is ) * scaleXY;
+                float dy = readShort( is ) * getVpHFactor() * inch / PIXEL_PER_INCH;
+                float dx = readShort( is ) * getVpHFactor() * inch / PIXEL_PER_INCH * scaleXY;
+                widthDst = widthDst * getVpWFactor() * inch / PIXEL_PER_INCH;
+                heightDst = heightDst * getVpHFactor() * inch / PIXEL_PER_INCH;
                 resizeImageBounds((int)dx, (int)dy);
                 resizeImageBounds((int)(dx + widthDst), (int)(dy + heightDst));                
 
@@ -571,9 +571,9 @@ public class WMFHeaderProperties extends
                 float width = readShort( is ) 
                     * (float)inch / PIXEL_PER_INCH * getVpWFactor() * scaleXY;
                 float dy = 
-                    (float)inch / PIXEL_PER_INCH * getVpHFactor() * readShort( is );
+                    inch / PIXEL_PER_INCH * getVpHFactor() * readShort( is );
                 float dx = 
-                    (float)inch / PIXEL_PER_INCH * getVpWFactor() * readShort( is ) * scaleXY;
+                    inch / PIXEL_PER_INCH * getVpWFactor() * readShort( is ) * scaleXY;
                 resizeImageBounds((int)dx, (int)dy);
                 resizeImageBounds((int)(dx + width), (int)(dy + height));                        
                 }
@@ -617,14 +617,14 @@ public class WMFHeaderProperties extends
      * the Metafile, in Metafile Units.
      */
     public int getWidthBoundsUnits() {
-        return (int)((float)inch * (float)_bwidth / PIXEL_PER_INCH);
+        return (int)((float)inch * _bwidth / PIXEL_PER_INCH);
     }
 
     /** @return the height of the Rectangle bounding the figures enclosed in
      * the Metafile in Metafile Units.
      */
     public int getHeightBoundsUnits() {
-        return (int)((float)inch * (float)_bheight / PIXEL_PER_INCH);
+        return (int)((float)inch * _bheight / PIXEL_PER_INCH);
     }
 
     /** @return the X offset of the Rectangle bounding the figures enclosed in
@@ -643,7 +643,7 @@ public class WMFHeaderProperties extends
 
     private void resetBounds() {
         // calculate geometry size
-        scale =  (float)getWidthPixels() / (float)vpW ;
+        scale =  (float)getWidthPixels() / vpW;
         if (_bright != -1) {
             _bright = (int)(scale * (vpX +_bright));
             _bleft = (int)(scale * (vpX +_bleft));
@@ -653,10 +653,10 @@ public class WMFHeaderProperties extends
 
         // calculate image size
         if (_iright != -1) {
-            _iright = (int)((float)_iright * (float)getWidthPixels() / (float)width);
-            _ileft = (int)((float)_ileft * (float)getWidthPixels() / (float)width);
-            _ibottom = (int)((float)_ibottom * (float)getWidthPixels() / (float)width);
-            _itop = (int)((float)_itop  * (float)getWidthPixels() / (float)width);
+            _iright = (int)((float)_iright * getWidthPixels() / width);
+            _ileft = (int)((float)_ileft * getWidthPixels() / width);
+            _ibottom = (int)((float)_ibottom * getWidthPixels() / width);
+            _itop = (int)((float)_itop  * getWidthPixels() / width);
 
             // merge image and geometry size
             if ((_bright == -1) || (_iright > _bright)) _bright = _iright;

Modified: xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java?rev=1831630&r1=1831629&r2=1831630&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java (original)
+++ xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFPainter.java Tue May 15 12:56:55 2018
@@ -113,12 +113,12 @@ public class WMFPainter extends Abstract
         this.conv = scale;
         this.xOffset = -xOffset;
         this.yOffset = -yOffset;
-        this.scale = (float)currentStore.getWidthPixels() / (float)currentStore.getWidthUnits() * scale;
-        this.scale = this.scale * (float)currentStore.getWidthPixels() / (float)currentStore.getVpW() ;
-        float xfactor  = (float)currentStore.getVpW() / (float)currentStore.getWidthPixels()
-            * (float)currentStore.getWidthUnits() / (float)currentStore.getWidthPixels();
-        float yfactor  = (float)currentStore.getVpH() / (float)currentStore.getHeightPixels()
-            * (float)currentStore.getHeightUnits() / (float)currentStore.getHeightPixels();
+        this.scale = (float)currentStore.getWidthPixels() / currentStore.getWidthUnits() * scale;
+        this.scale = this.scale * currentStore.getWidthPixels() / currentStore.getVpW();
+        float xfactor  = (float)currentStore.getVpW() / currentStore.getWidthPixels()
+            * currentStore.getWidthUnits() / currentStore.getWidthPixels();
+        float yfactor  = (float)currentStore.getVpH() / currentStore.getHeightPixels()
+            * currentStore.getHeightUnits() / currentStore.getHeightPixels();
         this.xOffset = this.xOffset * xfactor;
         this.yOffset = this.yOffset * yfactor;
         scaleX = this.scale;
@@ -179,16 +179,16 @@ public class WMFPainter extends Abstract
 
                 switch ( mr.functionId ) {
                 case WMFConstants.META_SETWINDOWORG:
-                    currentStore.setVpX( vpX = -(float)mr.elementAt( 0 ) );
-                    currentStore.setVpY( vpY = -(float)mr.elementAt( 1 ) );
+                    currentStore.setVpX( vpX = -mr.elementAt( 0 ));
+                    currentStore.setVpY( vpY = -mr.elementAt( 1 ));
                     vpX = vpX * scale;
                     vpY = vpY * scale;
                     break;
 
                 case WMFConstants.META_SETWINDOWORG_EX: // ???? LOOKS SUSPICIOUS
                 case WMFConstants.META_SETWINDOWEXT:
-                    vpW = (float)mr.elementAt( 0 );
-                    vpH = (float)mr.elementAt( 1 );
+                    vpW = mr.elementAt( 0 );
+                    vpH = mr.elementAt( 1 );
 
 
                     scaleX = scale;
@@ -512,10 +512,10 @@ public class WMFPainter extends Abstract
                         float x1, y1, x2, y2, x3, y3;
                         x1 = scaleX * ( vpX + xOffset + mr.elementAt( 0 ) );
                         x2 = scaleX * ( vpX + xOffset + mr.elementAt( 2 ) );
-                        x3 = scaleX * (float)(mr.elementAt( 4 ) );
+                        x3 = scaleX * (mr.elementAt( 4 ) );
                         y1 = scaleY * ( vpY + yOffset + mr.elementAt( 1 ) );
                         y2 = scaleY * ( vpY + yOffset + mr.elementAt( 3 ) );
-                        y3 = scaleY * (float)(mr.elementAt( 5 ) );
+                        y3 = scaleY * (mr.elementAt( 5 ) );
 
                         RoundRectangle2D rec =
                             new RoundRectangle2D.Float(x1, y1, x2-x1, y2-y1, x3, y3);
@@ -803,9 +803,9 @@ public class WMFPainter extends Abstract
                     break;
                 case WMFConstants.META_PATBLT:
                     {
-                        float rop = (float)(mr.elementAt( 0 ) );
-                        float height = scaleY * (float)(mr.elementAt( 1 ) );
-                        float width = scaleX * (float)(mr.elementAt( 2 ) );
+                        float rop = (mr.elementAt( 0 ) );
+                        float height = scaleY * (mr.elementAt( 1 ) );
+                        float width = scaleX * (mr.elementAt( 2 ) );
                         float left = scaleX * (vpX + xOffset + mr.elementAt( 3 ) );
                         float top  = scaleY * (vpY + yOffset + mr.elementAt( 4 ) );
 
@@ -849,8 +849,8 @@ public class WMFPainter extends Abstract
                         int sx = mr.elementAt( 4 );
                         float dy = conv * currentStore.getVpWFactor() * (vpY + yOffset + mr.elementAt( 7 ) );
                         float dx = conv * currentStore.getVpHFactor() * (vpX + xOffset + mr.elementAt( 8 ) );
-                        float heightDst = (float)(mr.elementAt( 5 ) );
-                        float widthDst = (float)(mr.elementAt( 6 ) );
+                        float heightDst = (mr.elementAt( 5 ) );
+                        float widthDst = (mr.elementAt( 6 ) );
                         widthDst = widthDst * conv * currentStore.getVpWFactor();
                         heightDst = heightDst * conv * currentStore.getVpHFactor();
                         byte[] bitmap = ((MetaRecord.ByteRecord)mr).bstr;
@@ -869,11 +869,11 @@ public class WMFPainter extends Abstract
                         int sy = mr.elementAt( 3 );
                         int sx = mr.elementAt( 4 );
                         float dy = conv * currentStore.getVpWFactor() *
-                            (vpY + yOffset + (float)mr.elementAt( 7 ));
+                            (vpY + yOffset + mr.elementAt( 7 ));
                         float dx = conv * currentStore.getVpHFactor() *
-                            (vpX + xOffset + (float)mr.elementAt( 8 ));
-                        float heightDst = (float)(mr.elementAt( 5 ));
-                        float widthDst = (float)(mr.elementAt( 6 ));
+                            (vpX + xOffset + mr.elementAt( 8 ));
+                        float heightDst = (mr.elementAt( 5 ));
+                        float widthDst = (mr.elementAt( 6 ));
                         widthDst = widthDst * conv * currentStore.getVpWFactor();
                         heightDst = heightDst * conv * currentStore.getVpHFactor();
                         byte[] bitmap = ((MetaRecord.ByteRecord)mr).bstr;
@@ -977,7 +977,7 @@ public class WMFPainter extends Abstract
     private Paint getPaint(byte[] bit) {
         Dimension d = getImageDimension(bit);
         BufferedImage img = getImage(bit);
-        Rectangle2D rec = new Rectangle2D.Float(0, 0, (float)d.width, (float)d.height);
+        Rectangle2D rec = new Rectangle2D.Float(0, 0, d.width, d.height);
         TexturePaint paint = new TexturePaint(img, rec);
         return paint;
     }

Modified: xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFRecordStore.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFRecordStore.java?rev=1831630&r1=1831629&r2=1831630&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFRecordStore.java (original)
+++ xmlgraphics/batik/trunk/batik-transcoder/src/main/java/org/apache/batik/transcoder/wmf/tosvg/WMFRecordStore.java Tue May 15 12:56:55 2018
@@ -300,8 +300,8 @@ public class WMFRecordStore extends Abst
                     mr.addElement( xnum );
                     mr.addElement( ynum );
                     records.add( mr );
-                    scaleX = scaleX * (float)xdenom / (float)xnum;
-                    scaleY = scaleY * (float)ydenom / (float)ynum;
+                    scaleX = scaleX * xdenom / xnum;
+                    scaleY = scaleY * ydenom / ynum;
                 }
                 break;
 

Modified: xmlgraphics/batik/trunk/batik-util/src/main/java/org/apache/batik/util/Base64DecodeStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/batik-util/src/main/java/org/apache/batik/util/Base64DecodeStream.java?rev=1831630&r1=1831629&r2=1831630&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/batik-util/src/main/java/org/apache/batik/util/Base64DecodeStream.java (original)
+++ xmlgraphics/batik/trunk/batik-util/src/main/java/org/apache/batik/util/Base64DecodeStream.java Tue May 15 12:56:55 2018
@@ -102,7 +102,7 @@ public class Base64DecodeStream extends
             }
         }
 
-        return ((int)out_buffer[out_offset++])&0xFF;
+        return out_buffer[out_offset++] &0xFF;
     }
 
     public int read(byte []out, int offset, int len)
@@ -146,10 +146,10 @@ public class Base64DecodeStream extends
             off = out;
         }
 
-        a = pem_array[((int)decode_buffer[0])&0xFF];
-        b = pem_array[((int)decode_buffer[1])&0xFF];
-        c = pem_array[((int)decode_buffer[2])&0xFF];
-        d = pem_array[((int)decode_buffer[3])&0xFF];
+        a = pem_array[decode_buffer[0] &0xFF];
+        b = pem_array[decode_buffer[1] &0xFF];
+        c = pem_array[decode_buffer[2] &0xFF];
+        d = pem_array[decode_buffer[3] &0xFF];
 
         out_buffer[0] = (byte)((a<<2) | (b>>>4));
         out_buffer[1] = (byte)((b<<4) | (c>>>2));

Modified: xmlgraphics/batik/trunk/batik-util/src/main/java/org/apache/batik/util/ParsedURLData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/batik-util/src/main/java/org/apache/batik/util/ParsedURLData.java?rev=1831630&r1=1831629&r2=1831630&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/batik-util/src/main/java/org/apache/batik/util/ParsedURLData.java (original)
+++ xmlgraphics/batik/trunk/batik-util/src/main/java/org/apache/batik/util/ParsedURLData.java Tue May 15 12:56:55 2018
@@ -85,8 +85,8 @@ public class ParsedURLData {
         if (((data[0]&0x0F)  == 8) &&
             ((data[0]>>>4)   <= 7)) {
             // Check for a zlib (deflate) stream
-            int chk = ((((int)data[0])&0xFF)*256+
-                       (((int)data[1])&0xFF));
+            int chk = ((data[0] &0xFF)*256+
+                       (data[1] &0xFF));
             if ((chk %31)  == 0) {
                 try {
                     // I'm not really as certain of this check

Modified: xmlgraphics/batik/trunk/batik-util/src/test/java/org/apache/batik/util/ParsedURLDataTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/batik-util/src/test/java/org/apache/batik/util/ParsedURLDataTest.java?rev=1831630&r1=1831629&r2=1831630&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/batik-util/src/test/java/org/apache/batik/util/ParsedURLDataTest.java (original)
+++ xmlgraphics/batik/trunk/batik-util/src/test/java/org/apache/batik/util/ParsedURLDataTest.java Tue May 15 12:56:55 2018
@@ -112,7 +112,7 @@ public class ParsedURLDataTest extends A
         }
         StringBuffer sb = new StringBuffer();
         for (int i=0; i<num; i++) {
-            int val = ((int)data[i])&0xFF;
+            int val = data[i] &0xFF;
             if (val < 16) {
                 sb.append("0");
             }