Browse Source

Revert "An option to RLE-compress masked art"

This reverts commit c884f1a354.

Superceded by `DEVILUTIONX_CONVERT_FONTS_TO_CEL`, which offers the same
RAM reduction but without slowdown.
pull/4518/head
Gleb Mazovetskiy 4 years ago
parent
commit
7b98735878
  1. 1
      CMake/Definitions.cmake
  2. 2
      CMakeLists.txt
  3. 17
      Source/DiabloUI/art.cpp
  4. 9
      Source/utils/sdl_compat.h

1
CMake/Definitions.cmake

@ -15,7 +15,6 @@ foreach(
GPERF_HEAP_FIRST_GAME_ITERATION
STREAM_ALL_AUDIO
PACKET_ENCRYPTION
DEVILUTIONX_MASKED_ART_RLE
DEVILUTIONX_CONVERT_FONTS_TO_CEL
)
if(${def_name})

2
CMakeLists.txt

@ -59,8 +59,6 @@ mark_as_advanced(DISABLE_STREAMING_SOUNDS)
option(STREAM_ALL_AUDIO "Stream all the audio. For extremely RAM-constrained platforms.")
mark_as_advanced(STREAM_ALL_AUDIO)
option(DEVILUTIONX_MASKED_ART_RLE "RLE-compress masked art in memory (e.g. fonts). Slightly lower RAM usage at a significant performance cost." OFF)
option(DEVILUTIONX_CONVERT_FONTS_TO_CEL "Convert PCX font files to CEL in memory.")
if(TSAN)

17
Source/DiabloUI/art.cpp

@ -76,21 +76,8 @@ void LoadArt(const char *pszFile, Art *art, int frames, SDL_Color *pPalette, con
void LoadMaskedArt(const char *pszFile, Art *art, int frames, int mask, const std::array<uint8_t, 256> *colorMapping)
{
LoadArt(pszFile, art, frames, nullptr, colorMapping);
if (art->surface == nullptr)
return;
SDL_Surface *surface = art->surface.get();
#if SDL_VERSION_ATLEAST(2, 0, 0)
#ifdef DEVILUTIONX_MASKED_ART_RLE
SDL_SetSurfaceRLE(surface, 1);
#endif
SDL_SetColorKey(surface, SDL_TRUE, mask);
#else
int flags = SDL_SRCCOLORKEY;
#ifdef DEVILUTIONX_MASKED_ART_RLE
flags |= SDL_RLEACCEL;
#endif
SDL_SetColorKey(surface, flags, mask);
#endif
if (art->surface != nullptr)
SDLC_SetColorKey(art->surface.get(), mask);
}
void LoadArt(Art *art, const std::uint8_t *artData, int w, int h, int frames)

9
Source/utils/sdl_compat.h

@ -35,6 +35,15 @@ inline const Uint8 *SDLC_GetKeyState()
#endif
}
inline int SDLC_SetColorKey(SDL_Surface *surface, Uint32 key)
{
#ifdef USE_SDL1
return SDL_SetColorKey(surface, SDL_SRCCOLORKEY, key);
#else
return SDL_SetColorKey(surface, SDL_TRUE, key);
#endif
}
// Copies the colors into the surface's palette.
inline int SDLC_SetSurfaceColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors)
{

Loading…
Cancel
Save