}
sub fill {
- croak "SDL::Surface::fill requires a SDL::Rect object"
- unless !$SDL::DEBUG || $_[1] == 0 || $_[1]->isa('SDL::Rect');
- croak "SDL::Surface::fill requires a SDL::Color object"
- unless !$SDL::DEBUG || $_[2]->isa('SDL::Color');
if ($_[1] == 0 ) {
SDL::FillRect(${$_[0]},0,${$_[2]});
} else {
UpdateRects ( surface, ... )
SDL_Surface *surface
CODE:
- SDL_Rect *rects, *temp;
+ SDL_Rect *rects, *oldrects, *temp;
int num_rects,i;
if ( items < 2 ) return;
- num_rects = items - 1;
+ num_rects = items - 1;
+ oldrects = rects;
rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items);
for(i=0;i<num_rects;i++) {
temp = (SDL_Rect *)SvIV(ST(i+1));
}
SDL_UpdateRects(surface,num_rects,rects);
safefree(rects);
+ safefree(oldrects);
int
Flip ( surface )
if ( SDL::Config->has('SDL_mixer') ) {
plan ( tests => 3 );
-} else {
+}
+elsif ( SDL::Init(SDL_INIT_AUDIO) < 0) {
+ plan( skip_all => "Cannot initialize audio!!" );
+ }
+else {
plan ( skip_all => 'SDL_mixer support not compiled' );
}
/);
-if ( SDL::Init(SDL_INIT_AUDIO) < 0) {
- plan( skip_all => "Cannot initialize audio!!" );
- }
-
# these are exported by default, so main:: should know them:
my $mixer = SDL::Mixer->new();
isa_ok($mixer, 'SDL::Mixer', 'Checking if mixer can be build');
sub surface_leak()
{
use SDL;
- use SDL::Surface;
+ use SDL::App;
use SDL::Rect;
use SDL::Color;
- my $window = SDL::Surface->new(
+ my $window = SDL::App->new(
-width => 640,
-height => 480,
-depth => 16,