diff src/video/ataricommon/SDL_atarigl.c @ 1005:2ab1cb02a44e

Some Atari OpenGL implementations draw upside down
author Patrice Mandin <patmandin@gmail.com>
date Sat, 04 Dec 2004 20:53:58 +0000
parents ece5ab8acd1c
children 1901fea5edac
line wrap: on
line diff
--- a/src/video/ataricommon/SDL_atarigl.c	Sat Dec 04 10:31:16 2004 +0000
+++ b/src/video/ataricommon/SDL_atarigl.c	Sat Dec 04 20:53:58 2004 +0000
@@ -425,6 +425,7 @@
 	/* Init OpenGL context using OSMesa */
 	gl_convert = ConvertNull;
 	gl_copyshadow = CopyShadowNull;
+	gl_upsidedown = SDL_FALSE;
 
 	pixel_format = current->format;
 	redmask = pixel_format->Rmask;
@@ -539,6 +540,7 @@
 	/* Init OpenGL context using OSMesa */
 	gl_convert = ConvertNull;
 	gl_copyshadow = CopyShadowNull;
+	gl_upsidedown = SDL_FALSE;
 
 	pixel_format = current->format;
 	redmask = pixel_format->Rmask;
@@ -556,6 +558,7 @@
 				}
 			} else {
 				gl_pixelsize = 4;
+				gl_upsidedown = SDL_TRUE;
 				osmesa_format = OSMESA_ARGB;
 				if (redmask == 31<<10) {
 					gl_copyshadow = CopyShadow8888To555;
@@ -577,6 +580,7 @@
 				}
 			} else {
 				gl_pixelsize = 4;
+				gl_upsidedown = SDL_TRUE;
 				osmesa_format = OSMESA_ARGB;
 				gl_copyshadow = CopyShadow8888To565;
 				if (redmask != 31<<11) {
@@ -595,6 +599,7 @@
 				}
 			} else {
 				gl_copyshadow = CopyShadowDirect;
+				gl_upsidedown = SDL_TRUE;
 				if (redmask == 255<<16) {
 					osmesa_format = OSMESA_RGB;
 				} else {
@@ -616,6 +621,7 @@
 				}
 			} else {
 				gl_pixelsize = 4;
+				gl_upsidedown = SDL_TRUE;
 				gl_copyshadow = CopyShadowDirect;
 				if (redmask == 255<<16) {
 					osmesa_format = OSMESA_ARGB;
@@ -685,6 +691,10 @@
 	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch;
+	if (gl_upsidedown) {
+		srcline += (surface->h-1)*srcpitch;
+		srcpitch = -srcpitch;
+	}
 
 	for (y=0; y<surface->h; y++) {
 		memcpy(dstline, srcline, srcpitch);
@@ -704,6 +714,10 @@
 	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>1;
+	if (gl_upsidedown) {
+		srcline += (surface->h-1)*srcpitch;
+		srcpitch = -srcpitch;
+	}
 
 	for (y=0; y<surface->h; y++) {
 		srccol = srcline;
@@ -732,6 +746,10 @@
 	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>1;
+	if (gl_upsidedown) {
+		srcline += (surface->h-1)*srcpitch;
+		srcpitch = -srcpitch;
+	}
 
 	for (y=0; y<surface->h; y++) {
 		srccol = srcline;
@@ -761,6 +779,10 @@
 	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch;
+	if (gl_upsidedown) {
+		srcline += (surface->h-1)*srcpitch;
+		srcpitch = -srcpitch;
+	}
 
 	for (y=0; y<surface->h; y++) {
 		srccol = srcline;
@@ -788,6 +810,10 @@
 	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>2;
+	if (gl_upsidedown) {
+		srcline += (surface->h-1)*srcpitch;
+		srcpitch = -srcpitch;
+	}
 
 	for (y=0; y<surface->h; y++) {
 		srccol = srcline;
@@ -818,6 +844,10 @@
 	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>2;
+	if (gl_upsidedown) {
+		srcline += (surface->h-1)*srcpitch;
+		srcpitch = -srcpitch;
+	}
 
 	for (y=0; y<surface->h; y++) {
 		srccol = srcline;
@@ -848,6 +878,10 @@
 	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>2;
+	if (gl_upsidedown) {
+		srcline += (surface->h-1)*srcpitch;
+		srcpitch = -srcpitch;
+	}
 
 	for (y=0; y<surface->h; y++) {
 		srccol = srcline;
@@ -878,6 +912,10 @@
 	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>2;
+	if (gl_upsidedown) {
+		srcline += (surface->h-1)*srcpitch;
+		srcpitch = -srcpitch;
+	}
 
 	for (y=0; y<surface->h; y++) {
 		srccol = srcline;
@@ -908,6 +946,10 @@
 	srcpitch = (surface->w * gl_pixelsize) >>2;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>1;
+	if (gl_upsidedown) {
+		srcline += (surface->h-1)*srcpitch;
+		srcpitch = -srcpitch;
+	}
 
 	for (y=0; y<surface->h; y++) {
 		srccol = srcline;
@@ -938,6 +980,10 @@
 	srcpitch = (surface->w * gl_pixelsize) >> 2;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>1;
+	if (gl_upsidedown) {
+		srcline += (surface->h-1)*srcpitch;
+		srcpitch = -srcpitch;
+	}
 
 	for (y=0; y<surface->h; y++) {
 		srccol = srcline;