Index: gtk/image.c =================================================================== RCS file: /cvsroot/crossfire/client/gtk/image.c,v retrieving revision 1.26 diff -u -w -r1.26 image.c --- gtk/image.c 5 Sep 2005 20:16:53 -0000 1.26 +++ gtk/image.c 17 Oct 2005 22:26:23 -0000 @@ -131,8 +131,6 @@ #if defined(HAVE_SDL) int i; SDL_Surface *fog; - uint32 g,*p; - uint8 *l; #if SDL_BYTEORDER == SDL_LIL_ENDIAN pi->map_image = SDL_CreateRGBSurfaceFrom(data, pi->map_width, @@ -145,7 +143,6 @@ SDL_LockSurface(fog); for (i=0; i < pi->map_width * pi->map_height; i++) { - l = (uint8 *) (data + i*4); /* The effective luminance of a pixel is calculated with the following formula: * Y=0.3RED+0.59GREEN+0.11Blue * This is the way you are supposed to convert color to grayscale @@ -156,9 +153,11 @@ * * Tchize 22 May 2004 */ - g=(77*(*l)+151*(*(l+1))+28*(*(l+2)))>>8; - p = (uint32*) fog->pixels + i; - *(uint32*) p = g | (g << 8) | (g << 16) | (*(l + 3) << 24); + uint8 g = (77*data[i*4+0]+151*data[i*4+1]+28*data[i*4+2])/256; + ((uint8 *)fog->pixels)[i*4+0] = 0; + ((uint8 *)fog->pixels)[i*4+1] = 0; + ((uint8 *)fog->pixels)[i*4+2] = g; + ((uint8 *)fog->pixels)[i*4+3] = data[i*4+3]; } SDL_UnlockSurface(fog); @@ -180,7 +179,6 @@ * on teh screen are reversed. */ for (i=0; i < pi->map_width * pi->map_height; i++) { - l = (uint8 *) (data + i*4); /* The effective luminance of a pixel is calculated with the following formula: * Y=0.3RED+0.59GREEN+0.11Blue * This is the way you are supposed to convert color to grayscale @@ -191,9 +189,11 @@ * * Tchize 22 May 2004 */ - g=(77*(*l)+151*(*(l+1))+28*(*(l+2)))>>8; - p = (uint32*) fog->pixels + i; - *(uint32*) p = (g << 8) | (g << 16) | (g << 24) | *(l + 3); + uint8 g = (77*data[i*4+0]+151*data[i*4+1]+28*data[i*4+2])/256; + ((uint8 *)fog->pixels)[i*4+0] = 0; + ((uint8 *)fog->pixels)[i*4+1] = 0; + ((uint8 *)fog->pixels)[i*4+2] = g; + ((uint8 *)fog->pixels)[i*4+3] = data[i*4+3]; } for (i=0; i < pi->map_width * pi->map_height; i+= 4) {