| 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 "core/include/fxcodec/fx_codec.h" | 9 #include "core/include/fxcodec/fx_codec.h" |
| 10 #include "core/include/fxcrt/fx_safe_types.h" | 10 #include "core/include/fxcrt/fx_safe_types.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( | 95 DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( |
| 96 const FPDF_LIBRARY_CONFIG* cfg) { | 96 const FPDF_LIBRARY_CONFIG* cfg) { |
| 97 g_pCodecModule = new CCodec_ModuleMgr(); | 97 g_pCodecModule = new CCodec_ModuleMgr(); |
| 98 | 98 |
| 99 CFX_GEModule::Create(cfg ? cfg->m_pUserFontPaths : nullptr); | 99 CFX_GEModule::Create(cfg ? cfg->m_pUserFontPaths : nullptr); |
| 100 CFX_GEModule::Get()->SetCodecModule(g_pCodecModule); | 100 CFX_GEModule::Get()->SetCodecModule(g_pCodecModule); |
| 101 | 101 |
| 102 CPDF_ModuleMgr::Create(); | 102 CPDF_ModuleMgr::Create(); |
| 103 CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule); | |
| 104 CPDF_ModuleMgr::Get()->InitPageModule(); | |
| 105 CPDF_ModuleMgr::Get()->InitRenderModule(); | |
| 106 CPDF_ModuleMgr* pModuleMgr = CPDF_ModuleMgr::Get(); | 103 CPDF_ModuleMgr* pModuleMgr = CPDF_ModuleMgr::Get(); |
| 107 if (pModuleMgr) { | 104 pModuleMgr->SetCodecModule(g_pCodecModule); |
| 108 pModuleMgr->LoadEmbeddedGB1CMaps(); | 105 pModuleMgr->InitPageModule(); |
| 109 pModuleMgr->LoadEmbeddedJapan1CMaps(); | 106 pModuleMgr->InitRenderModule(); |
| 110 pModuleMgr->LoadEmbeddedCNS1CMaps(); | 107 pModuleMgr->LoadEmbeddedGB1CMaps(); |
| 111 pModuleMgr->LoadEmbeddedKorea1CMaps(); | 108 pModuleMgr->LoadEmbeddedJapan1CMaps(); |
| 112 } | 109 pModuleMgr->LoadEmbeddedCNS1CMaps(); |
| 110 pModuleMgr->LoadEmbeddedKorea1CMaps(); |
| 113 if (cfg && cfg->version >= 2) | 111 if (cfg && cfg->version >= 2) |
| 114 IJS_Runtime::Initialize(cfg->m_v8EmbedderSlot, cfg->m_pIsolate); | 112 IJS_Runtime::Initialize(cfg->m_v8EmbedderSlot, cfg->m_pIsolate); |
| 115 } | 113 } |
| 116 | 114 |
| 117 DLLEXPORT void STDCALL FPDF_DestroyLibrary() { | 115 DLLEXPORT void STDCALL FPDF_DestroyLibrary() { |
| 118 CPDF_ModuleMgr::Destroy(); | 116 CPDF_ModuleMgr::Destroy(); |
| 119 CFX_GEModule::Destroy(); | 117 CFX_GEModule::Destroy(); |
| 120 | 118 |
| 121 delete g_pCodecModule; | 119 delete g_pCodecModule; |
| 122 g_pCodecModule = nullptr; | 120 g_pCodecModule = nullptr; |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 if (!buffer) { | 912 if (!buffer) { |
| 915 *buflen = len; | 913 *buflen = len; |
| 916 } else if (*buflen >= len) { | 914 } else if (*buflen >= len) { |
| 917 memcpy(buffer, utf16Name.c_str(), len); | 915 memcpy(buffer, utf16Name.c_str(), len); |
| 918 *buflen = len; | 916 *buflen = len; |
| 919 } else { | 917 } else { |
| 920 *buflen = -1; | 918 *buflen = -1; |
| 921 } | 919 } |
| 922 return (FPDF_DEST)pDestObj; | 920 return (FPDF_DEST)pDestObj; |
| 923 } | 921 } |
| OLD | NEW |