From: Kartik Thakore Date: Fri, 6 Nov 2009 15:36:56 +0000 (-0500) Subject: Better error reporting for SDL::Video::map_RGB[A] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a0247f014088bec225d31a72b52b35ea1773fb22;p=sdlgit%2FSDL_perl.git Better error reporting for SDL::Video::map_RGB[A] --- diff --git a/src/Core/Video.xs b/src/Core/Video.xs index 6b484ae..c47fa5a 100644 --- a/src/Core/Video.xs +++ b/src/Core/Video.xs @@ -250,7 +250,16 @@ video_map_RGB ( pixel_format, r, g, b ) Uint8 g Uint8 b CODE: - RETVAL = SDL_MapRGB(pixel_format,r,g,b); + Uint32 value = SDL_MapRGB(pixel_format, r,g,b); + if(value > 0) + { + RETVAL = value; + } + else + { + warn( "SDL_MapRGB failed: %s", SDL_GetError() ); + RETVAL = -1; + } OUTPUT: RETVAL @@ -262,7 +271,17 @@ video_map_RGBA ( pixel_format, r, g, b, a ) Uint8 b Uint8 a CODE: - RETVAL = SDL_MapRGBA(pixel_format,r,g,b,a); + Uint32 value = SDL_MapRGBA(pixel_format, r,g,b,a ); + if(value > 0) + { + RETVAL = value; + } + else + { + warn( "SDL_MapRGBA failed: %s", SDL_GetError() ); + RETVAL = -1; + } + OUTPUT: RETVAL