changeset 1101:c8a51d169579

Revert back screen centering when using c2p
author Patrice Mandin <patmandin@gmail.com>
date Thu, 21 Jul 2005 22:21:51 +0000
parents 76459577e620
children f0919504adfd
files src/video/xbios/SDL_xbios.c
diffstat 1 files changed, 32 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/xbios/SDL_xbios.c	Thu Jul 21 21:33:15 2005 +0000
+++ b/src/video/xbios/SDL_xbios.c	Thu Jul 21 22:21:51 2005 +0000
@@ -724,8 +724,17 @@
 	surface = this->screen;
 
 	if ((surface->format->BitsPerPixel) == 8) {
+		void *destscr;
+		int destx;
 		int i;
 
+		/* Center on destination screen */
+		destscr = XBIOS_screens[XBIOS_fbnum];
+		destscr += XBIOS_pitch * ((XBIOS_height - surface->h) >> 1);
+		destx = (XBIOS_width - surface->w) >> 1;
+		destx &= ~15;
+		destscr += destx;
+
 		for (i=0;i<numrects;i++) {
 			void *source,*destination;
 			int x1,x2;
@@ -740,16 +749,19 @@
 			source += surface->pitch * rects[i].y;
 			source += x1;
 
-			destination = XBIOS_screens[XBIOS_fbnum];
+			destination = destscr;
 			destination += XBIOS_pitch * rects[i].y;
 			destination += x1;
 
 			/* Convert chunky to planar screen */
 			SDL_Atari_C2pConvert(
-				source, destination,
-				x2-x1, rects[i].h,
+				source,
+				destination,
+				x2-x1,
+				rects[i].h,
 				XBIOS_doubleline,
-				surface->pitch, XBIOS_pitch
+				surface->pitch,
+				XBIOS_pitch
 			);
 		}
 	}
@@ -770,12 +782,25 @@
 static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface)
 {
 	if ((surface->format->BitsPerPixel) == 8) {
+		void *destscr;
+		int destx;
+			
+		/* Center on destination screen */
+		destscr = XBIOS_screens[XBIOS_fbnum];
+		destscr += XBIOS_pitch * ((XBIOS_height - surface->h) >> 1);
+		destx = (XBIOS_width - surface->w) >> 1;
+		destx &= ~15;
+		destscr += destx;
+
 		/* Convert chunky to planar screen */
 		SDL_Atari_C2pConvert(
-			surface->pixels, XBIOS_screens[XBIOS_fbnum],
-			surface->w, surface->h,
+			surface->pixels,
+			destscr,
+			surface->w,
+			surface->h,
 			XBIOS_doubleline,
-			surface->pitch, XBIOS_pitch
+			surface->pitch,
+			XBIOS_pitch
 		);
 	}