| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "pdf/pdfium/pdfium_engine.h" | 5 #include "pdf/pdfium/pdfium_engine.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 2578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2589 CheckPageAvailable(FPDFAvail_GetFirstPageNum(doc_), &pending_pages_); | 2589 CheckPageAvailable(FPDFAvail_GetFirstPageNum(doc_), &pending_pages_); |
| 2590 } | 2590 } |
| 2591 | 2591 |
| 2592 LoadPageInfo(false); | 2592 LoadPageInfo(false); |
| 2593 | 2593 |
| 2594 if (doc_loader_->IsDocumentComplete()) | 2594 if (doc_loader_->IsDocumentComplete()) |
| 2595 FinishLoadingDocument(); | 2595 FinishLoadingDocument(); |
| 2596 } | 2596 } |
| 2597 | 2597 |
| 2598 void PDFiumEngine::LoadPageInfo(bool reload) { | 2598 void PDFiumEngine::LoadPageInfo(bool reload) { |
| 2599 if (!doc_loader_) |
| 2600 return; |
| 2599 pending_pages_.clear(); | 2601 pending_pages_.clear(); |
| 2600 pp::Size old_document_size = document_size_; | 2602 pp::Size old_document_size = document_size_; |
| 2601 document_size_ = pp::Size(); | 2603 document_size_ = pp::Size(); |
| 2602 std::vector<pp::Rect> page_rects; | 2604 std::vector<pp::Rect> page_rects; |
| 2603 int page_count = FPDF_GetPageCount(doc_); | 2605 int page_count = FPDF_GetPageCount(doc_); |
| 2604 bool doc_complete = doc_loader_->IsDocumentComplete(); | 2606 bool doc_complete = doc_loader_->IsDocumentComplete(); |
| 2605 bool is_linear = FPDFAvail_IsLinearized(fpdf_availability_) == PDF_LINEARIZED; | 2607 bool is_linear = FPDFAvail_IsLinearized(fpdf_availability_) == PDF_LINEARIZED; |
| 2606 for (int i = 0; i < page_count; ++i) { | 2608 for (int i = 0; i < page_count; ++i) { |
| 2607 if (i != 0) { | 2609 if (i != 0) { |
| 2608 // Add space for horizontal separator. | 2610 // Add space for horizontal separator. |
| (...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4023 FPDF_DOCUMENT doc = | 4025 FPDF_DOCUMENT doc = |
| 4024 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 4026 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
| 4025 if (!doc) | 4027 if (!doc) |
| 4026 return false; | 4028 return false; |
| 4027 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4029 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 4028 FPDF_CloseDocument(doc); | 4030 FPDF_CloseDocument(doc); |
| 4029 return success; | 4031 return success; |
| 4030 } | 4032 } |
| 4031 | 4033 |
| 4032 } // namespace chrome_pdf | 4034 } // namespace chrome_pdf |
| OLD | NEW |