mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 05:58:19 +00:00
Fix incorrect image data used when loading external RGB image
The data of `ImgInfo` is freed by the preceding call to `ConvertToRgba`.
This commit is contained in:
parent
3362b3688a
commit
aea648e44d
|
@ -513,11 +513,10 @@ bool CEditorMap::Load(const char *pFileName, int StorageType, const std::functio
|
||||||
ConvertToRgba(*pImg);
|
ConvertToRgba(*pImg);
|
||||||
|
|
||||||
int TextureLoadFlag = m_pEditor->Graphics()->Uses2DTextureArrays() ? IGraphics::TEXLOAD_TO_2D_ARRAY_TEXTURE : IGraphics::TEXLOAD_TO_3D_TEXTURE;
|
int TextureLoadFlag = m_pEditor->Graphics()->Uses2DTextureArrays() ? IGraphics::TEXLOAD_TO_2D_ARRAY_TEXTURE : IGraphics::TEXLOAD_TO_3D_TEXTURE;
|
||||||
if(ImgInfo.m_Width % 16 != 0 || ImgInfo.m_Height % 16 != 0)
|
if(pImg->m_Width % 16 != 0 || pImg->m_Height % 16 != 0)
|
||||||
TextureLoadFlag = 0;
|
TextureLoadFlag = 0;
|
||||||
pImg->m_Texture = m_pEditor->Graphics()->LoadTextureRaw(ImgInfo, TextureLoadFlag, aBuf);
|
|
||||||
ImgInfo.m_pData = nullptr;
|
|
||||||
pImg->m_External = 1;
|
pImg->m_External = 1;
|
||||||
|
pImg->m_Texture = m_pEditor->Graphics()->LoadTextureRaw(*pImg, TextureLoadFlag, aBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue