File Coverage

blib/lib/SDLx/Surface/TiedMatrixRow.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 0 1 0.0
total 29 30 96.6


line stmt bran cond sub pod time code
1             package SDLx::Surface::TiedMatrixRow;
2 10     10   60 use strict;
  10         16  
  10         256  
3 10     10   52 use warnings;
  10         22  
  10         265  
4 10     10   50 use base 'Tie::Array';
  10         18  
  10         3167  
5              
6             our $VERSION = 2.548;
7              
8             sub new {
9 10     10 0 22 my $class = shift;
10 10         17 my $matrix = shift;
11 10         17 my $y = shift;
12              
13 10         29 my $self = {
14             matrix => $matrix,
15             y => $y,
16             };
17              
18 10         40 return bless $self, $class;
19             }
20              
21             sub TIEARRAY {
22 10     10   33 return SDLx::Surface::TiedMatrixRow->new( $_[1], $_[2] );
23             }
24              
25             sub FETCH {
26 60     60   503 my ( $self, $x ) = @_;
27 60         178 $self->{matrix}->get_pixel( $x, $self->{y} );
28             }
29              
30             sub FETCHSIZE {
31              
32 4     4   11 my ( $self, $x ) = @_;
33 4         13 return $self->{matrix}->surface->w;
34              
35             }
36              
37             sub STORE {
38 6     6   17 my ( $self, $x, $new_value ) = @_;
39 6         22 $self->{matrix}->set_pixel( $x, $self->{y}, $new_value );
40             }
41              
42             1;