From 19477d60c05ac27eedbdc9ebe7db32c3e03a5b57 Mon Sep 17 00:00:00 2001 From: castano Date: Thu, 19 Mar 2009 08:57:49 +0000 Subject: [PATCH] Fix errors in the pixel format conversion code. --- src/nvimage/DirectDrawSurface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/nvimage/DirectDrawSurface.cpp b/src/nvimage/DirectDrawSurface.cpp index d8a4d86..5fe23c0 100644 --- a/src/nvimage/DirectDrawSurface.cpp +++ b/src/nvimage/DirectDrawSurface.cpp @@ -1060,10 +1060,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; }