Skip to content

Commit

Permalink
Prevent redraws till internal buffers are correctly setup
Browse files Browse the repository at this point in the history
  • Loading branch information
pmandin committed Nov 6, 2004
1 parent 9d76ae5 commit 3ea68bf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/video/gem/SDL_gemevents.c
Expand Up @@ -210,7 +210,9 @@ static int do_messages(_THIS, short *message)
SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
break;
case WM_REDRAW:
GEM_wind_redraw(this, message[3],&message[4]);
if (!GEM_lock_redraw) {
GEM_wind_redraw(this, message[3],&message[4]);
}
break;
case WM_ICONIFY:
case WM_ALLICONIFY:
Expand Down Expand Up @@ -240,8 +242,9 @@ static int do_messages(_THIS, short *message)
break;
case WM_SIZED:
wind_set (message[3], WF_CURRXYWH, message[4], message[5], message[6], message[7]);
GEM_win_fulled = SDL_FALSE; /* Cancel maximized flag */
wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2);
GEM_win_fulled = SDL_FALSE; /* Cancel maximized flag */
GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers resized */
SDL_PrivateResize(w2, h2);
break;
case WM_FULLED:
Expand All @@ -260,6 +263,7 @@ static int do_messages(_THIS, short *message)
}
wind_set (message[3], WF_CURRXYWH, x, y, w, h);
wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2);
GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers resized */
SDL_PrivateResize(w2, h2);
}
break;
Expand Down
10 changes: 10 additions & 0 deletions src/video/gem/SDL_gemvideo.c
Expand Up @@ -401,6 +401,7 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
GEM_locked = SDL_FALSE;
GEM_win_fulled = SDL_FALSE;
GEM_fullscreen = SDL_FALSE;
GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers are setup */

VDI_screen = NULL;
VDI_pitch = VDI_w * VDI_pixelsize;
Expand Down Expand Up @@ -720,6 +721,7 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
#endif

this->UpdateRects = GEM_UpdateRects;
GEM_lock_redraw = SDL_FALSE; /* Enable redraw */

/* We're done */
return(current);
Expand Down Expand Up @@ -858,6 +860,10 @@ static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
{
SDL_Surface *surface;

if (GEM_lock_redraw) {
return;
}

surface = this->screen;

if (surface->flags & SDL_FULLSCREEN) {
Expand Down Expand Up @@ -951,6 +957,10 @@ static int GEM_FlipHWSurfaceWindowed(_THIS, SDL_Surface *surface)

static int GEM_FlipHWSurface(_THIS, SDL_Surface *surface)
{
if (GEM_lock_redraw) {
return(0);
}

if (surface->flags & SDL_FULLSCREEN) {
return GEM_FlipHWSurfaceFullscreen(this, surface);
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/video/gem/SDL_gemvideo.h
Expand Up @@ -79,6 +79,7 @@ struct SDL_PrivateVideoData {
SDL_bool window_fulled; /* Window maximized ? */
SDL_bool mouse_relative; /* Report relative mouse movement */
SDL_bool locked; /* AES locked for fullscreen ? */
SDL_bool lock_redraw; /* Prevent redraw till buffers are setup */
short message[8]; /* To self-send an AES message */

SDL_bool fullscreen; /* Fullscreen or windowed mode ? */
Expand Down Expand Up @@ -120,6 +121,7 @@ struct SDL_PrivateVideoData {
#define GEM_win_fulled (this->hidden->window_fulled)
#define GEM_mouse_relative (this->hidden->mouse_relative)
#define GEM_locked (this->hidden->locked)
#define GEM_lock_redraw (this->hidden->lock_redraw)
#define GEM_message (this->hidden->message)
#define SDL_modelist (this->hidden->SDL_modelist)
#define GEM_icon (this->hidden->icon)
Expand Down

0 comments on commit 3ea68bf

Please sign in to comment.