You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2021/05/13 16:02:21 UTC
svn commit: r1889854 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java
Author: tilman
Date: Thu May 13 16:02:20 2021
New Revision: 1889854
URL: http://svn.apache.org/viewvc?rev=1889854&view=rev
Log:
PDFBOX-4892: optimize, as suggested by valerybokov
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java?rev=1889854&r1=1889853&r2=1889854&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/PNGConverter.java Thu May 13 16:02:20 2021
@@ -238,7 +238,7 @@ final class PNGConverter
int highVal = (plte.length / 3) - 1;
if (highVal > 255)
{
- LOG.error(String.format("To much colors in PLTE, only 256 allowed, found %d colors.",
+ LOG.error(String.format("Too much colors in PLTE, only 256 allowed, found %d colors.",
highVal + 1));
return null;
}
@@ -279,18 +279,16 @@ final class PNGConverter
for (int i = 0; i < bytes.length; i++)
{
int idx = (int) iis.readBits(bitsPerComponent);
- byte v;
if (idx < transparencyTable.length)
{
// Inside the table, use the transparency value
- v = transparencyTable[idx];
+ bytes[i] = transparencyTable[idx];
}
else
{
// Outside the table -> transparent value is 0xFF here.
- v = (byte) 0xFF;
+ bytes[i] = (byte) 0xFF;
}
- bytes[i] = v;
w++;
if (w == state.width)
{