aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java b/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java
index f28774afa..1dded7882 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java
@@ -78,7 +78,8 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect {
public static PNGPixelRect read(final InputStream in,
final PixelFormat ddestFmt, final boolean destDirectBuffer, final int destMinStrideInBytes,
final boolean destIsGLOriented) throws IOException {
- final PngReader pngr = new PngReader(new BufferedInputStream(in), null);
+ final BufferedInputStream bin = (in instanceof BufferedInputStream) ? (BufferedInputStream)in : new BufferedInputStream(in);
+ final PngReader pngr = new PngReader(bin, null);
final ImageInfo imgInfo = pngr.imgInfo;
final PngChunkPLTE plte = pngr.getMetadata().getPLTE();
final PngChunkTRNS trns = pngr.getMetadata().getTRNS();