… | |
… | |
19 | use IO::AIO (); |
19 | use IO::AIO (); |
20 | use File::Temp; |
20 | use File::Temp; |
21 | use Crossfire; |
21 | use Crossfire; |
22 | use Coro; |
22 | use Coro; |
23 | use Coro::AIO; |
23 | use Coro::AIO; |
|
|
24 | use Coro::Util; |
24 | use POSIX (); |
25 | use POSIX (); |
25 | use Digest::MD5; |
26 | use Digest::MD5; |
26 | use Carp; |
27 | use Carp; |
27 | use Coro::Storable; $Storable::canonical = 1; |
28 | use Coro::Storable; $Storable::canonical = 1; |
28 | |
29 | |
… | |
… | |
170 | # possibly enlarge |
171 | # possibly enlarge |
171 | if (0 > aio_stat "$stem.64x64.png") { |
172 | if (0 > aio_stat "$stem.64x64.png") { |
172 | my $other = "$stem.64x64.png~"; |
173 | my $other = "$stem.64x64.png~"; |
173 | |
174 | |
174 | if (0 > aio_lstat $other or (-M _) > (-M $path)) { |
175 | if (0 > aio_lstat $other or (-M _) > (-M $path)) { |
175 | my $wrap = 0; # for the time being |
|
|
176 | fork_sub { |
176 | fork_sub { |
177 | system "convert png:\Q$path\E -depth 8 rgba:-" |
177 | system "convert -depth 8 png:\Q$path\E rgba:-" |
178 | . "| $exec_prefix/bin/cfhq2xa $w $h $wrap" |
178 | . "| $exec_prefix/bin/cfhq2xa $w $h 0" |
179 | . "| convert -depth 8 -size ".($w * 2)."x".($h * 2)." rgba:- $QUANTIZE -quality 00 png32:\Q$other\E~" |
179 | . "| convert -depth 8 -size ".($w * 2)."x".($h * 2)." rgba:- $QUANTIZE -quality 00 png32:\Q$other\E~" |
180 | and die "convert/hq2xa pipeline error: status $? ($!)"; |
180 | and die "convert/hq2xa pipeline error: status $? ($!)"; |
181 | system $OPTIPNG, "-i0", "-q", "$other~"; |
181 | system $OPTIPNG, "-i0", "-q", "$other~"; |
182 | die "$other~ has zero size, aborting." unless -s "$other~"; |
182 | die "$other~ has zero size, aborting." unless -s "$other~"; |
183 | rename "$other~", $other; |
183 | rename "$other~", $other; |