Skip to content

Commit

Permalink
SDL will center surface on screen for us
Browse files Browse the repository at this point in the history
  • Loading branch information
pmandin committed Jun 6, 2005
1 parent d7f522d commit a17766f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 64 deletions.
40 changes: 8 additions & 32 deletions src/video/gem/SDL_gemvideo.c
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -902,15 +894,10 @@ static void GEM_UpdateRectsFullscreen(_THIS, int numrects, SDL_Rect *rects)
}

for ( i=0; i<numrects; ++i ) {
blitcoords[0] = rects[i].x;
blitcoords[1] = rects[i].y;
blitcoords[2] = blitcoords[0] + rects[i].w - 1;
blitcoords[3] = blitcoords[1] + rects[i].h - 1;

blitcoords[4] = rects[i].x + ((VDI_w - surface->w) >> 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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
39 changes: 7 additions & 32 deletions src/video/xbios/SDL_xbios.c
Expand Up @@ -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;i<numrects;i++) {
void *source,*destination;
int x1,x2;
Expand All @@ -752,19 +743,16 @@ static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
source += surface->pitch * 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
);
}
}
Expand All @@ -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
);
}

Expand Down

0 comments on commit a17766f

Please sign in to comment.