From 437584608fa8e479ba13f209ff42d609bda5c41d Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sat, 20 May 2006 14:23:41 +0000 Subject: Fixed bugs in handling of mipmapped compressed textures git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@771 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/classes/com/sun/opengl/util/texture/spi/DDSImage.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/classes/com/sun/opengl/util/texture/spi/DDSImage.java') diff --git a/src/classes/com/sun/opengl/util/texture/spi/DDSImage.java b/src/classes/com/sun/opengl/util/texture/spi/DDSImage.java index 068e3baa6..12a855c57 100755 --- a/src/classes/com/sun/opengl/util/texture/spi/DDSImage.java +++ b/src/classes/com/sun/opengl/util/texture/spi/DDSImage.java @@ -734,18 +734,12 @@ public class DDSImage { } private int mipMapSizeInBytes(int map) { + int width = mipMapWidth(map); + int height = mipMapHeight(map); if (isCompressed()) { - if (!isSurfaceDescFlagSet(DDSD_LINEARSIZE)) { - throw new RuntimeException("Illegal compressed texture: DDSD_LINEARSIZE not specified in texture header"); - } - int bytes = header.pitchOrLinearSize; - for (int i = 0; i < map; i++) { - bytes >>= 2; - } - return bytes; + int blockSize = (getCompressionFormat() == D3DFMT_DXT1 ? 8 : 16); + return ((width+3)/4)*((height+3)/4)*blockSize; } else { - int width = mipMapWidth(map); - int height = mipMapHeight(map); return width * height * (getDepth() / 8); } } -- cgit v1.2.3