Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Do not change screen pointers and do Vsync if we are not double buffe…
…ring. Remove some extra whitespaces.
  • Loading branch information
pmandin committed Sep 26, 2017
1 parent 28f8a2d commit cc74873
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 45 deletions.
18 changes: 9 additions & 9 deletions src/video/xbios/SDL_xbios.c
Expand Up @@ -23,7 +23,7 @@

/*
* Xbios SDL video driver
*
*
* Patrice Mandin
*/

Expand Down Expand Up @@ -442,7 +442,7 @@ static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface *current,
lineWidth = (*XBIOS_getLineWidth)(this, new_video_mode, width, new_depth);

new_screen_size = lineWidth * height;
new_screen_size += 256; /* To align on a 256 byte adress */
new_screen_size += 256; /* To align on a 256 byte adress */

if (new_video_mode->flags & XBIOSMODE_C2P) {
XBIOS_shadowscreen = Atari_SysMalloc(new_screen_size, MX_PREFTTRAM);
Expand Down Expand Up @@ -591,13 +591,13 @@ static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
}
}

if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
#ifndef DEBUG_VIDEO_XBIOS
(*XBIOS_swapVbuffers)(this);
(*XBIOS_swapVbuffers)(this);

Vsync();
Vsync();
#endif

if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
XBIOS_fbnum ^= 1;
if (!XBIOS_shadowscreen) {
int src_offset = (surface->locked ? surface->offset : 0);
Expand Down Expand Up @@ -630,13 +630,13 @@ static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface)
);
}

if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
#ifndef DEBUG_VIDEO_XBIOS
(*XBIOS_swapVbuffers)(this);
(*XBIOS_swapVbuffers)(this);

Vsync();
Vsync();
#endif

if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
XBIOS_fbnum ^= 1;
if (!XBIOS_shadowscreen) {
src_offset = (surface->locked ? surface->offset : 0);
Expand Down Expand Up @@ -691,7 +691,7 @@ static void XBIOS_VideoQuit(_THIS)
}
}

this->screen->pixels = NULL;
this->screen->pixels = NULL;

/* Restore screensavers */
if (SDL_XBIOS_TveillePresent(this)) {
Expand Down
2 changes: 1 addition & 1 deletion src/video/xbios/SDL_xbios_centscreen.c
Expand Up @@ -77,7 +77,7 @@ static void listModes(_THIS, int actually_add)
curmode.mode = curmode.physx = curmode.physy = curmode.plan =
curmode.logx = curmode.logy = -1;
result = Vnext(&curmode, &listedmode);
}
}
}

static void saveMode(_THIS, SDL_PixelFormat *vformat)
Expand Down
28 changes: 14 additions & 14 deletions src/video/xbios/SDL_xbios_ctpci.c
Expand Up @@ -55,7 +55,7 @@ static const predefined_mode_t mode_list[]={
{0x4188,1024,768},
{0x42c8,1280,800},
{0x41e0,1280,1024},
{0x4210,1600,1200}
{0x4210,1600,1200}
};

static const Uint8 mode_bpp[]={
Expand Down Expand Up @@ -105,8 +105,8 @@ static unsigned long /*cdecl*/ enumfunc(SCREENINFO *inf, unsigned long flag)

SDL_XBIOS_AddMode(enum_this, enum_actually_add, &modeinfo);

return ENUMMODE_CONT;
}
return ENUMMODE_CONT;
}

static void listModes(_THIS, int actually_add)
{
Expand All @@ -121,7 +121,7 @@ static void listModes(_THIS, int actually_add)
for (j=3; j<5; j++) {
if (Validmode(deviceid + j)) {
xbiosmode_t modeinfo;

modeinfo.number = deviceid + j;
modeinfo.width = mode_list[i].width;
modeinfo.height = mode_list[i].height;
Expand All @@ -144,7 +144,7 @@ static void saveMode(_THIS, SDL_PixelFormat *vformat)
{
SCREENINFO si;

/* Read infos about current mode */
/* Read infos about current mode */
VsetScreen(-1, &XBIOS_oldvmode, VN_MAGIC, CMD_GETMODE);

si.size = sizeof(SCREENINFO);
Expand Down Expand Up @@ -268,13 +268,13 @@ static void updateRects(_THIS, int numrects, SDL_Rect *rects)
{
SDL_Surface *surface;
int i;

surface = this->screen;

for (i=0;i<numrects;i++) {
Uint8 *blockSrcStart, *blockDstStart;
int y;

blockSrcStart = (Uint8 *) surface->pixels;
blockSrcStart += surface->pitch*rects[i].y;
blockSrcStart += surface->format->BytesPerPixel*rects[i].x;
Expand All @@ -291,10 +291,10 @@ static void updateRects(_THIS, int numrects, SDL_Rect *rects)
}
}

VsetScreen(-1L, -1L, VN_MAGIC, CMD_FLIPPAGE);
Vsync();

if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
VsetScreen(-1L, -1L, VN_MAGIC, CMD_FLIPPAGE);
Vsync();

XBIOS_fbnum ^= 1;
}
}
Expand All @@ -311,13 +311,13 @@ static int flipHWSurface(_THIS, SDL_Surface *surface)
SDL_memcpy(dst, src, surface->w * surface->format->BytesPerPixel);
src += surface->pitch;
dst += XBIOS_pitch;

}

VsetScreen(-1L, -1L, VN_MAGIC, CMD_FLIPPAGE);
Vsync();
}

if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
VsetScreen(-1L, -1L, VN_MAGIC, CMD_FLIPPAGE);
Vsync();

XBIOS_fbnum ^= 1;
}

Expand Down
22 changes: 11 additions & 11 deletions src/video/xbios/SDL_xbios_f30.c
Expand Up @@ -265,7 +265,7 @@ static int setColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
int i, r,g,b;

for(i = 0; i < ncolors; i++) {
r = colors[i].r;
r = colors[i].r;
g = colors[i].g;
b = colors[i].b;

Expand Down Expand Up @@ -321,13 +321,13 @@ static void updateRects_SV(_THIS, int numrects, SDL_Rect *rects)
{
SDL_Surface *surface;
int i;

surface = this->screen;

for (i=0;i<numrects;i++) {
Uint8 *blockSrcStart, *blockDstStart;
int y;

blockSrcStart = (Uint8 *) surface->pixels;
blockSrcStart += surface->pitch*rects[i].y;
blockSrcStart += surface->format->BytesPerPixel*rects[i].x;
Expand All @@ -344,10 +344,10 @@ static void updateRects_SV(_THIS, int numrects, SDL_Rect *rects)
}
}

Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1);
Vsync();

if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1);
Vsync();

XBIOS_fbnum ^= 1;
}
}
Expand All @@ -364,13 +364,13 @@ static int flipHWSurface_SV(_THIS, SDL_Surface *surface)
SDL_memcpy(dst, src, surface->w * surface->format->BytesPerPixel);
src += surface->pitch;
dst += XBIOS_pitch;

}

Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1);
Vsync();
if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1);
Vsync();

XBIOS_fbnum ^= 1;
}

Expand Down
12 changes: 6 additions & 6 deletions src/video/xbios/SDL_xbios_milan.c
Expand Up @@ -46,7 +46,7 @@ static const predefined_mode_t mode_list[NUM_PREDEFINED_MODES]={
{1024,768},
{1152,864},
{1280,1024},
{1600,1200}
{1600,1200}
};

static const Uint8 mode_bpp[4]={
Expand Down Expand Up @@ -96,8 +96,8 @@ static unsigned long /*cdecl*/ enumfunc(SCREENINFO *inf, unsigned long flag)

SDL_XBIOS_AddMode(enum_this, enum_actually_add, &modeinfo);

return ENUMMODE_CONT;
}
return ENUMMODE_CONT;
}

static void listModes(_THIS, int actually_add)
{
Expand All @@ -111,7 +111,7 @@ static void listModes(_THIS, int actually_add)
for (j=1; j<4; j++) {
if (Validmode(deviceid + j)) {
xbiosmode_t modeinfo;

modeinfo.number = deviceid + j;
modeinfo.width = mode_list[i].width;
modeinfo.height = mode_list[i].height;
Expand All @@ -133,7 +133,7 @@ static void saveMode(_THIS, SDL_PixelFormat *vformat)
{
SCREENINFO si;

/* Read infos about current mode */
/* Read infos about current mode */
VsetScreen(-1, &XBIOS_oldvmode, MI_MAGIC, CMD_GETMODE);

si.size = sizeof(SCREENINFO);
Expand Down Expand Up @@ -244,7 +244,7 @@ static int setColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
int i, r,g,b;

for(i = 0; i < ncolors; i++) {
r = colors[i].r;
r = colors[i].r;
g = colors[i].g;
b = colors[i].b;

Expand Down
4 changes: 2 additions & 2 deletions src/video/xbios/SDL_xbios_st.c
Expand Up @@ -78,7 +78,7 @@ static void saveMode(_THIS, SDL_PixelFormat *vformat)
{
short *oldpalette;
int i;

XBIOS_oldvbase=Physbase();
XBIOS_oldvmode=Getrez();

Expand Down Expand Up @@ -188,7 +188,7 @@ static int setColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
int i, r,g,b;

for (i=0;i<ncolors;i++) {
r = colors[i].r;
r = colors[i].r;
g = colors[i].g;
b = colors[i].b;

Expand Down
4 changes: 2 additions & 2 deletions src/video/xbios/SDL_xbios_tt.c
Expand Up @@ -113,10 +113,10 @@ static int setColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
int i, r,g,b;

for(i = 0; i < ncolors; i++) {
r = colors[i].r;
r = colors[i].r;
g = colors[i].g;
b = colors[i].b;

TT_palette[i]=((r>>4)<<8)|((g>>4)<<4)|(b>>4);
}
EsetPalette(firstcolor,ncolors,TT_palette);
Expand Down

0 comments on commit cc74873

Please sign in to comment.