X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSDL%2FSurface.pm;h=5ba31f6e0886c1ed93d68a8bd3b6d661ac787ba9;hb=4447e1165b80878ce86f62c3e0023ab4098a639b;hp=a90604714119eca425c0b4ce265663d671e024cd;hpb=600a822e440ef6c38e13688e225c1dc9cf12ef32;p=sdlgit%2FSDL_perl.git diff --git a/lib/SDL/Surface.pm b/lib/SDL/Surface.pm index a906047..5ba31f6 100644 --- a/lib/SDL/Surface.pm +++ b/lib/SDL/Surface.pm @@ -37,7 +37,7 @@ use SDL; use SDL::SFont; use SDL::Color; use SDL::Rect; - +use Data::Dumper; sub new { my $proto = shift; my $class = ref($proto) || $proto; @@ -163,14 +163,10 @@ sub pixel { } 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 { - SDL::FillRect(${$_[0]},${$_[1]},${$_[2]}); + SDL::FillRect(${$_[0]},$_[1],${$_[2]}); } } @@ -202,18 +198,17 @@ sub flip { } sub blit { + $_[1] = 0 unless defined $_[1]; + $_[3] = 0 unless defined $_[3]; + if ($SDL::DEBUG) { - carp "/n SDL::Surface::blit accepting undef is depreceated use SDL::NULL" if ( !defined($_[1]) || !defined($_[3]) ); croak "SDL::Surface::blit requires SDL::Rect objects" unless ($_[1] == 0 || $_[1]->isa('SDL::Rect')) && ($_[3] == 0 || $_[3]->isa('SDL::Rect')); croak "SDL::Surface::blit requires SDL::Surface objects" unless $_[2]->isa('SDL::Surface'); } - - $_[1] = 0 unless defined $_[1]; - $_[3] = 0 unless defined $_[3]; - SDL::BlitSurface(map { (defined($_) && $_ != 0)? ${$_} : $_ } @_) if defined(@_); + SDL::BlitSurface( $_[0], $_[1], ${$_[2]}, $_[3]); } sub set_colors {