From b0169344a9fc01c4fcc9a9c1a750815f02bc5633 Mon Sep 17 00:00:00 2001 From: Julien Gouesse Date: Sun, 9 Aug 2015 17:58:14 +0200 Subject: Calls ImageIOUtil in TextureIO to detect the image format of a stream, see the bug report 1042 --- .../classes/com/jogamp/opengl/util/texture/TextureIO.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/jogl/classes/com/jogamp') diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java index 54a552f33..80b195642 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java @@ -895,7 +895,7 @@ public class TextureIO { final boolean mipmap, final String fileSuffix) throws IOException { if (DDS.equals(fileSuffix) || - DDSImage.isDDSImage(stream)) { + DDS.equals(ImageIOUtil.getFileSuffix(stream))) { final byte[] data = IOUtil.copyStream2ByteArray(stream); final ByteBuffer buf = ByteBuffer.wrap(data); final DDSImage image = DDSImage.read(buf); @@ -1052,7 +1052,8 @@ public class TextureIO { final String fileSuffix) throws IOException { if (SGI.equals(fileSuffix) || SGI_RGB.equals(fileSuffix) || - SGIImage.isSGIImage(stream)) { + SGI.equals(ImageIOUtil.getFileSuffix(stream)) || + SGI_RGB.equals(ImageIOUtil.getFileSuffix(stream))) { final SGIImage image = SGIImage.read(stream); if (pixelFormat == 0) { pixelFormat = image.getFormat(); @@ -1124,7 +1125,8 @@ public class TextureIO { int pixelFormat, final boolean mipmap, final String fileSuffix) throws IOException { - if (PNG.equals(fileSuffix)) { + if (PNG.equals(fileSuffix) || + PNG.equals(ImageIOUtil.getFileSuffix(stream))) { final PNGPixelRect image = PNGPixelRect.read(stream, null, true /* directBuffer */, 0 /* destMinStrideInBytes */, true /* destIsGLOriented */); final GLPixelAttributes glpa = new GLPixelAttributes(glp, image.getPixelformat(), false /* pack */); if ( 0 == pixelFormat ) { @@ -1164,7 +1166,8 @@ public class TextureIO { int pixelFormat, final boolean mipmap, final String fileSuffix) throws IOException { - if (JPG.equals(fileSuffix)) { + if (JPG.equals(fileSuffix) || + JPG.equals(ImageIOUtil.getFileSuffix(stream))) { final JPEGImage image = JPEGImage.read(/*glp, */ stream); if (pixelFormat == 0) { pixelFormat = image.getGLFormat(); -- cgit v1.2.3