xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matth...@apache.org
Subject svn commit: r1712525 - /xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/ImageEncodingHelper.java
Date Wed, 04 Nov 2015 10:15:16 GMT
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


Mime
View raw message