Added fix for SDL::Surface->format. Fixed test and typemap if SDL::NULL (0) is passed...
Kartik Thakore [Sat, 24 Oct 2009 00:22:30 +0000 (20:22 -0400)]
src/Core/Video.xs
src/Core/objects/Surface.xs
t/core_video.t
typemap

index 753bca6..caf83fc 100644 (file)
@@ -58,6 +58,7 @@ AV*
 list_modes ( format, flags )
        Uint32 flags
        SDL_PixelFormat *format
+
        CODE:
                SDL_Rect **mode;
                RETVAL = newAV();
index 574731c..d0e96ac 100644 (file)
@@ -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
index 66c9503..5ae1ee4 100644 (file)
@@ -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 (file)
--- 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;
        }