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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 FPDF_ImportPages(doc_, | 1006 FPDF_ImportPages(doc_, |
1007 static_cast<PDFiumEngine*>(engine)->doc(), | 1007 static_cast<PDFiumEngine*>(engine)->doc(), |
1008 "1", | 1008 "1", |
1009 index); | 1009 index); |
1010 pp::Size new_page_size = GetPageSize(index); | 1010 pp::Size new_page_size = GetPageSize(index); |
1011 if (curr_page_size != new_page_size) | 1011 if (curr_page_size != new_page_size) |
1012 LoadPageInfo(true); | 1012 LoadPageInfo(true); |
1013 client_->Invalidate(GetPageScreenRect(index)); | 1013 client_->Invalidate(GetPageScreenRect(index)); |
1014 } | 1014 } |
1015 | 1015 |
1016 pp::Point PDFiumEngine::GetScrollPosition() { | |
1017 return position_; | |
1018 } | |
1019 | |
1020 void PDFiumEngine::SetScrollPosition(const pp::Point& position) { | |
1021 position_ = position; | |
1022 } | |
1023 | |
1024 bool PDFiumEngine::IsProgressiveLoad() { | 1016 bool PDFiumEngine::IsProgressiveLoad() { |
1025 return doc_loader_.is_partial_document(); | 1017 return doc_loader_.is_partial_document(); |
1026 } | 1018 } |
1027 | 1019 |
1028 std::string PDFiumEngine::GetMetadata(const std::string& key) { | 1020 std::string PDFiumEngine::GetMetadata(const std::string& key) { |
1029 return GetDocumentMetadata(doc(), key); | 1021 return GetDocumentMetadata(doc(), key); |
1030 } | 1022 } |
1031 | 1023 |
1032 void PDFiumEngine::OnPartialDocumentLoaded() { | 1024 void PDFiumEngine::OnPartialDocumentLoaded() { |
1033 file_access_.m_FileLen = doc_loader_.document_size(); | 1025 file_access_.m_FileLen = doc_loader_.document_size(); |
(...skipping 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3918 FPDF_DOCUMENT doc = | 3910 FPDF_DOCUMENT doc = |
3919 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 3911 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
3920 if (!doc) | 3912 if (!doc) |
3921 return false; | 3913 return false; |
3922 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3914 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
3923 FPDF_CloseDocument(doc); | 3915 FPDF_CloseDocument(doc); |
3924 return success; | 3916 return success; |
3925 } | 3917 } |
3926 | 3918 |
3927 } // namespace chrome_pdf | 3919 } // namespace chrome_pdf |
OLD | NEW |