1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Fix fade-in animation - per-surface alpha was not set correctly

This commit is contained in:
Ivan Savenko
2024-07-19 10:46:20 +00:00
parent 9f3663b7d4
commit c40eea6e10
4 changed files with 6 additions and 5 deletions

View File

@@ -111,7 +111,7 @@ void SDLImageConst::draw(SDL_Surface * where, SDL_Palette * palette, const Point
SDL_SetSurfaceAlphaMod(surf, alpha);
if (mode != EImageBlitMode::OPAQUE && surf->format->Amask != 0)
if (alpha != SDL_ALPHA_OPAQUE || (mode != EImageBlitMode::OPAQUE && surf->format->Amask != 0))
SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_BLEND);
else
SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
@@ -119,7 +119,7 @@ void SDLImageConst::draw(SDL_Surface * where, SDL_Palette * palette, const Point
if (palette && surf->format->palette)
SDL_SetSurfacePalette(surf, palette);
if(surf->format->BitsPerPixel == 8 && alpha == SDL_ALPHA_OPAQUE && mode == EImageBlitMode::ALPHA)
if(surf->format->palette && alpha == SDL_ALPHA_OPAQUE && mode == EImageBlitMode::ALPHA)
{
CSDL_Ext::blit8bppAlphaTo24bpp(surf, sourceRect, where, destShift);
}