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 "../include/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
8 #include "../include/fsdk_mgr.h" | 8 #include "../include/fsdk_mgr.h" |
9 #include "../include/fpdfview.h" | 9 #include "../include/fpdfview.h" |
10 #include "../include/fsdk_rendercontext.h" | 10 #include "../include/fsdk_rendercontext.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 FX_BOOL bVertical, | 204 FX_BOOL bVertical, |
205 CPDF_SubstFont* pSubstFo
nt // [OUT] Subst font data | 205 CPDF_SubstFont* pSubstFo
nt // [OUT] Subst font data |
206 ); | 206 ); |
207 | 207 |
208 FT_Face m_SysFace; | 208 FT_Face m_SysFace; |
209 }; | 209 }; |
210 | 210 |
211 CFontMapper* g_pFontMapper = NULL; | 211 CFontMapper* g_pFontMapper = NULL; |
212 #endif // #if _FX_OS_ == _FX_LINUX_EMBEDDED_ | 212 #endif // #if _FX_OS_ == _FX_LINUX_EMBEDDED_ |
213 | 213 |
214 DLLEXPORT void STDCALL FPDF_InitLibrary(FX_LPVOID hInstance) | 214 DLLEXPORT void STDCALL FPDF_InitLibrary() |
215 { | 215 { |
216 #ifdef API5 | |
217 CPDF_ModuleMgr::Create(); | |
218 g_pModuleMgr = CPDF_ModuleMgr::Get(); | |
219 #if _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_LINUX_EMBEDDED_ | |
220 g_pModuleMgr->InitEmbedded(); | |
221 #ifdef _GB1_CMAPS_ | |
222 g_pModuleMgr->LoadEmbeddedGB1CMaps(); | |
223 #endif | |
224 #ifdef _GB1_CMAPS_4_ | |
225 g_pModuleMgr->LoadEmbeddedGB1CMaps_4(); | |
226 #endif | |
227 #ifdef _CNS1_CMAPS_ | |
228 g_pModuleMgr->LoadEmbeddedCNS1CMaps(); | |
229 #endif | |
230 #ifdef _JAPAN1_CMAPS_ | |
231 g_pModuleMgr->LoadEmbeddedJapan1CMaps(); | |
232 #endif | |
233 #ifdef _JAPAN1_CMAPS_6_ | |
234 g_pModuleMgr->LoadEmbeddedJapan1CMaps_6(); | |
235 #endif | |
236 #ifdef _KOREA1_CMAPS_ | |
237 g_pModuleMgr->LoadEmbeddedKorea1CMaps(); | |
238 #endif | |
239 #ifdef _JPX_DECODER_ | |
240 g_pModuleMgr->InitJpxModule(); | |
241 g_pModuleMgr->InitJbig2Module(); | |
242 // g_pModuleMgr->InitIccModule(); | |
243 #endif | |
244 #else | |
245 g_pModuleMgr->InitDesktop(); | |
246 #endif | |
247 #else | |
248 g_pCodecModule = CCodec_ModuleMgr::Create(); | 216 g_pCodecModule = CCodec_ModuleMgr::Create(); |
249 | 217 |
250 CFX_GEModule::Create(); | 218 CFX_GEModule::Create(); |
251 CFX_GEModule::Get()->SetCodecModule(g_pCodecModule); | 219 CFX_GEModule::Get()->SetCodecModule(g_pCodecModule); |
252 | 220 |
253 CPDF_ModuleMgr::Create(); | 221 CPDF_ModuleMgr::Create(); |
254 CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule); | 222 CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule); |
255 CPDF_ModuleMgr::Get()->InitPageModule(); | 223 CPDF_ModuleMgr::Get()->InitPageModule(); |
256 CPDF_ModuleMgr::Get()->InitRenderModule(); | 224 CPDF_ModuleMgr::Get()->InitRenderModule(); |
257 #ifdef FOXIT_CHROME_BUILD | |
258 CPDF_ModuleMgr * pModuleMgr = CPDF_ModuleMgr::Get(); | |
259 if ( pModuleMgr ) | |
260 { | |
261 pModuleMgr->LoadEmbeddedGB1CMaps(); | |
262 pModuleMgr->LoadEmbeddedJapan1CMaps(); | |
263 pModuleMgr->LoadEmbeddedCNS1CMaps(); | |
264 pModuleMgr->LoadEmbeddedKorea1CMaps(); | |
265 } | |
266 #endif | |
267 #endif | |
268 | 225 |
269 CPDFXFA_App* pAppProvider = FPDFXFA_GetApp(); | 226 CPDFXFA_App* pAppProvider = FPDFXFA_GetApp(); |
270 pAppProvider->Initialize(); | 227 pAppProvider->Initialize(); |
271 | |
272 #ifdef _WIN32 | |
273 // Get module path | |
274 TCHAR app_path[MAX_PATH]; | |
275 ::GetModuleFileName((HINSTANCE)hInstance, app_path, MAX_PATH); | |
276 size_t len = _tcslen(app_path); | |
277 for (size_t i = len; i >= 0; i --) | |
278 if (app_path[i] == '\\') { | |
279 app_path[i] = 0; | |
280 break; | |
281 } | |
282 | |
283 #ifdef _UNICODE | |
284 #ifndef _FXSDK_OPENSOURCE_ | |
285 CPDF_ModuleMgr::Get()->SetModulePath(NULL, CFX_ByteString::FromU
nicode(app_path)); | |
286 #endif | |
287 #else | |
288 #ifndef _FXSDK_OPENSOURCE_ | |
289 CPDF_ModuleMgr::Get()->SetModulePath(NULL, app_path); | |
290 #endif | |
291 #endif | |
292 #endif | |
293 } | 228 } |
294 | 229 |
295 | 230 |
296 DLLEXPORT void STDCALL FPDF_DestroyLibrary() | 231 DLLEXPORT void STDCALL FPDF_DestroyLibrary() |
297 { | 232 { |
298 FPDFXFA_ReleaseApp(); | 233 FPDFXFA_ReleaseApp(); |
299 | 234 |
300 #if _FX_OS_ == _FX_LINUX_EMBEDDED_ | 235 #if _FX_OS_ == _FX_LINUX_EMBEDDED_ |
301 if (g_pFontMapper) delete g_pFontMapper; | 236 if (g_pFontMapper) delete g_pFontMapper; |
302 #endif | 237 #endif |
303 #ifdef API5 | 238 #ifdef API5 |
304 g_pModuleMgr->Destroy(); | 239 g_pModuleMgr->Destroy(); |
305 #else | 240 #else |
306 CPDF_ModuleMgr::Destroy(); | 241 CPDF_ModuleMgr::Destroy(); |
307 CFX_GEModule::Destroy(); | 242 CFX_GEModule::Destroy(); |
308 g_pCodecModule->Destroy(); | 243 g_pCodecModule->Destroy(); |
309 #endif | 244 #endif |
310 #ifndef _FXSDK_OPENSOURCE_ | |
311 FXMEM_CollectAll(FXMEM_GetDefaultMgr()); | |
312 #else | |
313 | |
314 #endif | |
315 } | 245 } |
316 | 246 |
317 #ifndef _WIN32 | 247 #ifndef _WIN32 |
318 int g_LastError; | 248 int g_LastError; |
319 void SetLastError(int err) | 249 void SetLastError(int err) |
320 { | 250 { |
321 g_LastError = err; | 251 g_LastError = err; |
322 } | 252 } |
323 | 253 |
324 int GetLastError() | 254 int GetLastError() |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 | 787 |
858 DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap) | 788 DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap) |
859 { | 789 { |
860 if (bitmap == NULL) return; | 790 if (bitmap == NULL) return; |
861 delete (CFX_DIBitmap*)bitmap; | 791 delete (CFX_DIBitmap*)bitmap; |
862 } | 792 } |
863 | 793 |
864 void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page, int start_
x, int start_y, int size_x, int size_y, | 794 void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page, int start_
x, int start_y, int size_x, int size_y, |
865 int rotate, int flags,FX_BOOL bN
eedToRestore, IFSDK_PAUSE_Adapter * pause ) | 795 int rotate, int flags,FX_BOOL bN
eedToRestore, IFSDK_PAUSE_Adapter * pause ) |
866 { | 796 { |
867 //#ifdef _LICENSED_BUILD_ | |
868 CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); | 797 CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); |
869 if (pPage == NULL) return; | 798 if (pPage == NULL) return; |
870 | 799 |
871 if (!pContext->m_pOptions) | 800 if (!pContext->m_pOptions) |
872 pContext->m_pOptions = new CPDF_RenderOptions; | 801 pContext->m_pOptions = new CPDF_RenderOptions; |
873 // CPDF_RenderOptions options; | 802 // CPDF_RenderOptions options; |
874 if (flags & FPDF_LCD_TEXT) | 803 if (flags & FPDF_LCD_TEXT) |
875 pContext->m_pOptions->m_Flags |= RENDER_CLEARTYPE; | 804 pContext->m_pOptions->m_Flags |= RENDER_CLEARTYPE; |
876 else | 805 else |
877 pContext->m_pOptions->m_Flags &= ~RENDER_CLEARTYPE; | 806 pContext->m_pOptions->m_Flags &= ~RENDER_CLEARTYPE; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 return -1; | 992 return -1; |
1064 | 993 |
1065 if (str->str) | 994 if (str->str) |
1066 { | 995 { |
1067 FX_Free(str->str); | 996 FX_Free(str->str); |
1068 str->str = NULL; | 997 str->str = NULL; |
1069 } | 998 } |
1070 str->len = 0; | 999 str->len = 0; |
1071 return 0; | 1000 return 0; |
1072 } | 1001 } |
OLD | NEW |