aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Brygin <bae@openjdk.org>2022-01-14 17:53:40 +0000
committerVitaly Provodin <vitaly.provodin@jetbrains.com>2022-04-29 05:43:42 +0700
commit1ec310320b02849045baa2a7bb630e61e1d1f122 (patch)
treeba93350c17bc77f1093a97452b5cc5ce6dc9a216
parentdb07db3824ff9b21a79c8902b7303e1e73551dac (diff)
downloadJetBrainsRuntime-1ec310320b02849045baa2a7bb630e61e1d1f122.tar.gz
8278805: Enhance BMP image loading
Backport-of: 6319119be51e595be82f253b9f5e9495e72d4ad9
-rw-r--r--src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java b/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java
index 2e1c2db03ca..29c40da43c3 100644
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java
@@ -67,6 +67,7 @@ import javax.imageio.stream.ImageInputStream;
import com.sun.imageio.plugins.common.I18N;
import com.sun.imageio.plugins.common.ImageUtil;
+import com.sun.imageio.plugins.common.ReaderUtil;
/** This class is the Java Image IO plugin reader for BMP images.
* It may subsample the image, clip the image, select sub-bands,
@@ -1542,9 +1543,8 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
}
// Read till we have the whole image
- byte[] values = new byte[imSize];
- int bytesRead = 0;
- iis.readFully(values, 0, imSize);
+ byte[] values = ReaderUtil.
+ staggeredReadByteStream(iis, imSize);
// Since data is compressed, decompress it
decodeRLE8(imSize, padding, values, bdata);
@@ -1726,8 +1726,8 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
}
// Read till we have the whole image
- byte[] values = new byte[imSize];
- iis.readFully(values, 0, imSize);
+ byte[] values = ReaderUtil.
+ staggeredReadByteStream(iis, imSize);
// Decompress the RLE4 compressed data.
decodeRLE4(imSize, padding, values, bdata);