From: Kartik Thakore Date: Mon, 2 Nov 2009 19:51:35 +0000 (-0500) Subject: Implemented display, [un]lock _YUV_overlay. 84% done X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1639a330749f99349ede0e4ead61503f46f7bb53;p=sdlgit%2FSDL_perl.git Implemented display, [un]lock _YUV_overlay. 84% done --- diff --git a/src/Core/Video.xs b/src/Core/Video.xs index b7e8706..4c4c316 100644 --- a/src/Core/Video.xs +++ b/src/Core/Video.xs @@ -418,3 +418,30 @@ get_clip_rect ( surface, rect ) SDL_Rect *rect; CODE: SDL_GetClipRect(surface, rect); + + + +int +video_lock_YUV_overlay ( overlay ) + SDL_Overlay *overlay + CODE: + RETVAL = SDL_LockYUVOverlay(overlay); + OUTPUT: + RETVAL + +void +video_unlock_YUV_overlay ( overlay ) + SDL_Overlay *overlay + CODE: + SDL_UnlockYUVOverlay(overlay); + +int +video_display_YUV_overlay ( overlay, dstrect ) + SDL_Overlay *overlay + SDL_Rect *dstrect + CODE: + RETVAL = SDL_DisplayYUVOverlay ( overlay, dstrect ); + OUTPUT: + RETVAL + + diff --git a/src/SDL.xs b/src/SDL.xs index 1e38e3f..dfec9df 100644 --- a/src/SDL.xs +++ b/src/SDL.xs @@ -2482,30 +2482,6 @@ NetRead32 ( area ) RETVAL #endif - -int -LockYUVOverlay ( overlay ) - SDL_Overlay *overlay - CODE: - RETVAL = SDL_LockYUVOverlay(overlay); - OUTPUT: - RETVAL - -void -UnlockYUVOverlay ( overlay ) - SDL_Overlay *overlay - CODE: - SDL_UnlockYUVOverlay(overlay); - -int -DisplayYUVOverlay ( overlay, dstrect ) - SDL_Overlay *overlay - SDL_Rect *dstrect - CODE: - RETVAL = SDL_DisplayYUVOverlay ( overlay, dstrect ); - OUTPUT: - RETVAL - Uint32 OverlayFormat ( overlay, ... ) SDL_Overlay *overlay diff --git a/t/core_video.t b/t/core_video.t index 93b3b76..9a37f5c 100644 --- a/t/core_video.t +++ b/t/core_video.t @@ -4,12 +4,13 @@ use SDL; use SDL::Color; use SDL::Surface; use SDL::Config; +use SDL::Overlay; use Devel::Peek; use Data::Dumper; use Test::More; use SDL::Rect; -plan ( tests => 41); +plan ( tests => 44); use_ok( 'SDL::Video' ); @@ -45,6 +46,9 @@ my @done = blit_surface set_clip_rect get_clip_rect + lock_YUV_overlay + unlock_YUV_overlay + display_YUV_overlay /; can_ok ('SDL::Video', @done); @@ -104,6 +108,14 @@ my @b_w_colors; for(my $i=0;$i<256;$i++){ $b_w_colors[$i] = SDL::Color->new($i,$i,$i); } +my $overlay = SDL::Overlay->new(200 , 220, SDL_IYUV_OVERLAY, $display); + +is( SDL::Video::lock_YUV_overlay($overlay), 0, '[lock_YUV_overlay] returns a 0 on success'); +SDL::Video::unlock_YUV_overlay($overlay); pass '[unlock_YUV_overlay] ran'; +my $display_at_rect = SDL::Rect->new(0, 0, 100, 100); +is( SDL::Video::display_YUV_overlay( $overlay, $display_at_rect), 0 ,'[display_YUV_overlay] returns 0 on success'); + + my $hwdisplay = SDL::Video::set_video_mode(640,480,8, SDL_HWSURFACE ); if(!$hwdisplay){ @@ -182,9 +194,6 @@ my @left = qw/ GL_set_attribute GL_swap_buffers GL_attr - lock_YUV_overlay - unlock_YUV_overlay - display_YUV_overlay /; my $why = '[Percentage Completion] '.int( 100 * $#done / ($#done + $#left) ) ."\% implementation. $#done / ".($#done+$#left);