You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ma...@apache.org on 2015/11/04 11:15:16 UTC
svn commit: r1712525 -
/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java
Author: matthias
Date: Wed Nov 4 10:15:16 2015
New Revision: 1712525
URL: http://svn.apache.org/viewvc?rev=1712525&view=rev
Log:
XGC-93: fix performancy penalty caused by excessive DeflaterOutputStream.write(byte) calls, thanks to Andre Klemann
Modified:
xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java?rev=1712525&r1=1712524&r2=1712525&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java Wed Nov 4 10:15:16 2015
@@ -323,11 +323,13 @@ public class ImageEncodingHelper {
byte[] bytes = ((DataBufferByte) buffer).getData();
// see determineEncodingColorModel() to see why we permute B and R here
if (isBGR) {
+ byte[] bytesPermutated = new byte[bytes.length];
for (int i = 0; i < bytes.length; i += 3) {
- out.write(bytes[i + 2]);
- out.write(bytes[i + 1]);
- out.write(bytes[i]);
+ bytesPermutated[i] = bytes[i+2];
+ bytesPermutated[i+1] = bytes[i+1];
+ bytesPermutated[i+2] = bytes[i];
}
+ out.write(bytesPermutated);
} else {
out.write(bytes);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org