From: Leon Brocard Date: Fri, 16 Oct 2009 14:39:21 +0000 (+0100) Subject: Move update_rects out of Surface.xs and make SDL::UpdateRects work X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=14158e5a367dee2f013905e5e2ee2bf3b33581b6;p=sdlgit%2FSDL_perl.git Move update_rects out of Surface.xs and make SDL::UpdateRects work --- diff --git a/src/Core/objects/Surface.xs b/src/Core/objects/Surface.xs index 33c95e5..574731c 100644 --- a/src/Core/objects/Surface.xs +++ b/src/Core/objects/Surface.xs @@ -54,26 +54,6 @@ surface_format ( surface ) OUTPUT: RETVAL -void -surface_update_rects ( surface, ... ) - SDL_Surface *surface - CODE: - SDL_Rect *rects, *temp; - int num_rects,i; - if ( items < 2 ) return; - num_rects = items - 1; - - rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items); - for(i=0;ix; - rects[i].y = temp->y; - rects[i].w = temp->w; - rects[i].h = temp->h; - } - SDL_UpdateRects(surface,num_rects,rects); - safefree(rects); - Uint16 surface_pitch( surface ) SDL_Surface *surface diff --git a/src/SDL.xs b/src/SDL.xs index 7994608..aa949e0 100644 --- a/src/SDL.xs +++ b/src/SDL.xs @@ -1312,6 +1312,21 @@ DisplayFormatAlpha ( surface ) OUTPUT: RETVAL +void +UpdateRects ( surface, ... ) + SDL_Surface *surface + CODE: + SDL_Rect *rects; + int num_rects,i; + if ( items < 2 ) return; + num_rects = items - 1; + rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items); + for(i=0;ix; - rects[i].y = temp->y; - rects[i].w = temp->w; - rects[i].h = temp->h; - } - SDL_UpdateRects(surface,num_rects,rects); - safefree(rects); - int Flip ( surface ) SDL_Surface *surface diff --git a/t/core_surface.t b/t/core_surface.t index d81eaf0..9e715e9 100644 --- a/t/core_surface.t +++ b/t/core_surface.t @@ -92,6 +92,7 @@ my $rect = SDL::Rect->new( 0, 0, $app->w, $app->h ); my $blue_pixel = SDL::MapRGB( $app_pixel_format, 0x00, 0x00, 0xff ); SDL::FillRect( $app, $rect, $blue_pixel ); SDL::UpdateRect( $app, 0, 0, 0, 0 ); +SDL::UpdateRects( $app, $small_rect ); diag( 'This is in surface : ' . SDL::Surface::get_pixels($app) );