mirror of
https://github.com/yawut/SDL.git
synced 2026-08-03 17:05:36 -05:00
SDL will center surface on screen for us
This commit is contained in:
parent
ae2868b551
commit
4eb52e30d3
|
|
@ -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; 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);
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user