| 617 | |
| 618 | private: |
| 619 | void worker_loop() |
| 620 | { |
| 621 | while(true) |
| 622 | { |
| 623 | const std::size_t task_index = next_task_.fetch_add(1); |
| 624 | if(task_index >= tasks_.size()) |
| 625 | { |
| 626 | break; |
| 627 | } |
| 628 | |
| 629 | const page_task task = tasks_[task_index]; |
| 630 | page_result result; |
| 631 | result.doc_key = schedule_[task.doc_index].path.string(); |
| 632 | result.page_number = task.page_number; |
| 633 | |
| 634 | try |
| 635 | { |
| 636 | auto total_start = clock_type::now(); |
| 637 | |
| 638 | auto stage_start = clock_type::now(); |
| 639 | auto page_decoder = docs_[task.doc_index]->make_thread_safe_page_decoder( |
| 640 | task.page_number, |
| 641 | decode_config_.keep_qpdf_warnings); |
| 642 | result.timings.make_page_decoder_s = |
| 643 | std::chrono::duration<double>(clock_type::now() - stage_start).count(); |
| 644 | |
| 645 | stage_start = clock_type::now(); |
| 646 | page_decoder->decode_page(decode_config_); |
| 647 | result.timings.decode_page_s = |
| 648 | std::chrono::duration<double>(clock_type::now() - stage_start).count(); |
| 649 | |
| 650 | if(decode_config_.create_word_cells) |
| 651 | { |
| 652 | stage_start = clock_type::now(); |
| 653 | page_decoder->create_word_cells(decode_config_); |
| 654 | result.timings.create_word_cells_s = |
| 655 | std::chrono::duration<double>(clock_type::now() - stage_start).count(); |
| 656 | } |
| 657 | |
| 658 | if(decode_config_.create_line_cells) |
| 659 | { |
| 660 | stage_start = clock_type::now(); |
| 661 | page_decoder->create_line_cells(decode_config_); |
| 662 | result.timings.create_line_cells_s = |
| 663 | std::chrono::duration<double>(clock_type::now() - stage_start).count(); |
| 664 | } |
| 665 | |
| 666 | if(render_config_.has_value()) |
| 667 | { |
| 668 | stage_start = clock_type::now(); |
| 669 | pdflib::renderer<pdflib::BLEND2D> rnd(*render_config_, font_resolver_); |
| 670 | page_decoder->get_instructions().iterate_over_instructions(rnd); |
| 671 | result.timings.render_page_s = |
| 672 | std::chrono::duration<double>(clock_type::now() - stage_start).count(); |
| 673 | result.image_data = rnd.get_canvas(); |
| 674 | } |
| 675 | |
| 676 | result.timings.total_s = |
nothing calls this directly
no test coverage detected