mirror of
https://github.com/joel16/SDL2.git
synced 2024-12-12 21:46:13 +00:00
Some Atari OpenGL implementations draw upside down
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401006
This commit is contained in:
parent
983d7d81d8
commit
2c2d37b44b
@ -425,6 +425,7 @@ static int InitNew(_THIS, SDL_Surface *current)
|
|||||||
/* Init OpenGL context using OSMesa */
|
/* Init OpenGL context using OSMesa */
|
||||||
gl_convert = ConvertNull;
|
gl_convert = ConvertNull;
|
||||||
gl_copyshadow = CopyShadowNull;
|
gl_copyshadow = CopyShadowNull;
|
||||||
|
gl_upsidedown = SDL_FALSE;
|
||||||
|
|
||||||
pixel_format = current->format;
|
pixel_format = current->format;
|
||||||
redmask = pixel_format->Rmask;
|
redmask = pixel_format->Rmask;
|
||||||
@ -539,6 +540,7 @@ static int InitOld(_THIS, SDL_Surface *current)
|
|||||||
/* Init OpenGL context using OSMesa */
|
/* Init OpenGL context using OSMesa */
|
||||||
gl_convert = ConvertNull;
|
gl_convert = ConvertNull;
|
||||||
gl_copyshadow = CopyShadowNull;
|
gl_copyshadow = CopyShadowNull;
|
||||||
|
gl_upsidedown = SDL_FALSE;
|
||||||
|
|
||||||
pixel_format = current->format;
|
pixel_format = current->format;
|
||||||
redmask = pixel_format->Rmask;
|
redmask = pixel_format->Rmask;
|
||||||
@ -556,6 +558,7 @@ static int InitOld(_THIS, SDL_Surface *current)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gl_pixelsize = 4;
|
gl_pixelsize = 4;
|
||||||
|
gl_upsidedown = SDL_TRUE;
|
||||||
osmesa_format = OSMESA_ARGB;
|
osmesa_format = OSMESA_ARGB;
|
||||||
if (redmask == 31<<10) {
|
if (redmask == 31<<10) {
|
||||||
gl_copyshadow = CopyShadow8888To555;
|
gl_copyshadow = CopyShadow8888To555;
|
||||||
@ -577,6 +580,7 @@ static int InitOld(_THIS, SDL_Surface *current)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gl_pixelsize = 4;
|
gl_pixelsize = 4;
|
||||||
|
gl_upsidedown = SDL_TRUE;
|
||||||
osmesa_format = OSMESA_ARGB;
|
osmesa_format = OSMESA_ARGB;
|
||||||
gl_copyshadow = CopyShadow8888To565;
|
gl_copyshadow = CopyShadow8888To565;
|
||||||
if (redmask != 31<<11) {
|
if (redmask != 31<<11) {
|
||||||
@ -595,6 +599,7 @@ static int InitOld(_THIS, SDL_Surface *current)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gl_copyshadow = CopyShadowDirect;
|
gl_copyshadow = CopyShadowDirect;
|
||||||
|
gl_upsidedown = SDL_TRUE;
|
||||||
if (redmask == 255<<16) {
|
if (redmask == 255<<16) {
|
||||||
osmesa_format = OSMESA_RGB;
|
osmesa_format = OSMESA_RGB;
|
||||||
} else {
|
} else {
|
||||||
@ -616,6 +621,7 @@ static int InitOld(_THIS, SDL_Surface *current)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gl_pixelsize = 4;
|
gl_pixelsize = 4;
|
||||||
|
gl_upsidedown = SDL_TRUE;
|
||||||
gl_copyshadow = CopyShadowDirect;
|
gl_copyshadow = CopyShadowDirect;
|
||||||
if (redmask == 255<<16) {
|
if (redmask == 255<<16) {
|
||||||
osmesa_format = OSMESA_ARGB;
|
osmesa_format = OSMESA_ARGB;
|
||||||
@ -685,6 +691,10 @@ static void CopyShadowDirect(_THIS, SDL_Surface *surface)
|
|||||||
srcpitch = surface->w * gl_pixelsize;
|
srcpitch = surface->w * gl_pixelsize;
|
||||||
dstline = surface->pixels;
|
dstline = surface->pixels;
|
||||||
dstpitch = surface->pitch;
|
dstpitch = surface->pitch;
|
||||||
|
if (gl_upsidedown) {
|
||||||
|
srcline += (surface->h-1)*srcpitch;
|
||||||
|
srcpitch = -srcpitch;
|
||||||
|
}
|
||||||
|
|
||||||
for (y=0; y<surface->h; y++) {
|
for (y=0; y<surface->h; y++) {
|
||||||
memcpy(dstline, srcline, srcpitch);
|
memcpy(dstline, srcline, srcpitch);
|
||||||
@ -704,6 +714,10 @@ static void CopyShadowRGBTo555(_THIS, SDL_Surface *surface)
|
|||||||
srcpitch = surface->w * gl_pixelsize;
|
srcpitch = surface->w * gl_pixelsize;
|
||||||
dstline = surface->pixels;
|
dstline = surface->pixels;
|
||||||
dstpitch = surface->pitch >>1;
|
dstpitch = surface->pitch >>1;
|
||||||
|
if (gl_upsidedown) {
|
||||||
|
srcline += (surface->h-1)*srcpitch;
|
||||||
|
srcpitch = -srcpitch;
|
||||||
|
}
|
||||||
|
|
||||||
for (y=0; y<surface->h; y++) {
|
for (y=0; y<surface->h; y++) {
|
||||||
srccol = srcline;
|
srccol = srcline;
|
||||||
@ -732,6 +746,10 @@ static void CopyShadowRGBTo565(_THIS, SDL_Surface *surface)
|
|||||||
srcpitch = surface->w * gl_pixelsize;
|
srcpitch = surface->w * gl_pixelsize;
|
||||||
dstline = surface->pixels;
|
dstline = surface->pixels;
|
||||||
dstpitch = surface->pitch >>1;
|
dstpitch = surface->pitch >>1;
|
||||||
|
if (gl_upsidedown) {
|
||||||
|
srcline += (surface->h-1)*srcpitch;
|
||||||
|
srcpitch = -srcpitch;
|
||||||
|
}
|
||||||
|
|
||||||
for (y=0; y<surface->h; y++) {
|
for (y=0; y<surface->h; y++) {
|
||||||
srccol = srcline;
|
srccol = srcline;
|
||||||
@ -761,6 +779,10 @@ static void CopyShadowRGBSwap(_THIS, SDL_Surface *surface)
|
|||||||
srcpitch = surface->w * gl_pixelsize;
|
srcpitch = surface->w * gl_pixelsize;
|
||||||
dstline = surface->pixels;
|
dstline = surface->pixels;
|
||||||
dstpitch = surface->pitch;
|
dstpitch = surface->pitch;
|
||||||
|
if (gl_upsidedown) {
|
||||||
|
srcline += (surface->h-1)*srcpitch;
|
||||||
|
srcpitch = -srcpitch;
|
||||||
|
}
|
||||||
|
|
||||||
for (y=0; y<surface->h; y++) {
|
for (y=0; y<surface->h; y++) {
|
||||||
srccol = srcline;
|
srccol = srcline;
|
||||||
@ -788,6 +810,10 @@ static void CopyShadowRGBToARGB(_THIS, SDL_Surface *surface)
|
|||||||
srcpitch = surface->w * gl_pixelsize;
|
srcpitch = surface->w * gl_pixelsize;
|
||||||
dstline = surface->pixels;
|
dstline = surface->pixels;
|
||||||
dstpitch = surface->pitch >>2;
|
dstpitch = surface->pitch >>2;
|
||||||
|
if (gl_upsidedown) {
|
||||||
|
srcline += (surface->h-1)*srcpitch;
|
||||||
|
srcpitch = -srcpitch;
|
||||||
|
}
|
||||||
|
|
||||||
for (y=0; y<surface->h; y++) {
|
for (y=0; y<surface->h; y++) {
|
||||||
srccol = srcline;
|
srccol = srcline;
|
||||||
@ -818,6 +844,10 @@ static void CopyShadowRGBToABGR(_THIS, SDL_Surface *surface)
|
|||||||
srcpitch = surface->w * gl_pixelsize;
|
srcpitch = surface->w * gl_pixelsize;
|
||||||
dstline = surface->pixels;
|
dstline = surface->pixels;
|
||||||
dstpitch = surface->pitch >>2;
|
dstpitch = surface->pitch >>2;
|
||||||
|
if (gl_upsidedown) {
|
||||||
|
srcline += (surface->h-1)*srcpitch;
|
||||||
|
srcpitch = -srcpitch;
|
||||||
|
}
|
||||||
|
|
||||||
for (y=0; y<surface->h; y++) {
|
for (y=0; y<surface->h; y++) {
|
||||||
srccol = srcline;
|
srccol = srcline;
|
||||||
@ -848,6 +878,10 @@ static void CopyShadowRGBToBGRA(_THIS, SDL_Surface *surface)
|
|||||||
srcpitch = surface->w * gl_pixelsize;
|
srcpitch = surface->w * gl_pixelsize;
|
||||||
dstline = surface->pixels;
|
dstline = surface->pixels;
|
||||||
dstpitch = surface->pitch >>2;
|
dstpitch = surface->pitch >>2;
|
||||||
|
if (gl_upsidedown) {
|
||||||
|
srcline += (surface->h-1)*srcpitch;
|
||||||
|
srcpitch = -srcpitch;
|
||||||
|
}
|
||||||
|
|
||||||
for (y=0; y<surface->h; y++) {
|
for (y=0; y<surface->h; y++) {
|
||||||
srccol = srcline;
|
srccol = srcline;
|
||||||
@ -878,6 +912,10 @@ static void CopyShadowRGBToRGBA(_THIS, SDL_Surface *surface)
|
|||||||
srcpitch = surface->w * gl_pixelsize;
|
srcpitch = surface->w * gl_pixelsize;
|
||||||
dstline = surface->pixels;
|
dstline = surface->pixels;
|
||||||
dstpitch = surface->pitch >>2;
|
dstpitch = surface->pitch >>2;
|
||||||
|
if (gl_upsidedown) {
|
||||||
|
srcline += (surface->h-1)*srcpitch;
|
||||||
|
srcpitch = -srcpitch;
|
||||||
|
}
|
||||||
|
|
||||||
for (y=0; y<surface->h; y++) {
|
for (y=0; y<surface->h; y++) {
|
||||||
srccol = srcline;
|
srccol = srcline;
|
||||||
@ -908,6 +946,10 @@ static void CopyShadow8888To555(_THIS, SDL_Surface *surface)
|
|||||||
srcpitch = (surface->w * gl_pixelsize) >>2;
|
srcpitch = (surface->w * gl_pixelsize) >>2;
|
||||||
dstline = surface->pixels;
|
dstline = surface->pixels;
|
||||||
dstpitch = surface->pitch >>1;
|
dstpitch = surface->pitch >>1;
|
||||||
|
if (gl_upsidedown) {
|
||||||
|
srcline += (surface->h-1)*srcpitch;
|
||||||
|
srcpitch = -srcpitch;
|
||||||
|
}
|
||||||
|
|
||||||
for (y=0; y<surface->h; y++) {
|
for (y=0; y<surface->h; y++) {
|
||||||
srccol = srcline;
|
srccol = srcline;
|
||||||
@ -938,6 +980,10 @@ static void CopyShadow8888To565(_THIS, SDL_Surface *surface)
|
|||||||
srcpitch = (surface->w * gl_pixelsize) >> 2;
|
srcpitch = (surface->w * gl_pixelsize) >> 2;
|
||||||
dstline = surface->pixels;
|
dstline = surface->pixels;
|
||||||
dstpitch = surface->pitch >>1;
|
dstpitch = surface->pitch >>1;
|
||||||
|
if (gl_upsidedown) {
|
||||||
|
srcline += (surface->h-1)*srcpitch;
|
||||||
|
srcpitch = -srcpitch;
|
||||||
|
}
|
||||||
|
|
||||||
for (y=0; y<surface->h; y++) {
|
for (y=0; y<surface->h; y++) {
|
||||||
srccol = srcline;
|
srccol = srcline;
|
||||||
|
@ -40,6 +40,8 @@ struct SDL_PrivateGLData {
|
|||||||
|
|
||||||
int gl_pixelsize; /* for CopyShadow functions */
|
int gl_pixelsize; /* for CopyShadow functions */
|
||||||
|
|
||||||
|
SDL_bool gl_upsidedown; /* Some implementations draw upside down */
|
||||||
|
|
||||||
Uint8 *gl_shadow; /* Shadow buffer for old implementations */
|
Uint8 *gl_shadow; /* Shadow buffer for old implementations */
|
||||||
|
|
||||||
/* for unsupported OSMesa buffer formats */
|
/* for unsupported OSMesa buffer formats */
|
||||||
@ -75,19 +77,20 @@ struct SDL_PrivateGLData {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Variable names */
|
/* Variable names */
|
||||||
#define gl_active (this->gl_data->gl_active)
|
#define gl_active (this->gl_data->gl_active)
|
||||||
#define gl_ctx (this->gl_data->ctx)
|
#define gl_ctx (this->gl_data->ctx)
|
||||||
#define gl_oldmesa (this->gl_data->gl_oldmesa)
|
#define gl_oldmesa (this->gl_data->gl_oldmesa)
|
||||||
#define gl_pixelsize (this->gl_data->gl_pixelsize)
|
#define gl_pixelsize (this->gl_data->gl_pixelsize)
|
||||||
#define gl_shadow (this->gl_data->gl_shadow)
|
#define gl_upsidedown (this->gl_data->gl_upsidedown)
|
||||||
#define gl_convert (this->gl_data->ConvertSurface)
|
#define gl_shadow (this->gl_data->gl_shadow)
|
||||||
|
#define gl_convert (this->gl_data->ConvertSurface)
|
||||||
#define gl_copyshadow (this->gl_data->CopyShadow)
|
#define gl_copyshadow (this->gl_data->CopyShadow)
|
||||||
#define gl_curformat (this->gl_data->format)
|
#define gl_curformat (this->gl_data->format)
|
||||||
#define gl_curdepth (this->gl_data->depth)
|
#define gl_curdepth (this->gl_data->depth)
|
||||||
#define gl_curstencil (this->gl_data->stencil)
|
#define gl_curstencil (this->gl_data->stencil)
|
||||||
#define gl_curaccum (this->gl_data->accum)
|
#define gl_curaccum (this->gl_data->accum)
|
||||||
#define gl_curwidth (this->gl_data->width)
|
#define gl_curwidth (this->gl_data->width)
|
||||||
#define gl_curheight (this->gl_data->height)
|
#define gl_curheight (this->gl_data->height)
|
||||||
|
|
||||||
/* OpenGL functions */
|
/* OpenGL functions */
|
||||||
extern int SDL_AtariGL_Init(_THIS, SDL_Surface *current);
|
extern int SDL_AtariGL_Init(_THIS, SDL_Surface *current);
|
||||||
|
Loading…
Reference in New Issue
Block a user