Fix editor crash when saving external RGB images after embedding

Always convert image data to RGBA and dilate if enabled also for external images, as images may be embedded later and should therefore always be in RGBA format.
This commit is contained in:
Robert Müller 2024-09-21 13:40:08 +02:00
parent 3d8bb6f3b2
commit 3362b3688a

View file

@ -4358,13 +4358,10 @@ bool CEditor::ReplaceImage(const char *pFileName, int StorageType, bool CheckDup
str_copy(pImg->m_aName, aBuf);
pImg->m_External = IsVanillaImage(pImg->m_aName);
if(!pImg->m_External)
ConvertToRgba(*pImg);
if(g_Config.m_ClEditorDilate == 1)
{
ConvertToRgba(*pImg);
if(g_Config.m_ClEditorDilate == 1)
{
DilateImage(*pImg);
}
DilateImage(*pImg);
}
pImg->m_AutoMapper.Load(pImg->m_aName);
@ -4425,13 +4422,10 @@ bool CEditor::AddImage(const char *pFileName, int StorageType, void *pUser)
pImg->m_pData = ImgInfo.m_pData;
pImg->m_External = IsVanillaImage(aBuf);
if(!pImg->m_External)
ConvertToRgba(*pImg);
if(g_Config.m_ClEditorDilate == 1)
{
ConvertToRgba(*pImg);
if(g_Config.m_ClEditorDilate == 1)
{
DilateImage(*pImg);
}
DilateImage(*pImg);
}
int TextureLoadFlag = pEditor->Graphics()->Uses2DTextureArrays() ? IGraphics::TEXLOAD_TO_2D_ARRAY_TEXTURE : IGraphics::TEXLOAD_TO_3D_TEXTURE;