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 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 } | 963 } |
964 | 964 |
965 #endif // PDF_USE_XFA | 965 #endif // PDF_USE_XFA |
966 | 966 |
967 int PDFiumEngine::GetBlock(void* param, unsigned long position, | 967 int PDFiumEngine::GetBlock(void* param, unsigned long position, |
968 unsigned char* buffer, unsigned long size) { | 968 unsigned char* buffer, unsigned long size) { |
969 DocumentLoader* loader = static_cast<DocumentLoader*>(param); | 969 DocumentLoader* loader = static_cast<DocumentLoader*>(param); |
970 return loader->GetBlock(position, size, buffer); | 970 return loader->GetBlock(position, size, buffer); |
971 } | 971 } |
972 | 972 |
973 bool PDFiumEngine::IsDataAvail(FX_FILEAVAIL* param, | 973 FPDF_BOOL PDFiumEngine::IsDataAvail(FX_FILEAVAIL* param, |
974 size_t offset, size_t size) { | 974 size_t offset, size_t size) { |
975 PDFiumEngine::FileAvail* file_avail = | 975 PDFiumEngine::FileAvail* file_avail = |
976 static_cast<PDFiumEngine::FileAvail*>(param); | 976 static_cast<PDFiumEngine::FileAvail*>(param); |
977 return file_avail->loader->IsDataAvailable(offset, size); | 977 return file_avail->loader->IsDataAvailable(offset, size); |
978 } | 978 } |
979 | 979 |
980 void PDFiumEngine::AddSegment(FX_DOWNLOADHINTS* param, | 980 void PDFiumEngine::AddSegment(FX_DOWNLOADHINTS* param, |
981 size_t offset, size_t size) { | 981 size_t offset, size_t size) { |
982 PDFiumEngine::DownloadHints* download_hints = | 982 PDFiumEngine::DownloadHints* download_hints = |
983 static_cast<PDFiumEngine::DownloadHints*>(param); | 983 static_cast<PDFiumEngine::DownloadHints*>(param); |
984 return download_hints->loader->RequestData(offset, size); | 984 return download_hints->loader->RequestData(offset, size); |
(...skipping 3026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4011 double* height) { | 4011 double* height) { |
4012 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 4012 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
4013 if (!doc) | 4013 if (!doc) |
4014 return false; | 4014 return false; |
4015 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4015 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
4016 FPDF_CloseDocument(doc); | 4016 FPDF_CloseDocument(doc); |
4017 return success; | 4017 return success; |
4018 } | 4018 } |
4019 | 4019 |
4020 } // namespace chrome_pdf | 4020 } // namespace chrome_pdf |
OLD | NEW |