atari:gem: Handle padding redraw when moving window behind other windows SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Sat, 07 Oct 2017 12:00:04 +0200
branchSDL-1.2
changeset 11576b3255371e439
parent 11571 49fa2a49574b
child 11580 b28174b10269
atari:gem: Handle padding redraw when moving window behind other windows
src/video/gem/SDL_gemevents.c
src/video/gem/SDL_gemvideo.c
src/video/gem/SDL_gemvideo.h
     1.1 --- a/src/video/gem/SDL_gemevents.c	Sat Oct 07 00:40:47 2017 +0200
     1.2 +++ b/src/video/gem/SDL_gemevents.c	Sat Oct 07 12:00:04 2017 +0200
     1.3 @@ -214,7 +214,7 @@
     1.4  			break;
     1.5  		case WM_REDRAW:
     1.6  			if (!GEM_lock_redraw) {
     1.7 -				GEM_wind_redraw(this, message[3],&message[4]);
     1.8 +				GEM_wind_redraw(this, message[3], &message[4], SDL_FALSE);
     1.9  			}
    1.10  			break;
    1.11  		case WM_ICONIFY:
    1.12 @@ -290,7 +290,7 @@
    1.13  	}
    1.14  
    1.15  	if (update_work_area) {
    1.16 -		GEM_align_work_area(this, message[3], 1);
    1.17 +		GEM_align_work_area(this, message[3], SDL_TRUE);
    1.18  
    1.19  		if (sdl_resize) {
    1.20  			SDL_PrivateResize(GEM_work_w, GEM_work_h);
     2.1 --- a/src/video/gem/SDL_gemvideo.c	Sat Oct 07 00:40:47 2017 +0200
     2.2 +++ b/src/video/gem/SDL_gemvideo.c	Sat Oct 07 12:00:04 2017 +0200
     2.3 @@ -98,7 +98,7 @@
     2.4  static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3]);
     2.5  static void GEM_LockScreen(_THIS);
     2.6  static void GEM_UnlockScreen(_THIS);
     2.7 -static void refresh_window(_THIS, int winhandle, short *rect);
     2.8 +static void refresh_window(_THIS, int winhandle, short *rect, SDL_bool pad_only);
     2.9  
    2.10  #if SDL_VIDEO_OPENGL
    2.11  /* OpenGL functions */
    2.12 @@ -855,9 +855,9 @@
    2.13  	return(current);
    2.14  }
    2.15  
    2.16 -void GEM_align_work_area(_THIS, short windowid, int clear_pads)
    2.17 +void GEM_align_work_area(_THIS, short windowid, SDL_bool clear_pads)
    2.18  {
    2.19 -	int new_x, new_w;
    2.20 +	int new_x, new_w, old_x, old_w;
    2.21  
    2.22  	wind_get(windowid, WF_WORKXYWH, &GEM_work_x,&GEM_work_y,&GEM_work_w,&GEM_work_h);
    2.23  	if (GEM_iconified) {
    2.24 @@ -865,8 +865,8 @@
    2.25  	}
    2.26  
    2.27  	/* Align work area on 16 pixels boundary (faster for bitplanes modes) */
    2.28 -	new_x = GEM_work_x;
    2.29 -	new_w = GEM_work_w;
    2.30 +	new_x = old_x = GEM_work_x;
    2.31 +	new_w = old_w = GEM_work_w;
    2.32  	if (new_x & 15) {
    2.33  		new_x = (new_x|15)+1;
    2.34  	} else {
    2.35 @@ -875,6 +875,9 @@
    2.36  	new_w -= (new_x - GEM_work_x);
    2.37  	new_w &= ~15;
    2.38  
    2.39 +	GEM_work_x = new_x;
    2.40 +	GEM_work_w = new_w;
    2.41 +
    2.42  	if (clear_pads) {
    2.43  		short rect[4];
    2.44  
    2.45 @@ -882,18 +885,15 @@
    2.46  		rect[3] = GEM_work_h;
    2.47  
    2.48  		/* Left padding */
    2.49 -		rect[0] = GEM_work_x;
    2.50 -		rect[2] = new_x-GEM_work_x+1;
    2.51 -		GEM_ClearRectXYWH(this, rect);
    2.52 +		rect[0] = old_x;
    2.53 +		rect[2] = new_x-old_x+1;
    2.54 +		GEM_wind_redraw(this, GEM_handle, rect, SDL_TRUE);
    2.55  
    2.56  		/* Right padding */
    2.57  		rect[0] = new_x + new_w;
    2.58 -		rect[2] = (GEM_work_w-new_w)-(new_x-GEM_work_x)+1;
    2.59 -		GEM_ClearRectXYWH(this, rect);
    2.60 +		rect[2] = (old_w-new_w)-(new_x-old_x)+1;
    2.61 +		GEM_wind_redraw(this, GEM_handle, rect, SDL_TRUE);
    2.62  	}
    2.63 -
    2.64 -	GEM_work_w = new_w;
    2.65 -	GEM_work_x = new_x;
    2.66  }
    2.67  
    2.68  static int GEM_AllocHWSurface(_THIS, SDL_Surface *surface)
    2.69 @@ -1006,7 +1006,7 @@
    2.70  		rect[2] = rects[i].w;
    2.71  		rect[3] = rects[i].h;
    2.72  
    2.73 -		GEM_wind_redraw(this, GEM_handle, rect);
    2.74 +		GEM_wind_redraw(this, GEM_handle, rect, SDL_FALSE);
    2.75  	}
    2.76  }
    2.77  
    2.78 @@ -1096,7 +1096,7 @@
    2.79  	rect[2] = GEM_work_w;
    2.80  	rect[3] = GEM_work_h;
    2.81  
    2.82 -	GEM_wind_redraw(this, GEM_handle, rect);
    2.83 +	GEM_wind_redraw(this, GEM_handle, rect, SDL_FALSE);
    2.84  
    2.85  	return(0);
    2.86  }
    2.87 @@ -1203,7 +1203,7 @@
    2.88  	this->screen->pixels = NULL;
    2.89  }
    2.90  
    2.91 -void GEM_wind_redraw(_THIS, int winhandle, short *inside)
    2.92 +void GEM_wind_redraw(_THIS, int winhandle, short *inside, SDL_bool pad_only)
    2.93  {
    2.94  	short todo[4];
    2.95  
    2.96 @@ -1218,7 +1218,7 @@
    2.97  		while (todo[2] && todo[3]) {
    2.98  
    2.99  			if (rc_intersect((GRECT *)inside,(GRECT *)todo)) {
   2.100 -				refresh_window(this, winhandle, todo);
   2.101 +				refresh_window(this, winhandle, todo, pad_only);
   2.102  			}
   2.103  
   2.104  			if (wind_get(winhandle, WF_NEXTXYWH, &todo[0], &todo[1], &todo[2], &todo[3])==0) {
   2.105 @@ -1234,7 +1234,7 @@
   2.106  	v_show_c(VDI_handle,1);
   2.107  }
   2.108  
   2.109 -static void refresh_window(_THIS, int winhandle, short *rect)
   2.110 +static void refresh_window(_THIS, int winhandle, short *rect, SDL_bool pad_only)
   2.111  {
   2.112  	MFDB mfdb_src;
   2.113  	short pxy[8], work_rect[4];
   2.114 @@ -1286,7 +1286,7 @@
   2.115  	}
   2.116  
   2.117  	/* Do we intersect zone to redraw ? */
   2.118 -	if (!rc_intersect((GRECT *)work_rect, (GRECT *)rect)) {
   2.119 +	if (pad_only || !rc_intersect((GRECT *)work_rect, (GRECT *)rect)) {
   2.120  		return;
   2.121  	}
   2.122  
     3.1 --- a/src/video/gem/SDL_gemvideo.h	Sat Oct 07 00:40:47 2017 +0200
     3.2 +++ b/src/video/gem/SDL_gemvideo.h	Sat Oct 07 12:00:04 2017 +0200
     3.3 @@ -36,8 +36,8 @@
     3.4  #define _THIS	SDL_VideoDevice *this
     3.5  
     3.6  /* Functions prototypes */
     3.7 -void GEM_wind_redraw(_THIS, int winhandle, short *inside);
     3.8 -void GEM_align_work_area(_THIS, short windowid, int clear_pads);
     3.9 +void GEM_wind_redraw(_THIS, int winhandle, short *inside, SDL_bool pad_only);
    3.10 +void GEM_align_work_area(_THIS, short windowid, SDL_bool clear_pads);
    3.11  
    3.12  /* Private display data */
    3.13