src/video/gem/SDL_gemevents.c
branchSDL-1.2
changeset 11559 a330adcd0490
parent 11558 560392acace0
child 11560 c267eabdc97f
     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  		}