From: Leon Brocard Date: Fri, 16 Oct 2009 08:21:06 +0000 (+0100) Subject: Fix DisplayFormat and DisplayFormatAlpha X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=41a5a9ee0bf90bbcb745b57930e6fc5e8a5bd36f;p=sdlgit%2FSDL_perl.git Fix DisplayFormat and DisplayFormatAlpha --- diff --git a/src/Surface.xs b/src/Surface.xs index f3805db..b3c5477 100644 --- a/src/Surface.xs +++ b/src/Surface.xs @@ -111,11 +111,20 @@ SDL_Surface * surface_display ( surface ) SDL_Surface *surface CODE: - char* CLASS = 'SDL::Surface\0'; + char* CLASS = "SDL::Surface"; RETVAL = SDL_DisplayFormat(surface); OUTPUT: RETVAL +SDL_Surface * +surface_display_alpha ( surface ) + SDL_Surface *surface + CODE: + char* CLASS = "SDL::Surface"; + RETVAL = SDL_DisplayFormatAlpha(surface); + OUTPUT: + RETVAL + Uint16 surface_pitch( surface ) SDL_Surface *surface @@ -165,7 +174,6 @@ surface_set_pixels(surface, pixels) len = surface->pitch*surface->h; memcpy(surface->pixels, p, len); - void surface_DESTROY(surface) SDL_Surface *surface diff --git a/t/core_surface.t b/t/core_surface.t index 7878582..6b931b4 100644 --- a/t/core_surface.t +++ b/t/core_surface.t @@ -15,7 +15,7 @@ use SDL::Surface; use SDL::App; use SDL::Rect; use SDL::Color; -use Test::More tests => 15; +use Test::More tests => 17; my $surface = SDL::Surface->new( SDL::SDL_ANYFORMAT(), 640, 320, 8, 0, 0, 0, 0 ); @@ -58,6 +58,12 @@ my $app = SDL::App->new( pass 'did this pass'; +my $image_format = $image->display; +isa_ok( $image_format, 'SDL::Surface' ); + +my $image_format_alpha = $image->display_alpha; +isa_ok( $image_format_alpha, 'SDL::Surface' ); + my $rect = SDL::Rect->new( 0, 0, $app->w, $app->h ); my $blue = SDL::Color->new( 0x00, 0x00, 0xff, );