Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1037)

Side by Side Diff: fpdfsdk/src/fpdfview.cpp

Issue 1472363003: XFA: More underlying types (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Missing include Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/fpdftext.cpp ('k') | fpdfsdk/src/fsdk_mgr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdftext.cpp ('k') | fpdfsdk/src/fsdk_mgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698