SDL will center surface on screen for us
authorPatrice Mandin <patmandin@gmail.com>
Mon, 06 Jun 2005 16:36:18 +0000
changeset 107124470ffe8ee4
parent 1070 75e8378103a9
child 1072 5dbcac12f22b
SDL will center surface on screen for us
src/video/gem/SDL_gemvideo.c
src/video/xbios/SDL_xbios.c
     1.1 --- a/src/video/gem/SDL_gemvideo.c	Mon Jun 06 10:45:53 2005 +0000
     1.2 +++ b/src/video/gem/SDL_gemvideo.c	Mon Jun 06 16:36:18 2005 +0000
     1.3 @@ -777,8 +777,6 @@
     1.4  		current->pitch = width * VDI_pixelsize;
     1.5  	} else {
     1.6  		current->pixels = VDI_screen;
     1.7 -		current->pixels += VDI_pitch * ((VDI_h - height) >> 1);
     1.8 -		current->pixels += VDI_pixelsize * ((VDI_w - width) >> 1);
     1.9  		current->pitch = VDI_pitch;
    1.10  	}
    1.11  
    1.12 @@ -844,13 +842,7 @@
    1.13  		int destpitch;
    1.14  
    1.15  		if (GEM_bufops & B2S_C2P_1TOS) {
    1.16 -			int destx;
    1.17 -
    1.18  			destscr = VDI_screen;
    1.19 -			destscr += VDI_pitch * ((VDI_h - surface->h) >> 1);
    1.20 -			destx = (VDI_w - surf_width) >> 1;
    1.21 -			destx &= ~15;
    1.22 -			destscr += destx;
    1.23  			destpitch = VDI_pitch;
    1.24  		} else {
    1.25  			destscr = GEM_buffer2;
    1.26 @@ -902,15 +894,10 @@
    1.27  		}
    1.28  
    1.29  		for ( i=0; i<numrects; ++i ) {
    1.30 -			blitcoords[0] = rects[i].x;
    1.31 -			blitcoords[1] = rects[i].y;
    1.32 -			blitcoords[2] = blitcoords[0] + rects[i].w - 1;
    1.33 -			blitcoords[3] = blitcoords[1] + rects[i].h - 1;
    1.34 -
    1.35 -			blitcoords[4] = rects[i].x + ((VDI_w - surface->w) >> 1);
    1.36 -			blitcoords[5] = rects[i].y + ((VDI_h - surface->h) >> 1);
    1.37 -			blitcoords[6] = blitcoords[4] + rects[i].w - 1;
    1.38 -			blitcoords[7] = blitcoords[5] + rects[i].h - 1;
    1.39 +			blitcoords[0] = blitcoords[4] = rects[i].x;
    1.40 +			blitcoords[1] = blitcoords[5] = rects[i].y;
    1.41 +			blitcoords[2] = blitcoords[6] = rects[i].x + rects[i].w - 1;
    1.42 +			blitcoords[3] = blitcoords[7] = rects[i].y + rects[i].h - 1;
    1.43  
    1.44  			vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
    1.45  		}
    1.46 @@ -968,13 +955,7 @@
    1.47  		int destpitch;
    1.48  
    1.49  		if (GEM_bufops & B2S_C2P_1TOS) {
    1.50 -			int destx;
    1.51 -
    1.52  			destscr = VDI_screen;
    1.53 -			destscr += VDI_pitch * ((VDI_h - surface->h) >> 1);
    1.54 -			destx = (VDI_w - surf_width) >> 1;
    1.55 -			destx &= ~15;
    1.56 -			destscr += destx;
    1.57  			destpitch = VDI_pitch;
    1.58  		} else {
    1.59  			destscr = GEM_buffer2;
    1.60 @@ -1007,15 +988,10 @@
    1.61  			mfdb_src.fd_addr=GEM_buffer2;
    1.62  		}
    1.63  
    1.64 -		blitcoords[0] = 0;
    1.65 -		blitcoords[1] = 0;
    1.66 -		blitcoords[2] = surface->w - 1;
    1.67 -		blitcoords[3] = surface->h - 1;
    1.68 -
    1.69 -		blitcoords[4] = (VDI_w - surface->w) >> 1;
    1.70 -		blitcoords[5] = (VDI_h - surface->h) >> 1;
    1.71 -		blitcoords[6] = blitcoords[4] + surface->w - 1;
    1.72 -		blitcoords[7] = blitcoords[5] + surface->h - 1;
    1.73 +		blitcoords[0] = blitcoords[4] = 0;
    1.74 +		blitcoords[1] = blitcoords[5] = 0;
    1.75 +		blitcoords[2] = blitcoords[6] = surface->w - 1;
    1.76 +		blitcoords[3] = blitcoords[7] = surface->h - 1;
    1.77  
    1.78  		vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
    1.79  	}
     2.1 --- a/src/video/xbios/SDL_xbios.c	Mon Jun 06 10:45:53 2005 +0000
     2.2 +++ b/src/video/xbios/SDL_xbios.c	Mon Jun 06 16:36:18 2005 +0000
     2.3 @@ -727,17 +727,8 @@
     2.4  	surface = this->screen;
     2.5  
     2.6  	if ((surface->format->BitsPerPixel) == 8) {
     2.7 -		void *destscr;
     2.8 -		int destx;
     2.9  		int i;
    2.10  
    2.11 -		/* Center on destination screen */
    2.12 -		destscr = XBIOS_screens[XBIOS_fbnum];
    2.13 -		destscr += XBIOS_pitch * ((XBIOS_height - surface->h) >> 1);
    2.14 -		destx = (XBIOS_width - surface->w) >> 1;
    2.15 -		destx &= ~15;
    2.16 -		destscr += destx;
    2.17 -
    2.18  		for (i=0;i<numrects;i++) {
    2.19  			void *source,*destination;
    2.20  			int x1,x2;
    2.21 @@ -752,19 +743,16 @@
    2.22  			source += surface->pitch * rects[i].y;
    2.23  			source += x1;
    2.24  
    2.25 -			destination = destscr;
    2.26 +			destination = XBIOS_screens[XBIOS_fbnum];
    2.27  			destination += XBIOS_pitch * rects[i].y;
    2.28  			destination += x1;
    2.29  
    2.30  			/* Convert chunky to planar screen */
    2.31  			SDL_Atari_C2pConvert(
    2.32 -				source,
    2.33 -				destination,
    2.34 -				x2-x1,
    2.35 -				rects[i].h,
    2.36 +				source, destination,
    2.37 +				x2-x1, rects[i].h,
    2.38  				XBIOS_doubleline,
    2.39 -				surface->pitch,
    2.40 -				XBIOS_pitch
    2.41 +				surface->pitch, XBIOS_pitch
    2.42  			);
    2.43  		}
    2.44  	}
    2.45 @@ -785,25 +773,12 @@
    2.46  static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface)
    2.47  {
    2.48  	if ((surface->format->BitsPerPixel) == 8) {
    2.49 -		void *destscr;
    2.50 -		int destx;
    2.51 -			
    2.52 -		/* Center on destination screen */
    2.53 -		destscr = XBIOS_screens[XBIOS_fbnum];
    2.54 -		destscr += XBIOS_pitch * ((XBIOS_height - surface->h) >> 1);
    2.55 -		destx = (XBIOS_width - surface->w) >> 1;
    2.56 -		destx &= ~15;
    2.57 -		destscr += destx;
    2.58 -
    2.59  		/* Convert chunky to planar screen */
    2.60  		SDL_Atari_C2pConvert(
    2.61 -			surface->pixels,
    2.62 -			destscr,
    2.63 -			surface->w,
    2.64 -			surface->h,
    2.65 +			surface->pixels, XBIOS_screens[XBIOS_fbnum],
    2.66 +			surface->w, surface->h,
    2.67  			XBIOS_doubleline,
    2.68 -			surface->pitch,
    2.69 -			XBIOS_pitch
    2.70 +			surface->pitch, XBIOS_pitch
    2.71  		);
    2.72  	}
    2.73