src/video/xbios/SDL_xbios.c
changeset 314 bff64eba7721
parent 311 2847fd83f115
child 319 189a6a3416c7
equal deleted inserted replaced
313:67ad846ed21c 314:bff64eba7721
   617 }
   617 }
   618 
   618 
   619 static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
   619 static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
   620 {
   620 {
   621 	SDL_Surface *surface;
   621 	SDL_Surface *surface;
   622 	
   622 
   623 	surface = this->screen;
   623 	surface = this->screen;
   624 
   624 
   625 	XBIOS_FlipHWSurface(this, surface);
   625 	if ((surface->format->BitsPerPixel) == 8) {
       
   626 		void *destscr;
       
   627 		int destx;
       
   628 		int i;
       
   629 
       
   630 		/* Center on destination screen */
       
   631 		destscr = XBIOS_screens[XBIOS_fbnum];
       
   632 		destscr += XBIOS_pitch * ((XBIOS_height - surface->h) >> 1);
       
   633 		destx = (XBIOS_width - surface->w) >> 1;
       
   634 		destx &= ~15;
       
   635 		destscr += destx;
       
   636 
       
   637 		for (i=0;i<numrects;i++) {
       
   638 			void *source,*destination;
       
   639 			int x1,x2;
       
   640 
       
   641 			x1 = rects[i].x & ~15;
       
   642 			x2 = ((rects[i].x+rects[i].w) | 15) +1;
       
   643 
       
   644 			source = surface->pixels;
       
   645 			source += surface->pitch * rects[i].y;
       
   646 			source += x1;
       
   647 
       
   648 			destination = destscr;
       
   649 			destination += XBIOS_pitch * rects[i].y;
       
   650 			destination += x1;
       
   651 
       
   652 			/* Convert chunky to planar screen */
       
   653 			Atari_C2pConvert(
       
   654 				source,
       
   655 				destination,
       
   656 				x2-x1,
       
   657 				rects[i].h,
       
   658 				XBIOS_doubleline,
       
   659 				surface->pitch,
       
   660 				XBIOS_pitch
       
   661 			);
       
   662 		}
       
   663 	}
       
   664 
       
   665 	Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1);
       
   666 	Vsync();
       
   667 
       
   668 	if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
       
   669 		XBIOS_fbnum ^= 1;
       
   670 		if ((surface->format->BitsPerPixel) > 8) {
       
   671 			surface->pixels=XBIOS_screens[XBIOS_fbnum];
       
   672 		}
       
   673 	}
   626 }
   674 }
   627 
   675 
   628 static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface)
   676 static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface)
   629 {
   677 {
   630 	if ((surface->format->BitsPerPixel) == 8) {
   678 	if ((surface->format->BitsPerPixel) == 8) {