mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-14 21:32:23 +08:00
Improve texture size detection to prevent possible crashes on normal textures (not wpengine textures)
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
70d815c183
commit
ab308b2c63
@ -22,7 +22,9 @@ CTexture::CTexture (void* fileData)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: DETERMINE IF TEXTURES CAN HAVE 0 IMAGES
|
if (this->m_header->freeImageFormat != FREE_IMAGE_FORMAT::FIF_UNKNOWN)
|
||||||
|
{
|
||||||
|
// wpengine-texture format always has one mipmap
|
||||||
// get first image size
|
// get first image size
|
||||||
std::vector<TextureMipmap*>::const_iterator element = this->m_header->images.find (0)->second.begin ();
|
std::vector<TextureMipmap*>::const_iterator element = this->m_header->images.find (0)->second.begin ();
|
||||||
|
|
||||||
@ -32,6 +34,16 @@ CTexture::CTexture (void* fileData)
|
|||||||
this->m_header->width, this->m_header->height
|
this->m_header->width, this->m_header->height
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// set the texture resolution
|
||||||
|
this->m_resolution = {
|
||||||
|
this->m_header->textureWidth, this->m_header->textureHeight,
|
||||||
|
this->m_header->width, this->m_header->height
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (this->m_header->freeImageFormat != FREE_IMAGE_FORMAT::FIF_UNKNOWN)
|
if (this->m_header->freeImageFormat != FREE_IMAGE_FORMAT::FIF_UNKNOWN)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user