| 1 | package TUI::Views::View::Write; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: TView write member functions. | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 94 | ▶ | use 5.010; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 94 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 94 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 94 | our $VERSION = '2.000002'; | |||||||||||||||||||||||||||
| 9 | 94 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||
| 10 | 94 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 94 | ▶ | use Scalar::Util qw( weaken ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 94 | ▶ | use TUI::Drivers::Const qw( slNoShadow ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 94 | ▶ | use TUI::Drivers::ColorAttr; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 94 | ▶ | use TUI::Drivers::HardwareInfo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 94 | ▶ | use TUI::Drivers::HWMouse; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 94 | ▶ | use TUI::Drivers::Screen; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 94 | ▶ | use TUI::Drivers::ScreenCell; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 94 | ▶ | use TUI::Views::Const qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | sfVisible | ||||||||||||||||||||||||||||
| 22 | sfShadow | ||||||||||||||||||||||||||||
| 23 | 94 | ); | |||||||||||||||||||||||||||
| 24 | 94 | ▶ | use TUI::Views::View; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | # import global variables | ||||||||||||||||||||||||||||
| 27 | 94 | ▶ | use vars qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | $shadowSize | ||||||||||||||||||||||||||||
| 29 | $shadowAttr | ||||||||||||||||||||||||||||
| 30 | $screenBuffer | ||||||||||||||||||||||||||||
| 31 | 94 | ); | |||||||||||||||||||||||||||
| 32 | { | ||||||||||||||||||||||||||||
| 33 | 94 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | 94 | *shadowSize = \${ TView . '::shadowSize' }; | |||||||||||||||||||||||||||
| 35 | 94 | *shadowAttr = \${ TView . '::shadowAttr' }; | |||||||||||||||||||||||||||
| 36 | 94 | *screenBuffer = \${ TScreen . '::screenBuffer' }; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 94 | ▶ | use constant HIDEMOUSE => !!0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 40 | 94 | ▶ | use constant LEGACY => THardwareInfo->isa('TUI::Drivers::HardwareInfo::Win32'); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 94 | my $X = 0; | |||||||||||||||||||||||||||
| 43 | 94 | my $Y = 0; | |||||||||||||||||||||||||||
| 44 | 94 | my $Count = 0; | |||||||||||||||||||||||||||
| 45 | 94 | my $wOffset = 0; | |||||||||||||||||||||||||||
| 46 | 94 | my $Buffer = undef; | |||||||||||||||||||||||||||
| 47 | 94 | my $Target = undef; | |||||||||||||||||||||||||||
| 48 | 94 | my $edx = 0; | |||||||||||||||||||||||||||
| 49 | 94 | my $esi = 0; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 94 | ▶ | use subs qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 52 | L0 | ||||||||||||||||||||||||||||
| 53 | L10 | ||||||||||||||||||||||||||||
| 54 | L20 | ||||||||||||||||||||||||||||
| 55 | L30 | ||||||||||||||||||||||||||||
| 56 | L40 | ||||||||||||||||||||||||||||
| 57 | L50 | ||||||||||||||||||||||||||||
| 58 | copyCell | ||||||||||||||||||||||||||||
| 59 | copyCell2CharInfo | ||||||||||||||||||||||||||||
| 60 | applyShadow | ||||||||||||||||||||||||||||
| 61 | reversed | ||||||||||||||||||||||||||||
| 62 | 94 | ); | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub L0 { | ||||||||||||||||||||||||||
|
Subroutine
L0: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 65 | 0 | my ( $dest, $x, $y, $count, $b ) = @_; | |||||||||||||||||||||||||||
| 66 | 0 | $X = $x; | |||||||||||||||||||||||||||
| 67 | 0 | $Y = $y; | |||||||||||||||||||||||||||
| 68 | 0 | $Count = $count; | |||||||||||||||||||||||||||
| 69 | 0 | weaken( $Buffer = $b ); | |||||||||||||||||||||||||||
| 70 | 0 | $wOffset = $X; | |||||||||||||||||||||||||||
| 71 | 0 | $Count += $X; | |||||||||||||||||||||||||||
| 72 | 0 | $edx = 0; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 0 | ▶ | if ( 0 <= $Y && $Y < $dest->{size}{y} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
0 <= $Y and $Y < $dest->{"size"}{"y"}
MC/DC0%0/2
0 <= $Y and $Y < $dest->{"size"}{"y"}
0 <= $Y
$Y < $dest->{"size"}{"y"}
Truth table0%0/3
A and B
A= 0 <= $YB= $Y < $dest->{"size"}{"y"}
| |||||||||||||||||||||||||||||
| 75 | 0 | ▶ | $X = 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | if $X < 0; | ||||||||||||||||||||||||||||
| 77 | $Count = $dest->{size}{x} | ||||||||||||||||||||||||||||
| 78 | 0 | ▶ | if $Count > $dest->{size}{x}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | L10( $dest ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | if $X < $Count; | ||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | 0 | return; | |||||||||||||||||||||||||||
| 83 | } #/ sub L0 | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | ▶ | sub L10 { | ||||||||||||||||||||||||||
|
Subroutine
L10: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 86 | 0 | my ( $dest ) = @_; | |||||||||||||||||||||||||||
| 87 | 0 | my $owner = $dest->{owner}; | |||||||||||||||||||||||||||
| 88 | 0 | ▶ | if ( ( $dest->{state} & sfVisible ) && $owner ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dest->{"state"} & 1 and $owner
MC/DC0%0/2
$dest->{"state"} & 1 and $owner
$dest->{"state"} & 1
$owner
Truth table0%0/3
A and B
A= $dest->{"state"} & 1B= $owner
| |||||||||||||||||||||||||||||
| 89 | 0 | weaken( $Target = $dest ); | |||||||||||||||||||||||||||
| 90 | 0 | $Y += $dest->{origin}{y}; | |||||||||||||||||||||||||||
| 91 | 0 | $X += $dest->{origin}{x}; | |||||||||||||||||||||||||||
| 92 | 0 | $Count += $dest->{origin}{x}; | |||||||||||||||||||||||||||
| 93 | 0 | $wOffset += $dest->{origin}{x}; | |||||||||||||||||||||||||||
| 94 | 0 | ▶ | if ( $owner->{clip}{a}{y} <= $Y && $Y < $owner->{clip}{b}{y} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$owner->{"clip"}{"a"}{"y"} <= $Y and $Y < $owner->{"clip"}{"b"}{"y"}
MC/DC0%0/2
$owner->{"clip"}{"a"}{"y"} <= $Y and $Y < $owner->{"clip"}{"b"}{"y"}
$owner->{"clip"}{"a"}{"y"} <= $Y
$Y < $owner->{"clip"}{"b"}{"y"}
Truth table0%0/3
A and B
A= $owner->{"clip"}{"a"}{"y"} <= $YB= $Y < $owner->{"clip"}{"b"}{"y"}
| |||||||||||||||||||||||||||||
| 95 | $X = $owner->{clip}{a}{x} | ||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if $X < $owner->{clip}{a}{x}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | $Count = $owner->{clip}{b}{x} | ||||||||||||||||||||||||||||
| 98 | 0 | ▶ | if $Count > $owner->{clip}{b}{x}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | L20( $owner->{last} ) | ||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if $X < $Count; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | } #/ if ( ( $dest->{state} ...)) | ||||||||||||||||||||||||||||
| 103 | 0 | return; | |||||||||||||||||||||||||||
| 104 | } #/ sub L10 | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | ▶ | sub L20 { | ||||||||||||||||||||||||||
|
Subroutine
L20: not called CC=17 SCAR=57.2
| |||||||||||||||||||||||||||||
| 107 | 0 | my ( $dest ) = @_; | |||||||||||||||||||||||||||
| 108 | 0 | my $next = $dest->{next}; | |||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ( $next == $Target ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | L40( $next ); | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | else { | ||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if ( ( $next->{state} & sfVisible ) && $next->{origin}{y} <= $Y ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$next->{"state"} & 1 and $next->{"origin"}{"y"} <= $Y
MC/DC0%0/2
$next->{"state"} & 1 and $next->{"origin"}{"y"} <= $Y
$next->{"state"} & 1
$next->{"origin"}{"y"} <= $Y
Truth table0%0/3
A and B
A= $next->{"state"} & 1B= $next->{"origin"}{"y"} <= $Y
| |||||||||||||||||||||||||||||
| 114 | { # do | ||||||||||||||||||||||||||||
| 115 | 0 | $esi = $next->{origin}{y} + $next->{size}{y}; | |||||||||||||||||||||||||||
| 116 | 0 | ▶ | if ( $Y < $esi ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 117 | 0 | $esi = $next->{origin}{x}; | |||||||||||||||||||||||||||
| 118 | 0 | ▶ | if ( $X < $esi ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if ( $Count > $esi ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | 0 | L30( $next ); | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | else { | ||||||||||||||||||||||||||||
| 123 | 0 | last; | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | 0 | $esi += $next->{size}{x}; | |||||||||||||||||||||||||||
| 127 | 0 | ▶ | if ( $X < $esi ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | 0 | ▶ | if ( $Count > $esi ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | 0 | $X = $esi; | |||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | else { | ||||||||||||||||||||||||||||
| 132 | 0 | return; | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if ( ( $next->{state} & sfShadow ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$next->{"state"} & 8 and $next->{"origin"}{"y"} + $TUI::Views::View::Write::shadowSize->{"y"} <= $Y
MC/DC0%0/2
$next->{"state"} & 8 and $next->{"origin"}{"y"} + $TUI::Views::View::Write::shadowSize->{"y"} <= $Y
$next->{"state"} & 8
$next->{"origin"}{"y"} + $TUI::Views::View::Write::shadowSize->{"y"} <= $Y
Truth table0%0/3
A and B
A= $next->{"state"} & 8B= $next->{"origin"}{"y"} + $TUI::Views::View::Write::shadowSize->{"y"} <= $Y
| |||||||||||||||||||||||||||||
| 136 | && $next->{origin}{y} + $shadowSize->{y} <= $Y ) | ||||||||||||||||||||||||||||
| 137 | { | ||||||||||||||||||||||||||||
| 138 | 0 | $esi += $shadowSize->{x}; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | else { | ||||||||||||||||||||||||||||
| 141 | 0 | last; | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | } #/ if ( $Y < $esi ) | ||||||||||||||||||||||||||||
| 144 | ▶ | elsif ( ( $next->{state} & sfShadow ) | |||||||||||||||||||||||||||
|
Condition0%0/3
$next->{"state"} & 8 and $Y < $esi + $TUI::Views::View::Write::shadowSize->{"y"}
MC/DC0%0/2
$next->{"state"} & 8 and $Y < $esi + $TUI::Views::View::Write::shadowSize->{"y"}
$next->{"state"} & 8
$Y < $esi + $TUI::Views::View::Write::shadowSize->{"y"}
Truth table0%0/3
A and B
A= $next->{"state"} & 8B= $Y < $esi + $TUI::Views::View::Write::shadowSize->{"y"}
| |||||||||||||||||||||||||||||
| 145 | && $Y < $esi + $shadowSize->{y} | ||||||||||||||||||||||||||||
| 146 | ) { | ||||||||||||||||||||||||||||
| 147 | 0 | $esi = $next->{origin}{x} + $shadowSize->{x}; | |||||||||||||||||||||||||||
| 148 | 0 | ▶ | if ( $X < $esi ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if ( $Count > $esi ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | 0 | L30( $next ); | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | else { | ||||||||||||||||||||||||||||
| 153 | 0 | last; | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||
| 156 | 0 | $esi += $next->{size}{x}; | |||||||||||||||||||||||||||
| 157 | } #/ elsif ( ( $next->{state} ...)) | ||||||||||||||||||||||||||||
| 158 | else { | ||||||||||||||||||||||||||||
| 159 | 0 | last; | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if ( $X < $esi ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | 0 | $edx++; | |||||||||||||||||||||||||||
| 163 | 0 | ▶ | if ( $Count > $esi ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 0 | L30( $next ); | |||||||||||||||||||||||||||
| 165 | 0 | $edx--; | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | } # while ( 0 ); | ||||||||||||||||||||||||||||
| 169 | } #/ if ( ( $next->{state} ...)) | ||||||||||||||||||||||||||||
| 170 | 0 | L20( $next ); | |||||||||||||||||||||||||||
| 171 | } #/ else [ if ( $next == ...)] | ||||||||||||||||||||||||||||
| 172 | 0 | return; | |||||||||||||||||||||||||||
| 173 | } #/ sub L20 | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | ▶ | sub L30 { | ||||||||||||||||||||||||||
|
Subroutine
L30: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 176 | 0 | my ( $dest ) = @_; | |||||||||||||||||||||||||||
| 177 | 0 | my $_Target = $Target; | |||||||||||||||||||||||||||
| 178 | 0 | my $_wOffset = $wOffset; | |||||||||||||||||||||||||||
| 179 | 0 | my $_esi = $esi; | |||||||||||||||||||||||||||
| 180 | 0 | my $_edx = $edx; | |||||||||||||||||||||||||||
| 181 | 0 | my $_count = $Count; | |||||||||||||||||||||||||||
| 182 | 0 | my $_y = $Y; | |||||||||||||||||||||||||||
| 183 | 0 | $Count = $esi; | |||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 0 | L20( $dest ); | |||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | $Y = $_y; | |||||||||||||||||||||||||||
| 188 | 0 | $Count = $_count; | |||||||||||||||||||||||||||
| 189 | 0 | $edx = $_edx; | |||||||||||||||||||||||||||
| 190 | 0 | $esi = $_esi; | |||||||||||||||||||||||||||
| 191 | 0 | $wOffset = $_wOffset; | |||||||||||||||||||||||||||
| 192 | 0 | weaken( $Target = $_Target ); | |||||||||||||||||||||||||||
| 193 | 0 | $X = $esi; | |||||||||||||||||||||||||||
| 194 | 0 | return; | |||||||||||||||||||||||||||
| 195 | } #/ sub L30 | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 0 | ▶ | sub L40 { | ||||||||||||||||||||||||||
|
Subroutine
L40: not called CC=4 SCAR=26.1
| |||||||||||||||||||||||||||||
| 198 | 0 | my ( $dest ) = @_; | |||||||||||||||||||||||||||
| 199 | 0 | my $owner = $dest->{owner}; | |||||||||||||||||||||||||||
| 200 | 0 | ▶ | if ( $owner->{buffer} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 201 | 94 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 202 | 0 | ▶ | if ( $owner->{buffer} != $screenBuffer ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 203 | 0 | L50( $owner ); | |||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||
| 205 | else { | ||||||||||||||||||||||||||||
| 206 | 0 | THWMouse->hide() if HIDEMOUSE; | |||||||||||||||||||||||||||
| 207 | 0 | L50( $owner ); | |||||||||||||||||||||||||||
| 208 | 0 | THWMouse->show() if HIDEMOUSE; | |||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | } #/ if ( $owner->{buffer} ) | ||||||||||||||||||||||||||||
| 211 | L10( $owner ) | ||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if $owner->{lockFlag} == 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | 0 | return; | |||||||||||||||||||||||||||
| 214 | } #/ sub L40 | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 0 | ▶ | sub L50 { | ||||||||||||||||||||||||||
|
Subroutine
L50: not called CC=2 SCAR=15.1
| |||||||||||||||||||||||||||||
| 217 | 0 | my ( $owner ) = @_; | |||||||||||||||||||||||||||
| 218 | 0 | alias: my $dst = do { | |||||||||||||||||||||||||||
| 219 | 0 | my ( $a, $b ) = ( $Y * $owner->{size}{x} + $X, $#{ $owner->{buffer} } ); | |||||||||||||||||||||||||||
| 220 | 0 | ▶ | sub { \@_ }->( @{ $owner->{buffer} }[ $a .. $b ] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 221 | }; | ||||||||||||||||||||||||||||
| 222 | 0 | alias: my $src = do { | |||||||||||||||||||||||||||
| 223 | 0 | my ( $a, $b ) = ( $X - $wOffset, $#$Buffer ); | |||||||||||||||||||||||||||
| 224 | 0 | ▶ | sub { \@_ }->( @$Buffer[ $a .. $b ] ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 225 | }; | ||||||||||||||||||||||||||||
| 226 | 94 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 227 | 0 | ▶ | if ( $owner->{buffer} != $screenBuffer ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 228 | 0 | copyCell( $dst, $src ); | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | else { | ||||||||||||||||||||||||||||
| 231 | 0 | LEGACY | |||||||||||||||||||||||||||
| 232 | ? copyCell2CharInfo( $dst, $src ) | ||||||||||||||||||||||||||||
| 233 | : copyCell( $dst, $src ); | ||||||||||||||||||||||||||||
| 234 | 0 | THardwareInfo->screenWrite( $X, $Y, $dst, $Count - $X ); | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | 0 | return; | |||||||||||||||||||||||||||
| 237 | } #/ sub L50 | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | # Our Turbo Vision port stores a TScreenCharacter for text and a TColorAttr for | ||||||||||||||||||||||||||||
| 240 | # attributes for every cell. On Windows, all TGroup buffers follow this schema | ||||||||||||||||||||||||||||
| 241 | # except the topmost one, which interfaces with the Win32 Console API. | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | 0 | ▶ | sub copyCell2CharInfo { | ||||||||||||||||||||||||||
|
Subroutine
copyCell2CharInfo: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 244 | 0 | my ( $dst, $src ) = @_; | |||||||||||||||||||||||||||
| 245 | 0 | my $i; | |||||||||||||||||||||||||||
| 246 | 0 | ▶ | if ( $edx == 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 247 | # Expand character/attribute pair | ||||||||||||||||||||||||||||
| 248 | 0 | ▶ | for ( $i = 0 ; $i < $Count - $X ; ++$i ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 249 | 0 | my $c = $src->[$i]; | |||||||||||||||||||||||||||
| 250 | 0 | my $ch = ord $c->character->getText(); | |||||||||||||||||||||||||||
| 251 | 0 | my $attr = $c->attribute->asBIOS(); | |||||||||||||||||||||||||||
| 252 | 0 | splice( @$dst, 2 * $i, 2, $ch, $attr ); | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | else { | ||||||||||||||||||||||||||||
| 256 | # Mix in shadow attribute | ||||||||||||||||||||||||||||
| 257 | 0 | ▶ | for ( $i = 0 ; $i < $Count - $X ; ++$i ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | 0 | my $c = $src->[$i]; | |||||||||||||||||||||||||||
| 259 | 0 | my $ch = ord $c->character->getText(); | |||||||||||||||||||||||||||
| 260 | 0 | my $attr = applyShadow( $c->attribute )->asBIOS(); | |||||||||||||||||||||||||||
| 261 | 0 | splice( @$dst, 2 * $i, 2, $ch, $attr ); | |||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | 0 | return; | |||||||||||||||||||||||||||
| 265 | } #/ sub copyCell2CharInfo | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | 0 | ▶ | sub copyCell { | ||||||||||||||||||||||||||
|
Subroutine
copyCell: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 268 | 0 | my ( $dst, $src ) = @_; | |||||||||||||||||||||||||||
| 269 | 0 | ▶ | if ( $edx == 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 270 | 0 | ▶ | for ( my $i = 0 ; $i < $Count - $X ; ++$i ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 271 | # The following lines manually copy the contents of the source cell to | ||||||||||||||||||||||||||||
| 272 | # the destination cell. it is equivalent to using the assign method: | ||||||||||||||||||||||||||||
| 273 | # $dst->[$i]->assign( $src->[$i] ); | ||||||||||||||||||||||||||||
| 274 | 0 | ${ $dst->[$i][0] } = ${ $src->[$i][0] }; | |||||||||||||||||||||||||||
| 275 | 0 | ${ $dst->[$i][1] } = ${ $src->[$i][1] }; | |||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | else { | ||||||||||||||||||||||||||||
| 279 | 0 | ▶ | for ( my $i = 0 ; $i < $Count - $X ; ++$i ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 280 | 0 | ${ $dst->[$i][0] } = ${ $src->[$i][0] }; | |||||||||||||||||||||||||||
| 281 | 0 | ${ $dst->[$i][1] } = ${ applyShadow( $src->[$i]->attribute ) }; | |||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||
| 284 | 0 | return; | |||||||||||||||||||||||||||
| 285 | } #/ sub copyCell | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | 0 | ▶ | sub applyShadow { | ||||||||||||||||||||||||||
|
Subroutine
applyShadow: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 288 | 0 | my ( $attr ) = @_; | |||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | # Coercing the BIOS shadow attribute to a TColorAttr object | ||||||||||||||||||||||||||||
| 291 | 0 | ▶ | local $shadowAttr = ref $shadowAttr | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 292 | ? $shadowAttr | ||||||||||||||||||||||||||||
| 293 | : TColorAttr->new( bios => $shadowAttr ); | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | # Because we can't know if the cell has already been shadowed, we compare | ||||||||||||||||||||||||||||
| 296 | # against the shadow attributes. This may yield some false positives. | ||||||||||||||||||||||||||||
| 297 | 0 | my $shadowAttrInv = $shadowAttr->reversed(); | |||||||||||||||||||||||||||
| 298 | 0 | ▶ | if ( $attr == $shadowAttr || $attr == $shadowAttrInv ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$attr == $TUI::Views::View::Write::shadowAttr or $attr == $shadowAttrInv
MC/DC0%0/2
$attr == $TUI::Views::View::Write::shadowAttr or $attr == $shadowAttrInv
$attr == $TUI::Views::View::Write::shadowAttr
$attr == $shadowAttrInv
Truth table0%0/3
A or B
A= $attr == $TUI::Views::View::Write::shadowAttrB= $attr == $shadowAttrInv
| |||||||||||||||||||||||||||||
| 299 | 0 | return $attr; | |||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||
| 301 | else { | ||||||||||||||||||||||||||||
| 302 | 0 | ▶ | if ( $attr->getBackground()->toBIOS( 0 ) != 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 303 | 0 | return $shadowAttr; | |||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||
| 305 | else { # Reverse the shadow attribute on black areas. | ||||||||||||||||||||||||||||
| 306 | 0 | return $shadowAttrInv; | |||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 94 | 1 | |||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | __END__ | ||||||||||||||||||||||||||||