Skip to content
Permalink
Browse files

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 cc74873a244ad6a1158113dd3f4792727292bb60
@@ -23,7 +23,7 @@

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

@@ -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);
@@ -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);
@@ -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);
@@ -691,7 +691,7 @@ static void XBIOS_VideoQuit(_THIS)
}
}

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

/* Restore screensavers */
if (SDL_XBIOS_TveillePresent(this)) {
@@ -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)
@@ -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[]={
@@ -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)
{
@@ -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;
@@ -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);
@@ -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;
@@ -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;
}
}
@@ -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;
}

@@ -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;

@@ -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;
@@ -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;
}
}
@@ -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;
}

@@ -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]={
@@ -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)
{
@@ -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;
@@ -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);
@@ -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;

@@ -78,7 +78,7 @@ static void saveMode(_THIS, SDL_PixelFormat *vformat)
{
short *oldpalette;
int i;

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

@@ -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;

@@ -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);

0 comments on commit cc74873

Please sign in to comment.