| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "public/fpdfview.h" | 7 #include "public/fpdfview.h" |
| 8 | 8 |
| 9 #include "../include/fpdfxfa/fpdfxfa_app.h" | 9 #include "../include/fpdfxfa/fpdfxfa_app.h" |
| 10 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 10 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 207 } |
| 208 | 208 |
| 209 DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( | 209 DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( |
| 210 const FPDF_LIBRARY_CONFIG* cfg) { | 210 const FPDF_LIBRARY_CONFIG* cfg) { |
| 211 g_pCodecModule = new CCodec_ModuleMgr(); | 211 g_pCodecModule = new CCodec_ModuleMgr(); |
| 212 | 212 |
| 213 CFX_GEModule::Create(cfg ? cfg->m_pUserFontPaths : nullptr); | 213 CFX_GEModule::Create(cfg ? cfg->m_pUserFontPaths : nullptr); |
| 214 CFX_GEModule::Get()->SetCodecModule(g_pCodecModule); | 214 CFX_GEModule::Get()->SetCodecModule(g_pCodecModule); |
| 215 | 215 |
| 216 CPDF_ModuleMgr::Create(); | 216 CPDF_ModuleMgr::Create(); |
| 217 CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule); | 217 CPDF_ModuleMgr* pModuleMgr = CPDF_ModuleMgr::Get(); |
| 218 CPDF_ModuleMgr::Get()->InitPageModule(); | 218 pModuleMgr->SetCodecModule(g_pCodecModule); |
| 219 CPDF_ModuleMgr::Get()->InitRenderModule(); | 219 pModuleMgr->InitPageModule(); |
| 220 pModuleMgr->InitRenderModule(); |
| 220 CPDFXFA_App::GetInstance()->Initialize(); | 221 CPDFXFA_App::GetInstance()->Initialize(); |
| 221 if (cfg && cfg->version >= 2) | 222 if (cfg && cfg->version >= 2) |
| 222 IJS_Runtime::Initialize(cfg->m_v8EmbedderSlot, cfg->m_pIsolate); | 223 IJS_Runtime::Initialize(cfg->m_v8EmbedderSlot, cfg->m_pIsolate); |
| 223 } | 224 } |
| 224 | 225 |
| 225 DLLEXPORT void STDCALL FPDF_DestroyLibrary() { | 226 DLLEXPORT void STDCALL FPDF_DestroyLibrary() { |
| 226 CPDFXFA_App::ReleaseInstance(); | 227 CPDFXFA_App::ReleaseInstance(); |
| 227 CPDF_ModuleMgr::Destroy(); | 228 CPDF_ModuleMgr::Destroy(); |
| 228 CFX_GEModule::Destroy(); | 229 CFX_GEModule::Destroy(); |
| 229 | 230 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document) { | 433 DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document) { |
| 433 UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); | 434 UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); |
| 434 return pDoc ? pDoc->GetPageCount() : 0; | 435 return pDoc ? pDoc->GetPageCount() : 0; |
| 435 } | 436 } |
| 436 | 437 |
| 437 DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, | 438 DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, |
| 438 int page_index) { | 439 int page_index) { |
| 439 UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); | 440 UnderlyingDocumentType* pDoc = UnderlyingFromFPDFDocument(document); |
| 440 if (!pDoc) | 441 if (!pDoc) |
| 441 return nullptr; | 442 return nullptr; |
| 443 |
| 442 if (page_index < 0 || page_index >= pDoc->GetPageCount()) | 444 if (page_index < 0 || page_index >= pDoc->GetPageCount()) |
| 443 return nullptr; | 445 return nullptr; |
| 444 | 446 |
| 445 return pDoc->GetPage(page_index); | 447 return pDoc->GetPage(page_index); |
| 446 } | 448 } |
| 447 | 449 |
| 448 DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page) { | 450 DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page) { |
| 449 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 451 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 450 return pPage ? pPage->GetPageWidth() : 0.0; | 452 return pPage ? pPage->GetPageWidth() : 0.0; |
| 451 } | 453 } |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 if (!buffer) { | 1075 if (!buffer) { |
| 1074 *buflen = len; | 1076 *buflen = len; |
| 1075 } else if (*buflen >= len) { | 1077 } else if (*buflen >= len) { |
| 1076 memcpy(buffer, utf16Name.c_str(), len); | 1078 memcpy(buffer, utf16Name.c_str(), len); |
| 1077 *buflen = len; | 1079 *buflen = len; |
| 1078 } else { | 1080 } else { |
| 1079 *buflen = -1; | 1081 *buflen = -1; |
| 1080 } | 1082 } |
| 1081 return (FPDF_DEST)pDestObj; | 1083 return (FPDF_DEST)pDestObj; |
| 1082 } | 1084 } |
| OLD | NEW |