From: Leon Brocard Date: Mon, 2 Nov 2009 16:25:04 +0000 (+0000) Subject: Implement fill_rect X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f483bc9701342086ca864a0e3a3415ce186ccf92;p=sdlgit%2FSDL_perl.git Implement fill_rect --- diff --git a/src/Core/Video.xs b/src/Core/Video.xs index b6af462..a942519 100644 --- a/src/Core/Video.xs +++ b/src/Core/Video.xs @@ -383,3 +383,13 @@ save_BMP ( surface, filename ) RETVAL = SDL_SaveBMP(surface,filename); OUTPUT: RETVAL + +int +fill_rect ( dest, dest_rect, pixel ) + SDL_Surface *dest + SDL_Rect *dest_rect + Uint32 pixel + CODE: + RETVAL = SDL_FillRect(dest,dest_rect,pixel); + OUTPUT: + RETVAL diff --git a/src/SDL.xs b/src/SDL.xs index d96bb7a..d041c67 100644 --- a/src/SDL.xs +++ b/src/SDL.xs @@ -1247,16 +1247,6 @@ ConvertRGBA ( surface ) =cut -int -FillRect ( dest, dest_rect, pixel ) - SDL_Surface *dest - SDL_Rect *dest_rect - Uint32 pixel - CODE: - RETVAL = SDL_FillRect(dest,dest_rect,pixel); - OUTPUT: - RETVAL - Uint8 GetAppState () CODE: diff --git a/t/core_surface.t b/t/core_surface.t index 7cad96f..65df447 100644 --- a/t/core_surface.t +++ b/t/core_surface.t @@ -59,7 +59,7 @@ is( $pixel_format->alpha, 255, '255 alpha' ); my $pixel = SDL::Video::map_RGB( $pixel_format, 255, 127, 0 ); is( $pixel, 32767, '32767 pixel' ); -SDL::FillRect( $surface, SDL::Rect->new( 0, 0, 32, 32 ), $pixel ); +SDL::Video::fill_rect( $surface, SDL::Rect->new( 0, 0, 32, 32 ), $pixel ); ok( 1, 'Managed to fill_rect' ); my $small_rect = SDL::Rect->new( 0, 0, 64, 64 ); @@ -92,7 +92,7 @@ my $app_pixel_format = $app->format; my $rect = SDL::Rect->new( 0, 0, $app->w, $app->h ); my $blue_pixel = SDL::Video::map_RGB( $app_pixel_format, 0x00, 0x00, 0xff ); -SDL::FillRect( $app, $rect, $blue_pixel ); +SDL::Video::fill_rect( $app, $rect, $blue_pixel ); SDL::Video::update_rect( $app, 0, 0, 0, 0 ); SDL::Video::update_rects( $app, $small_rect ); diff --git a/t/core_video.t b/t/core_video.t index eadce44..fa52fdb 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 => 32); +plan ( tests => 33); use_ok( 'SDL::Video' ); @@ -41,6 +41,7 @@ my @done = get_RGBA load_BMP save_BMP + fill_rect /; can_ok ('SDL::Video', @done); @@ -153,12 +154,15 @@ my $bmp_surface = SDL::Video::load_BMP($bmp); isa_ok($bmp_surface, 'SDL::Surface', '[load_BMP] returns an SDL::Surface'); unlink($bmp) if -f $bmp; +my $pixel = SDL::Video::map_RGB( $display->format, 255, 127, 0 ); +SDL::Video::fill_rect( $display, SDL::Rect->new( 0, 0, 32, 32 ), $pixel ); +ok( 1, '[fill_rect] filled rect' ); + my @left = qw/ get_gamma_ramp set_clip_rect get_clip_rect blit_surface - fill_rect GL_load_library GL_get_proc_address GL_get_attribute diff --git a/t/intergation1.t b/t/intergation1.t index 19cf0b1..131bfb9 100644 --- a/t/intergation1.t +++ b/t/intergation1.t @@ -76,8 +76,8 @@ can_ok ('SDL::App', qw/ $grect->x($_ ); $grect->centery($_ * 3); $grect->size( ($_ / 40) * $_, ($_/38) * $_ ); - SDL::FillRect( $app, $rect, $blue_pixel ); - SDL::FillRect( $app, $grect, $col_pixel ); + SDL::Video::fill_rect( $app, $rect, $blue_pixel ); + SDL::Video::fill_rect( $app, $grect, $col_pixel ); SDL::Video::update_rect($app, 0, 0, 640, 480); SDL::delay(10);