diff --git a/ChangeLog b/ChangeLog index e437901..4560d08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ NVIDIA Texture Tools version 2.0.6 * Do not use CUDA to compress small mipmaps. Fixes issue 76. * Compute mipmaps of semi-transparent images correctly. * Shutdown CUDA properly. Fixes issue 83. + * Fix pixel format converions. Fixes issue 87. NVIDIA Texture Tools version 2.0.5 * Fix error in single color compressor. Fixes issue 66. diff --git a/src/nvimage/DirectDrawSurface.cpp b/src/nvimage/DirectDrawSurface.cpp index 2c0da94..df64ee3 100644 --- a/src/nvimage/DirectDrawSurface.cpp +++ b/src/nvimage/DirectDrawSurface.cpp @@ -989,10 +989,10 @@ void DirectDrawSurface::readLinearImage(Image * img) stream->serialize(&c, byteCount); Color32 pixel(0, 0, 0, 0xFF); - pixel.r = PixelFormat::convert(c >> rshift, rsize, 8); - pixel.g = PixelFormat::convert(c >> gshift, gsize, 8); - pixel.b = PixelFormat::convert(c >> bshift, bsize, 8); - pixel.a = PixelFormat::convert(c >> ashift, asize, 8); + pixel.r = PixelFormat::convert((c & header.pf.rmask) >> rshift, rsize, 8); + pixel.g = PixelFormat::convert((c & header.pf.gmask) >> gshift, gsize, 8); + pixel.b = PixelFormat::convert((c & header.pf.bmask) >> bshift, bsize, 8); + pixel.a = PixelFormat::convert((c & header.pf.amask) >> ashift, asize, 8); img->pixel(x, y) = pixel; }