From: Kartik Thakore Date: Tue, 3 Nov 2009 20:58:35 +0000 (-0500) Subject: Bricas hack for a horrible but needed function X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=508c16f35c61c12df3986d750ed817d29a0f37a1;p=sdlgit%2FSDL_perl.git Bricas hack for a horrible but needed function --- diff --git a/src/Core/objects/Surface.xs b/src/Core/objects/Surface.xs index 8e3816f..4295217 100644 --- a/src/Core/objects/Surface.xs +++ b/src/Core/objects/Surface.xs @@ -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;