Wrong pixel size for source buffer for old drivers
authorPatrice Mandin <patmandin@gmail.com>
Thu, 02 Dec 2004 13:45:29 +0000
changeset 1002 13aa96c76e86
parent 1001 70bfe658442c
child 1003 ece5ab8acd1c
Wrong pixel size for source buffer for old drivers
src/video/ataricommon/SDL_atarigl.c
--- a/src/video/ataricommon/SDL_atarigl.c	Tue Nov 30 19:02:42 2004 +0000
+++ b/src/video/ataricommon/SDL_atarigl.c	Thu Dec 02 13:45:29 2004 +0000
@@ -545,8 +545,8 @@
 	switch (pixel_format->BitsPerPixel) {
 		case 15:
 			/* 15 bits unsupported */
-			gl_pixelsize = 2;
 			if (tinygl_present) {
+				gl_pixelsize = 3;
 				osmesa_format = VDI_RGB;
 				if (redmask == 31<<10) {
 					gl_copyshadow = CopyShadowRGBTo555;
@@ -555,6 +555,7 @@
 					gl_convert = Convert565To555le;
 				}
 			} else {
+				gl_pixelsize = 4;
 				osmesa_format = OSMESA_ARGB;
 				if (redmask == 31<<10) {
 					gl_copyshadow = CopyShadow8888To555;
@@ -566,8 +567,8 @@
 			break;
 		case 16:
 			/* 16 bits unsupported */
-			gl_pixelsize = 2;
 			if (tinygl_present) {
+				gl_pixelsize = 3;
 				osmesa_format = VDI_RGB;
 				gl_copyshadow = CopyShadowRGBTo565;
 				if (redmask != 31<<11) {
@@ -575,6 +576,7 @@
 					gl_convert = Convert565le;
 				}
 			} else {
+				gl_pixelsize = 4;
 				osmesa_format = OSMESA_ARGB;
 				gl_copyshadow = CopyShadow8888To565;
 				if (redmask != 31<<11) {
@@ -601,8 +603,8 @@
 			}
 			break;
 		case 32:
-			gl_pixelsize = 4;
 			if (tinygl_present) {
+				gl_pixelsize = 3;
 				osmesa_format = VDI_RGB;
 				gl_copyshadow = CopyShadowRGBToARGB;
 				if (redmask == 255) {
@@ -613,6 +615,7 @@
 					gl_convert = CopyShadowRGBToRGBA;
 				}
 			} else {
+				gl_pixelsize = 4;
 				gl_copyshadow = CopyShadowDirect;
 				if (redmask == 255<<16) {
 					osmesa_format = OSMESA_ARGB;
@@ -698,7 +701,7 @@
 	Uint8 *srcline, *srccol;
 
 	srcline = (Uint8 *)gl_shadow;
-	srcpitch = surface->w *3;
+	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>1;
 
@@ -726,7 +729,7 @@
 	Uint8 *srcline, *srccol;
 
 	srcline = (Uint8 *)gl_shadow;
-	srcpitch = surface->w *3;
+	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>1;
 
@@ -755,7 +758,7 @@
 	Uint8 *srcline, *srccol;
 
 	srcline = (Uint8 *)gl_shadow;
-	srcpitch = surface->w *3;
+	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch;
 
@@ -782,7 +785,7 @@
 	Uint8 *srcline, *srccol;
 
 	srcline = (Uint8 *)gl_shadow;
-	srcpitch = surface->w *3;
+	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>2;
 
@@ -812,7 +815,7 @@
 	Uint8 *srcline, *srccol;
 
 	srcline = (Uint8 *)gl_shadow;
-	srcpitch = surface->w *3;
+	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>2;
 
@@ -842,7 +845,7 @@
 	Uint8 *srcline, *srccol;
 
 	srcline = (Uint8 *)gl_shadow;
-	srcpitch = surface->w *3;
+	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>2;
 
@@ -872,7 +875,7 @@
 	Uint8 *srcline, *srccol;
 
 	srcline = (Uint8 *)gl_shadow;
-	srcpitch = surface->w *3;
+	srcpitch = surface->w * gl_pixelsize;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>2;
 
@@ -902,7 +905,7 @@
 	Uint32 *srcline, *srccol;
 
 	srcline = (Uint32 *)gl_shadow;
-	srcpitch = surface->w;
+	srcpitch = (surface->w * gl_pixelsize) >>2;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>1;
 
@@ -932,7 +935,7 @@
 	Uint32 *srcline, *srccol;
 
 	srcline = (Uint32 *)gl_shadow;
-	srcpitch = surface->w;
+	srcpitch = (surface->w * gl_pixelsize) >> 2;
 	dstline = surface->pixels;
 	dstpitch = surface->pitch >>1;