| 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 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2664 return true; | 2664 return true; |
| 2665 | 2665 |
| 2666 if (!FPDFAvail_IsPageAvail(fpdf_availability_, index, &download_hints_)) { | 2666 if (!FPDFAvail_IsPageAvail(fpdf_availability_, index, &download_hints_)) { |
| 2667 if (!ContainsValue(*pending, index)) | 2667 if (!ContainsValue(*pending, index)) |
| 2668 pending->push_back(index); | 2668 pending->push_back(index); |
| 2669 return false; | 2669 return false; |
| 2670 } | 2670 } |
| 2671 | 2671 |
| 2672 if (index < num_pages) | 2672 if (index < num_pages) |
| 2673 pages_[index]->set_available(true); | 2673 pages_[index]->set_available(true); |
| 2674 if (!default_page_size_.GetArea()) | 2674 if (default_page_size_.IsEmpty()) |
| 2675 default_page_size_ = GetPageSize(index); | 2675 default_page_size_ = GetPageSize(index); |
| 2676 return true; | 2676 return true; |
| 2677 } | 2677 } |
| 2678 | 2678 |
| 2679 pp::Size PDFiumEngine::GetPageSize(int index) { | 2679 pp::Size PDFiumEngine::GetPageSize(int index) { |
| 2680 pp::Size size; | 2680 pp::Size size; |
| 2681 double width_in_points = 0; | 2681 double width_in_points = 0; |
| 2682 double height_in_points = 0; | 2682 double height_in_points = 0; |
| 2683 int rv = FPDF_GetPageSizeByIndex( | 2683 int rv = FPDF_GetPageSizeByIndex( |
| 2684 doc_, index, &width_in_points, &height_in_points); | 2684 doc_, index, &width_in_points, &height_in_points); |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3899 FPDF_DOCUMENT doc = | 3899 FPDF_DOCUMENT doc = |
| 3900 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 3900 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
| 3901 if (!doc) | 3901 if (!doc) |
| 3902 return false; | 3902 return false; |
| 3903 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3903 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 3904 FPDF_CloseDocument(doc); | 3904 FPDF_CloseDocument(doc); |
| 3905 return success; | 3905 return success; |
| 3906 } | 3906 } |
| 3907 | 3907 |
| 3908 } // namespace chrome_pdf | 3908 } // namespace chrome_pdf |
| OLD | NEW |