SDL: Adapt SDL graphics module to the setPalette/grabPalette RGBA->RGB change.

This commit is contained in:
Johannes Schickel 2011-02-13 14:37:19 +01:00
parent 18ff02a2fa
commit 813f503884

View File

@ -1337,11 +1337,10 @@ void SdlGraphicsManager::setPalette(const byte *colors, uint start, uint num) {
const byte *b = colors; const byte *b = colors;
uint i; uint i;
SDL_Color *base = _currentPalette + start; SDL_Color *base = _currentPalette + start;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++, b += 3) {
base[i].r = b[0]; base[i].r = b[0];
base[i].g = b[1]; base[i].g = b[1];
base[i].b = b[2]; base[i].b = b[2];
b += 4;
} }
if (start < _paletteDirtyStart) if (start < _paletteDirtyStart)
@ -1365,10 +1364,9 @@ void SdlGraphicsManager::grabPalette(byte *colors, uint start, uint num) {
const SDL_Color *base = _currentPalette + start; const SDL_Color *base = _currentPalette + start;
for (uint i = 0; i < num; ++i) { for (uint i = 0; i < num; ++i) {
colors[i * 4] = base[i].r; colors[i * 3] = base[i].r;
colors[i * 4 + 1] = base[i].g; colors[i * 3 + 1] = base[i].g;
colors[i * 4 + 2] = base[i].b; colors[i * 3 + 2] = base[i].b;
colors[i * 4 + 3] = 0xFF;
} }
} }
@ -1377,11 +1375,10 @@ void SdlGraphicsManager::setCursorPalette(const byte *colors, uint start, uint n
const byte *b = colors; const byte *b = colors;
uint i; uint i;
SDL_Color *base = _cursorPalette + start; SDL_Color *base = _cursorPalette + start;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++, b += 3) {
base[i].r = b[0]; base[i].r = b[0];
base[i].g = b[1]; base[i].g = b[1];
base[i].b = b[2]; base[i].b = b[2];
b += 4;
} }
_cursorPaletteDisabled = false; _cursorPaletteDisabled = false;