Browse Source

Remove byte order logic from half-transparency lookups

pull/6938/head
staphen 2 years ago committed by Gleb Mazovetskiy
parent
commit
c70c983620
  1. 4
      Source/engine.cpp
  2. 4
      Source/engine/palette.cpp

4
Source/engine.cpp

@ -52,11 +52,7 @@ void DrawHalfTransparentAligned32BlendedRectTo(const Surface &out, unsigned sx,
while (height-- > 0) {
for (unsigned i = 0; i < width; ++i, ++pix) {
const uint32_t v = *pix;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
*pix = lookupTable[v & 0xFFFF] | (lookupTable[(v >> 16) & 0xFFFF] << 16);
#else
*pix = lookupTable[(v >> 16) & 0xFFFF] | (lookupTable[v & 0xFFFF] << 16);
#endif
}
pix += skipX;
}

4
Source/engine/palette.cpp

@ -103,11 +103,7 @@ void GenerateBlendedLookupTable(std::array<SDL_Color, 256> &palette, int skipFro
#if DEVILUTIONX_PALETTE_TRANSPARENCY_BLACK_16_LUT
for (unsigned i = 0; i < 256; ++i) {
for (unsigned j = 0; j < 256; ++j) {
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
const std::uint16_t index = i | (j << 8);
#else
const std::uint16_t index = j | (i << 8);
#endif
paletteTransparencyLookupBlack16[index] = paletteTransparencyLookup[0][i] | (paletteTransparencyLookup[0][j] << 8);
}
}

Loading…
Cancel
Save