mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-30 15:31:59 +00:00
Corrected the RGB values generated for a given EGA palette index
svn-id: r30224
This commit is contained in:
parent
b75d196e88
commit
610880dc67
@ -119,14 +119,30 @@ void Palette::convertRgb64Palette(const byte *srcPalette, uint16 srcNumEntries)
|
||||
}
|
||||
}
|
||||
|
||||
// EGA palette definition copied from DOSBox 0.72
|
||||
static byte ega_palette[64][3] =
|
||||
{
|
||||
{0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
|
||||
{0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
|
||||
{0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f},
|
||||
{0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f},
|
||||
{0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
|
||||
{0x00,0x00,0x00}, {0x00,0x00,0x2a}, {0x00,0x2a,0x00}, {0x00,0x2a,0x2a}, {0x2a,0x00,0x00}, {0x2a,0x00,0x2a}, {0x2a,0x15,0x00}, {0x2a,0x2a,0x2a},
|
||||
{0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f},
|
||||
{0x15,0x15,0x15}, {0x15,0x15,0x3f}, {0x15,0x3f,0x15}, {0x15,0x3f,0x3f}, {0x3f,0x15,0x15}, {0x3f,0x15,0x3f}, {0x3f,0x3f,0x15}, {0x3f,0x3f,0x3f}
|
||||
};
|
||||
|
||||
void Palette::convertEGAPalette(const byte *srcPalette) {
|
||||
byte *pDest = _palette->data();
|
||||
const byte *pSrc = srcPalette;
|
||||
|
||||
for (int index = 0; index < 16; ++index, ++pSrc) {
|
||||
*pDest++ = (((*pSrc >> 5) & 1) | ((*pSrc >> 1) & 2)) * 0x55;
|
||||
*pDest++ = (((*pSrc >> 4) & 1) | (*pSrc & 2)) * 0x55;
|
||||
*pDest++ = (((*pSrc >> 3) & 1) | ((*pSrc << 1) & 2)) * 0x55;
|
||||
// Handle RGB components of entry
|
||||
assert(*pSrc < 64);
|
||||
byte *v = &ega_palette[*pSrc][0];
|
||||
*pDest++ = *v++ * 4;
|
||||
*pDest++ = *v++ * 4;
|
||||
*pDest++ = *v++ * 4;
|
||||
*pDest++ = 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user