From: Kartik Thakore Date: Sun, 1 Nov 2009 18:10:10 +0000 (-0500) Subject: Added SDL::Video::covert_surface and test. 44% of SDL::Video X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ffe802d54b3f794ce1f581fd8a989f86c5912780;p=sdlgit%2FSDL_perl.git Added SDL::Video::covert_surface and test. 44% of SDL::Video --- diff --git a/src/Core/Video.xs b/src/Core/Video.xs index 87b348c..6b3b8be 100644 --- a/src/Core/Video.xs +++ b/src/Core/Video.xs @@ -280,3 +280,15 @@ video_unlock_surface ( surface ) CODE: SDL_UnlockSurface(surface); + +SDL_Surface * +video_convert_surface( src, fmt, flags) + SDL_Surface* src + SDL_PixelFormat* fmt + Uint32 flags + PREINIT: + char *CLASS = "SDL::Surface"; + CODE: + RETVAL = SDL_ConvertSurface(src, fmt, flags); + OUTPUT: + RETVAL diff --git a/t/core_video.t b/t/core_video.t index 93c5b99..4897dd8 100644 --- a/t/core_video.t +++ b/t/core_video.t @@ -9,7 +9,7 @@ use Data::Dumper; use Test::More; use SDL::Rect; -plan ( tests => 23); +plan ( tests => 24); use_ok( 'SDL::Video' ); @@ -32,6 +32,8 @@ my @done = map_RGBA unlock_surface lock_surface + convert_surface + /; can_ok ('SDL::Video', @done); @@ -119,11 +121,13 @@ SDL::Video::unlock_surface($hwdisplay); pass '[unlock_surface] ran'; is( SDL::Video::map_RGB($hwdisplay->format, 10, 10 ,10) > 0, 1, '[map_RGB] maps correctly to 8-bit surface'); is( SDL::Video::map_RGBA($hwdisplay->format, 10, 10 ,10, 10) > 0, 1, '[map_RGBA] maps correctly to 8-bit surface'); +isa_ok(SDL::Video::convert_surface( $display , $hwdisplay->format, SDL_SRCALPHA), 'SDL::Surface', '[convert_surface] Checking if we get a surface ref back'); + + my @left = qw/ get_gamma_ramp get_RGB get_RGBA - convert_surface display_format display_format_alpha load_BMP