diff options
author | Sven Gothel <[email protected]> | 2015-08-19 05:56:05 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-08-19 05:56:05 +0200 |
commit | 87c5e1615346f72ad5686053bae338bdb66b1b01 (patch) | |
tree | 23c1223e0e8a864a7f7e1c5736a390d7fe03437a /src | |
parent | c4ed57f617117e3e38319f1a44a0d066f1a332b3 (diff) |
PNGPixelRect: Avoid redundant wrapping of InputStream into BufferedInputStream
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java | 3 |
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(); |