mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
Fix bugs caused by image optimization procedure
This commit is contained in:
@ -263,6 +263,13 @@ void SDLImageShared::optimizeSurface()
|
|||||||
SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
|
SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
|
||||||
SDL_BlitSurface(surf, &rectSDL, newSurface, nullptr);
|
SDL_BlitSurface(surf, &rectSDL, newSurface, nullptr);
|
||||||
|
|
||||||
|
if (SDL_HasColorKey(surf))
|
||||||
|
{
|
||||||
|
uint32_t colorKey;
|
||||||
|
SDL_GetColorKey(surf, &colorKey);
|
||||||
|
SDL_SetColorKey(newSurface, SDL_TRUE, colorKey);
|
||||||
|
}
|
||||||
|
|
||||||
SDL_FreeSurface(surf);
|
SDL_FreeSurface(surf);
|
||||||
surf = newSurface;
|
surf = newSurface;
|
||||||
|
|
||||||
@ -359,7 +366,7 @@ void SDLImageIndexed::playerColored(PlayerColor player)
|
|||||||
bool SDLImageShared::isTransparent(const Point & coords) const
|
bool SDLImageShared::isTransparent(const Point & coords) const
|
||||||
{
|
{
|
||||||
if (surf)
|
if (surf)
|
||||||
return CSDL_Ext::isTransparent(surf, coords.x, coords.y);
|
return CSDL_Ext::isTransparent(surf, coords.x - margins.x, coords.y - margins.y);
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user