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

@ -36,9 +36,6 @@ class OSystem_SDL_OpenGL : public OSystem_SDL_Common {
public:
OSystem_SDL_OpenGL();
// 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();
@ -87,24 +84,6 @@ OSystem_SDL_OpenGL::OSystem_SDL_OpenGL()
_glWindow.h = 480;
}
void OSystem_SDL_OpenGL::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_OpenGL::load_gfx_mode() {
uint32 Rmask, Gmask, Bmask, Amask;
// I have to force 16 bit color depth with 565 ordering
@ -304,8 +283,6 @@ void OSystem_SDL_OpenGL::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;
@ -342,7 +319,7 @@ void OSystem_SDL_OpenGL::hotswap_gfx_mode() {
void OSystem_SDL_OpenGL::update_screen() {
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) {
@ -541,6 +518,8 @@ bool OSystem_SDL_OpenGL::poll_event(Event *event) {
uint32 OSystem_SDL_OpenGL::property(int param, Property *value) {
StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
if (param == PROP_TOGGLE_FULLSCREEN) {
if (!_usingOpenGL)
assert(_hwscreen != 0);