/* DDSDecompressDXT4() decompresses a dxt4 format texture (fixme: un-premultiply alpha) */ s32 DDSDecompressDXT4( ddsBuffer *dds, s32 width, s32 height, u8 *pixels ) { /* decompress dxt5 first */ const s32 r = DDSDecompressDXT5( dds, width, height, pixels ); /* return to sender */ return r; }
/* DDSDecompress() decompresses a dds texture into an rgba image buffer, returns 0 on success */ s32 DDSDecompress( ddsBuffer *dds, u8 *pixels ) { s32 width, height, r; eDDSPixelFormat pf; /* get dds info */ r = DDSGetInfo( dds, &width, &height, &pf ); if( r ) return r; /* decompress */ switch( pf ) { case DDS_PF_ARGB8888: /* fixme: support other [a]rgb formats */ r = DDSDecompressARGB8888( dds, width, height, pixels ); break; case DDS_PF_DXT1: r = DDSDecompressDXT1( dds, width, height, pixels ); break; case DDS_PF_DXT2: r = DDSDecompressDXT2( dds, width, height, pixels ); break; case DDS_PF_DXT3: r = DDSDecompressDXT3( dds, width, height, pixels ); break; case DDS_PF_DXT4: r = DDSDecompressDXT4( dds, width, height, pixels ); break; case DDS_PF_DXT5: r = DDSDecompressDXT5( dds, width, height, pixels ); break; default: case DDS_PF_UNKNOWN: memset( pixels, 0xFF, width * height * 4 ); r = -1; break; } /* return to sender */ return r; }