Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
- index a4281514e39..5f6b4feb64e 100644
- --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
- +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
- @@ -864,7 +864,7 @@ bool DDSHeader::isSrgb() const
- bool DDSHeader::hasAlpha() const
- {
- - return (pf.flags & DDPF_ALPHAPIXELS) != 0;
- + return (pf.flags & DDPF_ALPHAPIXELS) != 0 || (pf.flags & DDPF_ALPHA) != 0;
- }
- uint DDSHeader::d3d9Format() const
- @@ -949,7 +949,7 @@ bool DirectDrawSurface::isSupported() const
- return false;
- }
- }
- - else if ((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_LUMINANCE))
- + else if ((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_LUMINANCE) || (header.pf.flags & DDPF_ALPHA))
- {
- // All RGB and luminance formats are supported now.
- }
- @@ -986,7 +986,7 @@ bool DirectDrawSurface::hasAlpha() const
- }
- else
- {
- - if (header.pf.flags & DDPF_RGB)
- + if ((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_ALPHA))
- {
- return header.pf.amask != 0;
- }
- @@ -1124,7 +1124,7 @@ void DirectDrawSurface::mipmap(Image *img, uint face, uint mipmap)
- }
- else
- {
- - if (header.pf.flags & DDPF_RGB)
- + if ((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_ALPHA))
- {
- readLinearImage(img);
- }
- @@ -1194,10 +1194,15 @@ void DirectDrawSurface::readLinearImage(Image *img)
- mem_read(stream, (unsigned char *)(&c), byteCount);
- Color32 pixel(0, 0, 0, 0xFF);
- - 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);
- + if ( header.pf.flags & DDPF_ALPHA )
- + pixel.r = pixel.g = pixel.b = PixelFormat::convert((c & header.pf.amask) >> ashift, asize, 8);
- + else
- + {
- + 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;
- }
- @@ -1391,7 +1396,7 @@ uint DirectDrawSurface::mipmapSize(uint mipmap) const
- h = (h + 3) / 4;
- return blockSize() * w * h;
- }
- - else if (header.pf.flags & DDPF_RGB || (header.pf.flags & DDPF_LUMINANCE))
- + else if (header.pf.flags & DDPF_RGB || (header.pf.flags & DDPF_LUMINANCE) || (header.pf.flags & DDPF_ALPHA))
- {
- uint pitch = computePitch(w, header.pf.bitcount, 8); // Asuming 8 bit alignment, which is the same D3DX expects.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement