Only auto dilate for transparent images

This commit is contained in:
Jupeyy 2020-09-26 18:57:19 +02:00
parent 87e86834c3
commit c69c765507

View file

@ -3609,14 +3609,10 @@ void CEditor::ReplaceImage(const char *pFileName, int StorageType, void *pUser)
IStorage::StripPathAndExtension(pFileName, pImg->m_aName, sizeof(pImg->m_aName));
pImg->m_External = IsVanillaImage(pImg->m_aName);
if(!pImg->m_External && g_Config.m_ClEditorDilate == 1)
if(!pImg->m_External && g_Config.m_ClEditorDilate == 1 && pImg->m_Format == CImageInfo::FORMAT_RGBA)
{
int ColorChannelCount = 0;
if(ImgInfo.m_Format == CImageInfo::FORMAT_ALPHA)
ColorChannelCount = 1;
else if(ImgInfo.m_Format == CImageInfo::FORMAT_RGB)
ColorChannelCount = 3;
else if(ImgInfo.m_Format == CImageInfo::FORMAT_RGBA)
if(ImgInfo.m_Format == CImageInfo::FORMAT_RGBA)
ColorChannelCount = 4;
DilateImage((unsigned char *)ImgInfo.m_pData, ImgInfo.m_Width, ImgInfo.m_Height, ColorChannelCount);
@ -3664,14 +3660,10 @@ void CEditor::AddImage(const char *pFileName, int StorageType, void *pUser)
*pImg = ImgInfo;
pImg->m_External = IsVanillaImage(aBuf);
if(!pImg->m_External && g_Config.m_ClEditorDilate == 1)
if(!pImg->m_External && g_Config.m_ClEditorDilate == 1 && pImg->m_Format == CImageInfo::FORMAT_RGBA)
{
int ColorChannelCount = 0;
if(ImgInfo.m_Format == CImageInfo::FORMAT_ALPHA)
ColorChannelCount = 1;
else if(ImgInfo.m_Format == CImageInfo::FORMAT_RGB)
ColorChannelCount = 3;
else if(ImgInfo.m_Format == CImageInfo::FORMAT_RGBA)
if(ImgInfo.m_Format == CImageInfo::FORMAT_RGBA)
ColorChannelCount = 4;
DilateImage((unsigned char *)ImgInfo.m_pData, ImgInfo.m_Width, ImgInfo.m_Height, ColorChannelCount);