From a17766f53634b6746f4b6dd4d3c41dbdbadd983d Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Mon, 6 Jun 2005 16:36:18 +0000 Subject: [PATCH] SDL will center surface on screen for us --- src/video/gem/SDL_gemvideo.c | 40 ++++++++---------------------------- src/video/xbios/SDL_xbios.c | 39 +++++++---------------------------- 2 files changed, 15 insertions(+), 64 deletions(-) diff --git a/src/video/gem/SDL_gemvideo.c b/src/video/gem/SDL_gemvideo.c index 4fa2fb758..51cc04019 100644 --- a/src/video/gem/SDL_gemvideo.c +++ b/src/video/gem/SDL_gemvideo.c @@ -777,8 +777,6 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, current->pitch = width * VDI_pixelsize; } else { current->pixels = VDI_screen; - current->pixels += VDI_pitch * ((VDI_h - height) >> 1); - current->pixels += VDI_pixelsize * ((VDI_w - width) >> 1); current->pitch = VDI_pitch; } @@ -844,13 +842,7 @@ static void GEM_UpdateRectsFullscreen(_THIS, int numrects, SDL_Rect *rects) int destpitch; if (GEM_bufops & B2S_C2P_1TOS) { - int destx; - destscr = VDI_screen; - destscr += VDI_pitch * ((VDI_h - surface->h) >> 1); - destx = (VDI_w - surf_width) >> 1; - destx &= ~15; - destscr += destx; destpitch = VDI_pitch; } else { destscr = GEM_buffer2; @@ -902,15 +894,10 @@ static void GEM_UpdateRectsFullscreen(_THIS, int numrects, SDL_Rect *rects) } for ( i=0; iw) >> 1); - blitcoords[5] = rects[i].y + ((VDI_h - surface->h) >> 1); - blitcoords[6] = blitcoords[4] + rects[i].w - 1; - blitcoords[7] = blitcoords[5] + rects[i].h - 1; + blitcoords[0] = blitcoords[4] = rects[i].x; + blitcoords[1] = blitcoords[5] = rects[i].y; + blitcoords[2] = blitcoords[6] = rects[i].x + rects[i].w - 1; + blitcoords[3] = blitcoords[7] = rects[i].y + rects[i].h - 1; vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb); } @@ -968,13 +955,7 @@ static int GEM_FlipHWSurfaceFullscreen(_THIS, SDL_Surface *surface) int destpitch; if (GEM_bufops & B2S_C2P_1TOS) { - int destx; - destscr = VDI_screen; - destscr += VDI_pitch * ((VDI_h - surface->h) >> 1); - destx = (VDI_w - surf_width) >> 1; - destx &= ~15; - destscr += destx; destpitch = VDI_pitch; } else { destscr = GEM_buffer2; @@ -1007,15 +988,10 @@ static int GEM_FlipHWSurfaceFullscreen(_THIS, SDL_Surface *surface) mfdb_src.fd_addr=GEM_buffer2; } - blitcoords[0] = 0; - blitcoords[1] = 0; - blitcoords[2] = surface->w - 1; - blitcoords[3] = surface->h - 1; - - blitcoords[4] = (VDI_w - surface->w) >> 1; - blitcoords[5] = (VDI_h - surface->h) >> 1; - blitcoords[6] = blitcoords[4] + surface->w - 1; - blitcoords[7] = blitcoords[5] + surface->h - 1; + blitcoords[0] = blitcoords[4] = 0; + blitcoords[1] = blitcoords[5] = 0; + blitcoords[2] = blitcoords[6] = surface->w - 1; + blitcoords[3] = blitcoords[7] = surface->h - 1; vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb); } diff --git a/src/video/xbios/SDL_xbios.c b/src/video/xbios/SDL_xbios.c index 337f4577e..a70b1dae8 100644 --- a/src/video/xbios/SDL_xbios.c +++ b/src/video/xbios/SDL_xbios.c @@ -727,17 +727,8 @@ static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects) 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;ipitch * rects[i].y; source += x1; - destination = destscr; + destination = XBIOS_screens[XBIOS_fbnum]; 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 ); } } @@ -785,25 +773,12 @@ static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects) 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, - destscr, - surface->w, - surface->h, + surface->pixels, XBIOS_screens[XBIOS_fbnum], + surface->w, surface->h, XBIOS_doubleline, - surface->pitch, - XBIOS_pitch + surface->pitch, XBIOS_pitch ); }