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
This commit is contained in:
Max Horn 2003-07-02 15:08:46 +00:00
parent 5b71113dcb
commit e1ca5552dd
4 changed files with 34 additions and 57 deletions

View file

@ -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;