From: Kartik Thakore Date: Sat, 24 Oct 2009 00:22:30 +0000 (-0400) Subject: Added fix for SDL::Surface->format. Fixed test and typemap if SDL::NULL (0) is passed... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4510df283d92f39a68f8d6c65e3bbd75592f4254;p=sdlgit%2FSDL_perl.git Added fix for SDL::Surface->format. Fixed test and typemap if SDL::NULL (0) is passed as an O_OBJECT --- diff --git a/src/Core/Video.xs b/src/Core/Video.xs index 753bca6..caf83fc 100644 --- a/src/Core/Video.xs +++ b/src/Core/Video.xs @@ -58,6 +58,7 @@ AV* list_modes ( format, flags ) Uint32 flags SDL_PixelFormat *format + CODE: SDL_Rect **mode; RETVAL = newAV(); diff --git a/src/Core/objects/Surface.xs b/src/Core/objects/Surface.xs index 574731c..d0e96ac 100644 --- a/src/Core/objects/Surface.xs +++ b/src/Core/objects/Surface.xs @@ -48,8 +48,9 @@ surface_new (CLASS, flags, width, height, depth, Rmask, Gmask, Bmask, Amask ) SDL_PixelFormat * surface_format ( surface ) SDL_Surface *surface - CODE: + PREINIT: char* CLASS = "SDL::PixelFormat"; + CODE: RETVAL = surface->format; OUTPUT: RETVAL diff --git a/t/core_video.t b/t/core_video.t index 66c9503..5ae1ee4 100644 --- a/t/core_video.t +++ b/t/core_video.t @@ -1,8 +1,10 @@ #!/usr/bin/perl -w use strict; use SDL; +use SDL::Surface; use SDL::Config; use Devel::Peek; +use Data::Dumper; use Test::More; plan ( tests => 6 ); @@ -31,7 +33,7 @@ my $driver_name = SDL::Video::video_driver_name(); pass '[video_driver_name] This is your driver name: '.$driver_name; -#Dump( SDL::Video::video_driver_name() ); +Dump SDL::Video::list_modes( $display->format , SDL_HWSURFACE ); pass "Are we still alive?"; diff --git a/typemap b/typemap index ca2a9a0..b39c5d5 100644 --- a/typemap +++ b/typemap @@ -83,9 +83,10 @@ INPUT O_OBJECT if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) - $var = ($type)SvIV((SV*)SvRV( $arg )); + { $var = ($type)SvIV((SV*)SvRV( $arg )); } + else if ($arg == 0) + { XSRETURN(0); } else{ - warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; }