File Coverage

blib/lib/Image/Caa/DitherOrdered2.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 4 0.0
total 25 29 86.2


line stmt bran cond sub pod time code
1             package Image::Caa::DitherOrdered2;
2            
3 2     2   13 use strict;
  2         4  
  2         105  
4 2     2   13 use warnings;
  2         4  
  2         1014  
5            
6             sub new {
7 2     2 0 6 my ($class, $args) = @_;
8            
9 2         8 my $self = bless {}, $class;
10            
11 2         17 return $self;
12             }
13            
14             sub init {
15 2     2 0 3 my ($self, $line) = @_;
16            
17 2         17 $self->{table} = [0x00, 0x80, 0xc0, 0x40];
18            
19 2         5 my $skip = ($line % 2) * 2;
20 2         7 shift @{$self->{table}} for 1..$skip;
  2         4  
21            
22 2         6 $self->{index} = 0;
23             }
24            
25             sub get {
26 16     16 0 18 my ($self) = @_;
27            
28 16         43 return $self->{table}->[$self->{index}];
29             }
30            
31             sub increment {
32 4     4 0 6 my ($self) = @_;
33            
34 4         130 $self->{index} = ($self->{index} + 1) % 2;
35             }
36            
37             1;