commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1325915 - /commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/png/BitParser.java
Date Fri, 13 Apr 2012 19:33:22 GMT
Author: damjan
Date: Fri Apr 13 19:33:22 2012
New Revision: 1325915

URL: http://svn.apache.org/viewvc?rev=1325915&view=rev
Log:
Improve the sample depth scaling for greyscale PNG files.

Jira info key: SANSELAN-72


Modified:
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/png/BitParser.java

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/png/BitParser.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/png/BitParser.java?rev=1325915&r1=1325914&r2=1325915&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/png/BitParser.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/png/BitParser.java
Fri Apr 13 19:33:22 2012
@@ -63,7 +63,7 @@ public class BitParser
 
         int rot = 8 - bitDepth;
         if (rot > 0)
-            sample <<= rot;
+            sample = sample * 255 / ((1 << bitDepth) - 1);
         else if (rot < 0)
             sample >>= -rot;
 



Mime
View raw message