Brought all packages under eye of strict, warnings and love of Carp, For
[sdlgit/SDL_perl.git] / lib / SDL / Tool / Graphic.pm
index 049b31d..780fdc2 100644 (file)
@@ -6,6 +6,9 @@
 
 package SDL::Tool::Graphic;
 
+use strict;
+use warnings;
+use Carp;
 use SDL;
 use SDL::Config;
 require SDL::Surface;
@@ -13,7 +16,7 @@ require SDL::Surface;
 sub new {
        my $proto = shift;
        my $class = ref($proto) || $proto;
-       $self = {};
+       my $self = {};
        bless $self, $class;
        $self;
 }
@@ -26,7 +29,7 @@ sub DESTROY {
 
 sub zoom {
        my ( $self, $surface, $zoomx, $zoomy, $smooth) = @_;
-       die "SDL::Tool::Graphic::zoom requires an SDL::Surface\n"
+       croak "SDL::Tool::Graphic::zoom requires an SDL::Surface\n"
                unless ( ref($surface) && $surface->isa('SDL::Surface'));
        my $tmp = $$surface;
        $$surface = SDL::GFXZoom($$surface, $zoomx, $zoomy, $smooth);
@@ -36,7 +39,7 @@ sub zoom {
 
 sub rotoZoom {
        my ( $self, $surface, $angle, $zoom, $smooth) = @_;
-       die "SDL::Tool::Graphic::rotoZoom requires an SDL::Surface\n"
+       croak "SDL::Tool::Graphic::rotoZoom requires an SDL::Surface\n"
                unless ( ref($surface) && $surface->isa('SDL::Surface'));
        my $tmp = $$surface;
        $$surface = SDL::GFXRotoZoom($$surface, $angle, $zoom, $smooth);
@@ -46,8 +49,9 @@ sub rotoZoom {
 
 sub grayScale {
        my ( $self, $surface ) = @_;
+       my $workingSurface;
        if($surface->isa('SDL::Surface')) {
-               $workingSurface = $$surface;
+                $workingSurface = $$surface;
        } else {
                $workingSurface = $surface;
        }
@@ -71,6 +75,7 @@ sub grayScale {
  
 sub invertColor {
        my ( $self, $surface ) = @_;
+       my $workingSurface;
        if($surface->isa('SDL::Surface')) {
                $workingSurface = $$surface;
        } else {
@@ -93,7 +98,7 @@ sub invertColor {
        }
 }
 
-die "SDL::Tool::Graphic requires SDL_gfx support\n"
+croak "SDL::Tool::Graphic requires SDL_gfx support\n"
        unless SDL::Config->has('SDL_gfx');