From 34ae5bcb6fea32466f22be5526c718f1c22192f3 Mon Sep 17 00:00:00 2001 From: castano Date: Thu, 17 Apr 2008 07:17:46 +0000 Subject: [PATCH] Merge 2.0 branch fixes. --- ChangeLog | 1 + src/nvimage/DirectDrawSurface.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 597db1c..6212c18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ NVIDIA Texture Tools version 2.0.2 * Avoid default-initialized constructors for POD types, reported by Jim Tilander. * Improved decompressor tool submitted by Amorilia. See issue 41. * Add single color compresor for DXT1a. + * Set swizzle code to ATI2 files. See issue 41. NVIDIA Texture Tools version 2.0.1 * Fix memory leaks. diff --git a/src/nvimage/DirectDrawSurface.cpp b/src/nvimage/DirectDrawSurface.cpp index d63910a..9c14565 100644 --- a/src/nvimage/DirectDrawSurface.cpp +++ b/src/nvimage/DirectDrawSurface.cpp @@ -54,6 +54,8 @@ namespace static const uint FOURCC_ATI1 = MAKEFOURCC('A', 'T', 'I', '1'); static const uint FOURCC_ATI2 = MAKEFOURCC('A', 'T', 'I', '2'); + static const uint FOURCC_A2XY = MAKEFOURCC('A', '2', 'X', 'Y'); + static const uint FOURCC_DX10 = MAKEFOURCC('D', 'X', '1', '0'); // 32 bit RGB formats. @@ -634,7 +636,16 @@ void DDSHeader::setFourCC(uint8 c0, uint8 c1, uint8 c2, uint8 c3) // set fourcc pixel format. this->pf.flags = DDPF_FOURCC; this->pf.fourcc = MAKEFOURCC(c0, c1, c2, c3); - this->pf.bitcount = 0; + + if (this->pf.fourcc == FOURCC_ATI2) + { + this->pf.bitcount = FOURCC_A2XY; + } + else + { + this->pf.bitcount = 0; + } + this->pf.rmask = 0; this->pf.gmask = 0; this->pf.bmask = 0;