atari:gem: Align window content on 16 pixels boundary (faster for bitplanes modes). Make GEM_clear_rect public function to clear the visible extra space. SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Sat, 30 Sep 2017 22:06:30 +0200
branchSDL-1.2
changeset 11559a330adcd0490
parent 11558 560392acace0
child 11560 c267eabdc97f
atari:gem: Align window content on 16 pixels boundary (faster for bitplanes modes). Make GEM_clear_rect public function to clear the visible extra space.
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 Sep 30 21:33:36 2017 +0200
     1.2 +++ b/src/video/gem/SDL_gemevents.c	Sat Sep 30 22:06:30 2017 +0200
     1.3 @@ -187,9 +187,9 @@
     1.4  
     1.5  static int do_messages(_THIS, short *message, short latest_msg_id)
     1.6  {
     1.7 -	int quit, update_work_area, sdl_resize;
     1.8 +	int quit, update_work_area, align_work_area, sdl_resize;
     1.9  
    1.10 -	quit = update_work_area = sdl_resize = 0;
    1.11 +	quit = update_work_area = align_work_area = sdl_resize = 0;
    1.12  	switch (message[0]) {
    1.13  		case MSG_SDL_ID:
    1.14  			quit=(message[1] == latest_msg_id);
    1.15 @@ -201,7 +201,7 @@
    1.16  			break;
    1.17  		case WM_MOVED:
    1.18  			wind_set(message[3],WF_CURRXYWH,message[4],message[5],message[6],message[7]);
    1.19 -			update_work_area = 1;
    1.20 +			update_work_area = align_work_area = 1;
    1.21  			break;
    1.22  		case WM_TOPPED:
    1.23  			wind_set(message[3],WF_TOP,message[4],0,0,0);
    1.24 @@ -249,11 +249,11 @@
    1.25  					0,0);
    1.26  				GEM_refresh_name = SDL_FALSE;
    1.27  			}
    1.28 -			update_work_area = 1;
    1.29 +			update_work_area = align_work_area = 1;
    1.30  			break;
    1.31  		case WM_SIZED:
    1.32  			wind_set (message[3], WF_CURRXYWH, message[4], message[5], message[6], message[7]);
    1.33 -			update_work_area = sdl_resize = 1;
    1.34 +			update_work_area = align_work_area = sdl_resize = 1;
    1.35  			GEM_win_fulled = SDL_FALSE;		/* Cancel maximized flag */
    1.36  			GEM_lock_redraw = SDL_TRUE;		/* Prevent redraw till buffers resized */
    1.37  			break;
    1.38 @@ -272,7 +272,7 @@
    1.39  					GEM_win_fulled = SDL_TRUE;
    1.40  				}
    1.41  				wind_set (message[3], WF_CURRXYWH, x, y, w, h);
    1.42 -				update_work_area = sdl_resize = 1;
    1.43 +				update_work_area = align_work_area = sdl_resize = 1;
    1.44  				GEM_lock_redraw = SDL_TRUE;		/* Prevent redraw till buffers resized */
    1.45  			}
    1.46  			break;
    1.47 @@ -289,6 +289,26 @@
    1.48  
    1.49  	if (update_work_area) {
    1.50  		wind_get (message[3], WF_WORKXYWH, &GEM_work_x, &GEM_work_y, &GEM_work_w, &GEM_work_h);
    1.51 +
    1.52 +		/* Align work area on 16 pixels boundary (faster for bitplanes modes) */
    1.53 +		if (align_work_area) {
    1.54 +			int aligned_x;
    1.55 +			short pxy[4];
    1.56 +
    1.57 +			aligned_x = GEM_work_x;
    1.58 +			if (aligned_x & 15) {
    1.59 +				aligned_x = (aligned_x|15)+1;
    1.60 +
    1.61 +				pxy[0] = GEM_work_x;
    1.62 +				pxy[1] = GEM_work_y;
    1.63 +				pxy[2] = aligned_x - 1;
    1.64 +				pxy[3] = pxy[1] + GEM_work_h - 1;
    1.65 +				GEM_clear_rect(this, pxy);
    1.66 +			}
    1.67 +			GEM_work_w -= (aligned_x - GEM_work_x);
    1.68 +			GEM_work_x = aligned_x;
    1.69 +		}
    1.70 +
    1.71  		if (sdl_resize) {
    1.72  			SDL_PrivateResize(GEM_work_w, GEM_work_h);
    1.73  		}
     2.1 --- a/src/video/gem/SDL_gemvideo.c	Sat Sep 30 21:33:36 2017 +0200
     2.2 +++ b/src/video/gem/SDL_gemvideo.c	Sat Sep 30 22:06:30 2017 +0200
     2.3 @@ -93,7 +93,6 @@
     2.4  /* Internal functions */
     2.5  static void GEM_FreeBuffers(_THIS);
     2.6  static void GEM_ClearScreen(_THIS);
     2.7 -static void GEM_ClearRect(_THIS, short *rect);
     2.8  static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3]);
     2.9  static void GEM_LockScreen(_THIS);
    2.10  static void GEM_UnlockScreen(_THIS);
    2.11 @@ -500,7 +499,7 @@
    2.12  	}
    2.13  }
    2.14  
    2.15 -static void GEM_ClearRect(_THIS, short *rect)
    2.16 +void GEM_clear_rect(_THIS, short *rect)
    2.17  {
    2.18  	short oldrgb[3], rgb[3]={0,0,0};
    2.19  
    2.20 @@ -524,7 +523,7 @@
    2.21  	pxy[0] = pxy[1] = 0;
    2.22  	pxy[2] = VDI_w - 1;
    2.23  	pxy[3] = VDI_h - 1;
    2.24 -	GEM_ClearRect(this, pxy);
    2.25 +	GEM_clear_rect(this, pxy);
    2.26  
    2.27  	v_show_c(VDI_handle, 1);
    2.28  }
    2.29 @@ -1204,7 +1203,7 @@
    2.30  
    2.31  		surface = GEM_icon;
    2.32  
    2.33 -		GEM_ClearRect(this, rect);
    2.34 +		GEM_clear_rect(this, rect);
    2.35  
    2.36  		/* Calculate centered icon(x,y,w,h) relative to window */
    2.37  		iconx = (wind_pxy[2]-surface->w)>>1;
     3.1 --- a/src/video/gem/SDL_gemvideo.h	Sat Sep 30 21:33:36 2017 +0200
     3.2 +++ b/src/video/gem/SDL_gemvideo.h	Sat Sep 30 22:06:30 2017 +0200
     3.3 @@ -37,6 +37,7 @@
     3.4  
     3.5  /* Functions prototypes */
     3.6  void GEM_wind_redraw(_THIS, int winhandle, short *inside);
     3.7 +void GEM_clear_rect(_THIS, short *rect);
     3.8  
     3.9  /* Private display data */
    3.10