Read block images from DDS file.
This commit is contained in:
parent
51a24b88a3
commit
6df5bd93ae
@ -483,8 +483,14 @@ void DirectDrawSurface::mipmap(Image * img, uint face, uint mipmap)
|
|||||||
|
|
||||||
img->allocate(w, h);
|
img->allocate(w, h);
|
||||||
|
|
||||||
// readLinearImage(stream, img);
|
if (header.pf.flags & DDPF_RGB)
|
||||||
// readBlockImage(stream, img);
|
{
|
||||||
|
readLinearImage(img);
|
||||||
|
}
|
||||||
|
else if (header.pf.flags & DDPF_FOURCC)
|
||||||
|
{
|
||||||
|
readBlockImage(img);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -517,9 +523,9 @@ void DirectDrawSurface::readBlockImage(Image * img)
|
|||||||
readBlock(&block);
|
readBlock(&block);
|
||||||
|
|
||||||
// Write color block.
|
// Write color block.
|
||||||
for (uint y = 0; y < min(4U, 4*bh-h); y++)
|
for (uint y = 0; y < min(4U, h-4*bx); y++)
|
||||||
{
|
{
|
||||||
for (uint x = 0; x < min(4U, 4*bw-w); x++)
|
for (uint x = 0; x < min(4U, w-4*by); x++)
|
||||||
{
|
{
|
||||||
img->pixel(4*bx+x, 4*by+y) = block.color(x, y);
|
img->pixel(4*bx+x, 4*by+y) = block.color(x, y);
|
||||||
}
|
}
|
||||||
@ -624,8 +630,7 @@ uint DirectDrawSurface::blockSize() const
|
|||||||
return 16;
|
return 16;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This should never happen.
|
// Not a block image.
|
||||||
nvDebugCheck(false);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user