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 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 std::string page_json; | 2305 std::string page_json; |
2306 base::JSONWriter::Write(*node, &page_json); | 2306 base::JSONWriter::Write(*node, &page_json); |
2307 return page_json; | 2307 return page_json; |
2308 } | 2308 } |
2309 | 2309 |
2310 int PDFiumEngine::GetCharCount(int page_index) { | 2310 int PDFiumEngine::GetCharCount(int page_index) { |
2311 DCHECK(page_index >= 0 && page_index < static_cast<int>(pages_.size())); | 2311 DCHECK(page_index >= 0 && page_index < static_cast<int>(pages_.size())); |
2312 return pages_[page_index]->GetCharCount(); | 2312 return pages_[page_index]->GetCharCount(); |
2313 } | 2313 } |
2314 | 2314 |
2315 double PDFiumEngine::GetCharWidth(int page_index, int char_index) { | 2315 pp::FloatRect PDFiumEngine::GetCharBounds(int page_index, int char_index) { |
2316 DCHECK(page_index >= 0 && page_index < static_cast<int>(pages_.size())); | 2316 DCHECK(page_index >= 0 && page_index < static_cast<int>(pages_.size())); |
2317 return pages_[page_index]->GetCharWidth(char_index); | 2317 return pages_[page_index]->GetCharBounds(char_index); |
2318 } | 2318 } |
2319 | 2319 |
2320 uint32_t PDFiumEngine::GetCharUnicode(int page_index, int char_index) { | 2320 uint32_t PDFiumEngine::GetCharUnicode(int page_index, int char_index) { |
2321 DCHECK(page_index >= 0 && page_index < static_cast<int>(pages_.size())); | 2321 DCHECK(page_index >= 0 && page_index < static_cast<int>(pages_.size())); |
2322 return pages_[page_index]->GetCharUnicode(char_index); | 2322 return pages_[page_index]->GetCharUnicode(char_index); |
2323 } | 2323 } |
2324 | 2324 |
2325 void PDFiumEngine::GetTextRunInfo(int page_index, | 2325 void PDFiumEngine::GetTextRunInfo(int page_index, |
2326 int start_char_index, | 2326 int start_char_index, |
2327 uint32_t* out_len, | 2327 uint32_t* out_len, |
(...skipping 1571 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 |