atari:gem: Add GEM_ClearRectXYWH to clear rectangle with x,y,w*h coordinates. Rename pxy array to rect to distinguish pxy (x1,y1,x2,y2) from rect (x,y,w*h) coords. SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Sat, 07 Oct 2017 00:30:13 +0200
branchSDL-1.2
changeset 11569eacc3725d279
parent 11568 6fbdeeef1935
child 11570 60e525aa9a73
atari:gem: Add GEM_ClearRectXYWH to clear rectangle with x,y,w*h coordinates. Rename pxy array to rect to distinguish pxy (x1,y1,x2,y2) from rect (x,y,w*h) coords.
src/video/gem/SDL_gemevents.c
src/video/gem/SDL_gemvideo.c
     1.1 --- a/src/video/gem/SDL_gemevents.c	Sat Oct 07 00:10:57 2017 +0200
     1.2 +++ b/src/video/gem/SDL_gemevents.c	Sat Oct 07 00:30:13 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, iconified, sdl_resize;
     1.8 +	int quit, update_work_area, sdl_resize;
     1.9  
    1.10 -	quit = update_work_area = iconified = sdl_resize = 0;
    1.11 +	quit = update_work_area = sdl_resize = 0;
    1.12  	switch (message[0]) {
    1.13  		case MSG_SDL_ID:
    1.14  			quit=(message[1] == latest_msg_id);
     2.1 --- a/src/video/gem/SDL_gemvideo.c	Sat Oct 07 00:10:57 2017 +0200
     2.2 +++ b/src/video/gem/SDL_gemvideo.c	Sat Oct 07 00:30:13 2017 +0200
     2.3 @@ -93,7 +93,8 @@
     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_ClearRect(_THIS, short *pxy);
     2.9 +static void GEM_ClearRectXYWH(_THIS, short *rect);
    2.10  static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3]);
    2.11  static void GEM_LockScreen(_THIS);
    2.12  static void GEM_UnlockScreen(_THIS);
    2.13 @@ -501,21 +502,33 @@
    2.14  	}
    2.15  }
    2.16  
    2.17 -void GEM_ClearRect(_THIS, short *rect)
    2.18 +void GEM_ClearRect(_THIS, short *pxy)
    2.19  {
    2.20  	short oldrgb[3], rgb[3]={0,0,0};
    2.21  
    2.22 -	vq_color(VDI_handle, vdi_index[0], 0, oldrgb);
    2.23 +	vq_color(VDI_handle, vdi_index[0], 1, oldrgb);
    2.24  	vs_color(VDI_handle, vdi_index[0], rgb);
    2.25  
    2.26  	vsf_color(VDI_handle,0);
    2.27  	vsf_interior(VDI_handle,1);
    2.28  	vsf_perimeter(VDI_handle,0);
    2.29 -	v_bar(VDI_handle, rect);
    2.30 +	v_bar(VDI_handle, pxy);
    2.31  
    2.32  	vs_color(VDI_handle, vdi_index[0], oldrgb);
    2.33  }
    2.34  
    2.35 +void GEM_ClearRectXYWH(_THIS, short *rect)
    2.36 +{
    2.37 +	short pxy[4];
    2.38 +
    2.39 +	pxy[0] = rect[0];
    2.40 +	pxy[1] = rect[1];
    2.41 +	pxy[2] = rect[0]+rect[2]-1;
    2.42 +	pxy[3] = rect[1]+rect[3]-1;
    2.43 +
    2.44 +	GEM_ClearRect(this, pxy);
    2.45 +}
    2.46 +
    2.47  static void GEM_ClearScreen(_THIS)
    2.48  {
    2.49  	short pxy[4];
    2.50 @@ -761,7 +774,7 @@
    2.51  
    2.52  			/* Align work area on 16 pixels boundary (faster for bitplanes modes) */
    2.53  			wind_calc(WC_WORK, GEM_win_type, x2,y2,w2,h2, &x2,&y2,&w2,&h2);
    2.54 -			x2 &= -16;
    2.55 +			x2 &= ~15;
    2.56  			x2 -= 8;
    2.57  			wind_calc(WC_BORDER, GEM_win_type, x2,y2,w2,h2, &x2,&y2,&w2,&h2);
    2.58  
    2.59 @@ -860,7 +873,7 @@
    2.60  		new_w -= 16;
    2.61  	}
    2.62  	new_w -= (new_x - GEM_work_x);
    2.63 -	new_w &= -16;
    2.64 +	new_w &= ~15;
    2.65  
    2.66  	if (clear_pads) {
    2.67  		short pxy[4];
    2.68 @@ -988,16 +1001,16 @@
    2.69  
    2.70  static void GEM_UpdateRectsWindowed(_THIS, int numrects, SDL_Rect *rects)
    2.71  {
    2.72 -	short pxy[4];
    2.73 +	short rect[4];
    2.74  	int i;
    2.75  
    2.76  	for ( i=0; i<numrects; ++i ) {
    2.77 -		pxy[0] = GEM_work_x + rects[i].x;
    2.78 -		pxy[1] = GEM_work_y + rects[i].y;
    2.79 -		pxy[2] = rects[i].w;
    2.80 -		pxy[3] = rects[i].h;
    2.81 +		rect[0] = GEM_work_x + rects[i].x;
    2.82 +		rect[1] = GEM_work_y + rects[i].y;
    2.83 +		rect[2] = rects[i].w;
    2.84 +		rect[3] = rects[i].h;
    2.85  
    2.86 -		GEM_wind_redraw(this, GEM_handle, pxy);
    2.87 +		GEM_wind_redraw(this, GEM_handle, rect);
    2.88  	}
    2.89  }
    2.90  
    2.91 @@ -1079,15 +1092,15 @@
    2.92  
    2.93  static int GEM_FlipHWSurfaceWindowed(_THIS, SDL_Surface *surface)
    2.94  {
    2.95 -	short pxy[4];
    2.96 +	short rect[4];
    2.97  
    2.98  	/* Update the whole window */
    2.99 -	pxy[0] = GEM_work_x;
   2.100 -	pxy[1] = GEM_work_y;
   2.101 -	pxy[2] = GEM_work_w;
   2.102 -	pxy[3] = GEM_work_h;
   2.103 +	rect[0] = GEM_work_x;
   2.104 +	rect[1] = GEM_work_y;
   2.105 +	rect[2] = GEM_work_w;
   2.106 +	rect[3] = GEM_work_h;
   2.107  
   2.108 -	GEM_wind_redraw(this, GEM_handle, pxy);
   2.109 +	GEM_wind_redraw(this, GEM_handle, rect);
   2.110  
   2.111  	return(0);
   2.112  }
   2.113 @@ -1361,12 +1374,12 @@
   2.114  		mfdb_src.fd_w=width;
   2.115  	}
   2.116  	mfdb_src.fd_h=surface->h;
   2.117 -  	mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
   2.118 +	mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
   2.119  	mfdb_src.fd_wdwidth=mfdb_src.fd_w>>4;
   2.120  	mfdb_src.fd_stand=
   2.121  		mfdb_src.fd_r1=
   2.122 -  		mfdb_src.fd_r2=
   2.123 -	  	mfdb_src.fd_r3= 0;
   2.124 +		mfdb_src.fd_r2=
   2.125 +		mfdb_src.fd_r3= 0;
   2.126  
   2.127  	if (GEM_bufops & B2S_VROCPYFM_2TOS) {
   2.128  		mfdb_src.fd_addr=GEM_buffer2;