diff options
author | Bastien Bouclet | 2011-06-26 10:35:40 +0200 |
---|---|---|
committer | Bastien Bouclet | 2011-07-02 22:01:45 +0200 |
commit | a360a64dd744c922232e1f0d9a1b35a782bd572c (patch) | |
tree | 14ba8148290b53e2bc2937365f09b1cbac50a140 /backends | |
parent | 09501be85bee9f686a7815fc0f47a1e16008f38d (diff) | |
download | scummvm-rg350-a360a64dd744c922232e1f0d9a1b35a782bd572c.tar.gz scummvm-rg350-a360a64dd744c922232e1f0d9a1b35a782bd572c.tar.bz2 scummvm-rg350-a360a64dd744c922232e1f0d9a1b35a782bd572c.zip |
SDL: Set a black palette by default.
This fixes white flashing screens when using SDL 1.3.
SDL 1.3 palettes are all white by default, whereas
SDL 1.2 palettes are all black ...
Diffstat (limited to 'backends')
-rw-r--r-- | backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 66207b6808..3739cb28fc 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -157,6 +157,12 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou _currentPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256); _cursorPalette = (SDL_Color *)calloc(sizeof(SDL_Color), 256); + // Init palette with black : + // SDL 1.2 palettes default to all black, + // SDL 1.3 palettes default to all white, + // thus we have to set our own default. + memset(_currentPalette, 0, sizeof(SDL_Color) * 256); + _mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0; memset(&_mouseCurState, 0, sizeof(_mouseCurState)); @@ -752,6 +758,9 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() { error("allocating _screen failed"); #endif + // Set a default palette. SDL_SetColors does nothing for non indexed surfaces. + SDL_SetColors(_screen, _currentPalette, 0, 256); + // // Create the surface that contains the scaled graphics in 16 bit mode // |