SWF/Tag/Lossless.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 57 CC 4 SCAR 14.8
CC
4
Cov
0%
parseContent
6.0
dumpContent
6.0
buildContent
6.0
CRAP 4.4
1 package IO::SWF::Tag::Lossless;
2  
3 use strict;
4 use warnings;
5  
6 use base 'IO::SWF::Tag::Base';
7  
8 use IO::SWF::Bit;
9  
10 __PACKAGE__->mk_accessors( qw(
11 _CharacterID
12 _BitmapFormat
13 _BitmapWidth
14 _BitmapHeight
15 _BitmapColorTableSize
16 _ZlibBitmapFormat
17 ));
18  
19 sub parseContent {
20 my ($self, $tagCode, $content, $opts_href) = @_;
21  
22 my $reader = IO::SWF::Bit->new();
23 $reader->input($content);
24 $self->_CharacterID($reader->getUI16LE());
25 my $bitmapFormat = $reader->getUI8();
26 $self->_BitmapFormat($bitmapFormat);
27 $self->_BitmapWidth($reader->getUI16LE());
28 $self->_BitmapHeight($reader->getUI16LE());
29 if ($bitmapFormat == 3) {
30 $self->_BitmapColorTableSize($reader->getUI8() + 1);
31 }
32 $self->_ZlibBitmapFormat($reader->getDataUntil());
33 }
34  
35 sub dumpContent {
36 my ($self, $tagCode, $opts_href) = @_;
37 my $bitmapFormat = $self->_BitmapFormat;
38 print "\tCharacterID:{".$self->_CharacterID."} BitmapFormat={$bitmapFormat}\n";
39 print "\tBitmapWidth:{".$self->_BitmapWidth."} BitmapHeight:{".$self->_BitmapHeight."}\n";
40 if ($bitmapFormat == 3) {
41 print "\tBitmapColorTableSize:{".$self->_BitmapColorTableSize."}\n";
42 }
43 }
44  
45 sub buildContent {
46 my ($self, $tagCode, $opts_href) = @_;
47 my $writer = IO::SWF::Bit->new();
48 $writer->putUI16LE($self->_CharacterID);
49 my $bitmapFormat = $self->_BitmapFormat;
50 $writer->putUI8($bitmapFormat);
51 $writer->putUI16LE($self->_BitmapWidth);
52 $writer->putUI16LE($self->_BitmapHeight);
53 if ($bitmapFormat == 3) {
54 $writer->putUI8($self->_BitmapColorTableSize - 1);
55 }
56 $writer->putData($self->_ZlibBitmapFormat);
57 return $writer->output();
58 }
59  
60 1;