From e1ca5552ddccf427cf1a0ca84e335b74b183d638 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 2 Jul 2003 15:08:46 +0000 Subject: cleanup; made mutex protection of graphics code a little bit tighter by protecting all of method property(); moved set_palette to OSystem_SDL_Common (it was identical in both normal and GL backend) svn-id: r8717 --- backends/sdl/sdl.cpp | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'backends/sdl/sdl.cpp') diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp index 27616d09f8..4e9cb69bf9 100644 --- a/backends/sdl/sdl.cpp +++ b/backends/sdl/sdl.cpp @@ -29,9 +29,6 @@ class OSystem_SDL : public OSystem_SDL_Common { public: OSystem_SDL(); - // Set colors of the palette - void set_palette(const byte *colors, uint start, uint num); - // Update the dirty areas of the screen void update_screen(); @@ -57,24 +54,6 @@ OSystem_SDL::OSystem_SDL() { } -void OSystem_SDL::set_palette(const byte *colors, uint start, uint num) { - const byte *b = colors; - uint i; - SDL_Color *base = _currentPalette + start; - for (i = 0; i < num; i++) { - base[i].r = b[0]; - base[i].g = b[1]; - base[i].b = b[2]; - b += 4; - } - - if (start < _paletteDirtyStart) - _paletteDirtyStart = start; - - if (start + num > _paletteDirtyEnd) - _paletteDirtyEnd = start + num; -} - void OSystem_SDL::load_gfx_mode() { _forceFull = true; _mode_flags = DF_UPDATE_EXPAND_1_PIXEL; @@ -201,8 +180,6 @@ void OSystem_SDL::hotswap_gfx_mode() { if (!_screen) return; - StackLock lock(_mutex); // Lock the mutex until this function ends - // Keep around the old _screen & _tmpscreen so we can restore the screen data // after the mode switch. SDL_Surface *old_screen = _screen; @@ -233,7 +210,7 @@ void OSystem_SDL::hotswap_gfx_mode() { void OSystem_SDL::update_screen() { assert(_hwscreen != NULL); - StackLock lock(_mutex); // Lock the mutex until this function ends + StackLock lock(_graphicsMutex); // Lock the mutex until this function ends // If the shake position changed, fill the dirty area with blackness if (_currentShakePos != _newShakePos) { @@ -357,6 +334,9 @@ void OSystem_SDL::update_screen() { } uint32 OSystem_SDL::property(int param, Property *value) { + + StackLock lock(_graphicsMutex); // Lock the mutex until this function ends + if (param == PROP_TOGGLE_FULLSCREEN) { assert(_hwscreen != 0); _full_screen ^= true; -- cgit v1.2.3