diff options
Diffstat (limited to 'source/codes/Pdf417.mc')
| -rw-r--r-- | source/codes/Pdf417.mc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source/codes/Pdf417.mc b/source/codes/Pdf417.mc index a294aa7..c905a2d 100644 --- a/source/codes/Pdf417.mc +++ b/source/codes/Pdf417.mc @@ -35,6 +35,8 @@ module Pdf417 { const NUMERIC_LATCH = 902; const ROW_HEIGHT = 3; const QUIET = 2; + // Cumulative percent at the end of each phase 0-2 (see Pdf417Job.percent). + const PHASE_ENDS = [40, 70, 100]; const MAX_CODEWORDS = 928; const KIND_TEXT = 0; @@ -383,8 +385,25 @@ module Pdf417 { level = ecLevel; } + // Progress 0-100: the share of each phase (simulator timings), and + // inside the Reed-Solomon and row phases how far they have got. function percent() as Number { - return _phase == 1 && _words.size() > 0 ? 20 + 60 * _at / _words.size() : _phase * 30; + var done = 0; + var total = 0; + if (_phase == 1) { // data codewords done + done = _at; + total = _words.size(); + } else if (_phase == 2) { // rows built + done = _at; + total = rows; + } + return Codes.phased(PHASE_ENDS, _phase, done, total); + } + + // Packing and runs: about 62 / 7 / 31 % of a whole display job (the + // wide matrices make the runs a third). + function stageEnds() as Array<Number> { + return [62, 69]; } function matrix() as Codes.Matrix? { |
