1
0
forked from 0ad/0ad

Displays error when converting a grayscale texture instead of possibly crashing, refs #1640

This was SVN commit r12560.
This commit is contained in:
historic_bruno 2012-08-30 19:24:24 +00:00
parent 0b832176d5
commit 5f88bf8a79

View File

@ -337,6 +337,14 @@ bool CTextureConverter::ConvertTexture(const CTexturePtr& texture, const VfsPath
// Check whether there's any alpha channel
bool hasAlpha = ((tex.flags & TEX_ALPHA) != 0);
// TODO: grayscale images will fail on some systems
// see http://trac.wildfiregames.com/ticket/1640
if (tex.flags & TEX_GREY)
{
LOGERROR(L"Failed to convert grayscale texture \"%ls\" - only RGB textures are currently supported", src.string().c_str());
return false;
}
// Convert to uncompressed BGRA with no mipmaps
if (tex_transform_to(&tex, (tex.flags | TEX_BGR | TEX_ALPHA) & ~(TEX_DXT | TEX_MIPMAPS)) < 0)
{