Bricas hack for a horrible but needed function
Kartik Thakore [Tue, 3 Nov 2009 20:58:35 +0000 (15:58 -0500)]
src/Core/objects/Surface.xs

index 8e3816f..4295217 100644 (file)
@@ -141,7 +141,7 @@ surface_set_pixel_RGB(screen, x, y, r, g, b )
        Uint32 *pixmem32;
        Uint32 colour;  
        colour = SDL_MapRGB( screen->format, r, g, b );
-       pixmem32 =  screen->pixels  + y + x;
+       pixmem32 = screen->pixels + ( y * screen->pitch ) + ( x * screen->format->BytesPerPixel );
        *pixmem32 = colour;
 
 void 
@@ -157,7 +157,7 @@ surface_set_pixel_RGBA(screen, x, y, r, g, b, a )
        Uint32 *pixmem32;
        Uint32 colour;  
        colour = SDL_MapRGBA( screen->format, r, g, b, a );
-       pixmem32 =  screen->pixels  + y + x;
+       pixmem32 = screen->pixels + ( y * screen->pitch ) + ( x * screen->format->BytesPerPixel ); ;
        *pixmem32 = colour;