Skip to content

Commit

Permalink
Fix incorrect image data used when loading external RGB image data
Browse files Browse the repository at this point in the history
The data of `ImgInfo` is freed by the preceding call to `ConvertToRgba`.
  • Loading branch information
Robyt3 committed Sep 22, 2024
1 parent 3362b36 commit e3c89c5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/game/editor/mapitems/map_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,10 @@ bool CEditorMap::Load(const char *pFileName, int StorageType, const std::functio
ConvertToRgba(*pImg);

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;
pImg->m_Texture = m_pEditor->Graphics()->LoadTextureRaw(ImgInfo, TextureLoadFlag, aBuf);
ImgInfo.m_pData = nullptr;
pImg->m_External = 1;
pImg->m_Texture = m_pEditor->Graphics()->LoadTextureRaw(*pImg, TextureLoadFlag, aBuf);
}
}
else
Expand Down

0 comments on commit e3c89c5

Please sign in to comment.