mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Only auto dilate for transparent images
This commit is contained in:
parent
87e86834c3
commit
c69c765507
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue