Always duplicate temp loaddef for T6 instead of only duplicating it if resource size is bigger than 0

This commit is contained in:
Jan 2021-03-22 12:30:02 +01:00
parent 1058ee7881
commit 6f6d25da4a

View File

@ -17,15 +17,16 @@ void Actions_GfxImage::OnImageLoaded(GfxImage* image) const
void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const void Actions_GfxImage::LoadImageData(GfxImageLoadDef* loadDef, GfxImage* image) const
{ {
if(loadDef->resourceSize > 0) // if(loadDef->resourceSize > 0)
{ // {
const size_t loadDefSize = offsetof(T6::GfxImageLoadDef, data) + loadDef->resourceSize; //
// }
// else
// {
// image->texture.loadDef = nullptr;
// }
const size_t loadDefSize = offsetof(T6::GfxImageLoadDef, data) + loadDef->resourceSize;
image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone->GetMemory()->Alloc(loadDefSize)); image->texture.loadDef = static_cast<GfxImageLoadDef*>(m_zone->GetMemory()->Alloc(loadDefSize));
memcpy(image->texture.loadDef, loadDef, loadDefSize); memcpy(image->texture.loadDef, loadDef, loadDefSize);
}
else
{
image->texture.loadDef = nullptr;
}
} }