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

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

Issue 801913002: Simplify PDFium by removing code that's not used in the open source repo. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 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
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 "../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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 FX_BOOL bVertical, 99 FX_BOOL bVertical,
100 CPDF_SubstFont* pSubstFo nt // [OUT] Subst font data 100 CPDF_SubstFont* pSubstFo nt // [OUT] Subst font data
101 ); 101 );
102 102
103 FT_Face m_SysFace; 103 FT_Face m_SysFace;
104 }; 104 };
105 105
106 CFontMapper* g_pFontMapper = NULL; 106 CFontMapper* g_pFontMapper = NULL;
107 #endif // #if _FX_OS_ == _FX_LINUX_EMBEDDED_ 107 #endif // #if _FX_OS_ == _FX_LINUX_EMBEDDED_
108 108
109 DLLEXPORT void STDCALL FPDF_InitLibrary(FX_LPVOID hInstance) 109 DLLEXPORT void STDCALL FPDF_InitLibrary()
110 { 110 {
111 #ifdef API5
112 CPDF_ModuleMgr::Create();
113 g_pModuleMgr = CPDF_ModuleMgr::Get();
114 #if _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_LINUX_EMBEDDED_
115 g_pModuleMgr->InitEmbedded();
116 #ifdef _GB1_CMAPS_
117 g_pModuleMgr->LoadEmbeddedGB1CMaps();
118 #endif
119 #ifdef _GB1_CMAPS_4_
120 g_pModuleMgr->LoadEmbeddedGB1CMaps_4();
121 #endif
122 #ifdef _CNS1_CMAPS_
123 g_pModuleMgr->LoadEmbeddedCNS1CMaps();
124 #endif
125 #ifdef _JAPAN1_CMAPS_
126 g_pModuleMgr->LoadEmbeddedJapan1CMaps();
127 #endif
128 #ifdef _JAPAN1_CMAPS_6_
129 g_pModuleMgr->LoadEmbeddedJapan1CMaps_6();
130 #endif
131 #ifdef _KOREA1_CMAPS_
132 g_pModuleMgr->LoadEmbeddedKorea1CMaps();
133 #endif
134 #ifdef _JPX_DECODER_
135 g_pModuleMgr->InitJpxModule();
136 g_pModuleMgr->InitJbig2Module();
137 // g_pModuleMgr->InitIccModule();
138 #endif
139 #else
140 g_pModuleMgr->InitDesktop();
141 #endif
142 #else
143 g_pCodecModule = CCodec_ModuleMgr::Create(); 111 g_pCodecModule = CCodec_ModuleMgr::Create();
144 112
145 CFX_GEModule::Create(); 113 CFX_GEModule::Create();
146 CFX_GEModule::Get()->SetCodecModule(g_pCodecModule); 114 CFX_GEModule::Get()->SetCodecModule(g_pCodecModule);
147 115
148 CPDF_ModuleMgr::Create(); 116 CPDF_ModuleMgr::Create();
149 CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule); 117 CPDF_ModuleMgr::Get()->SetCodecModule(g_pCodecModule);
150 CPDF_ModuleMgr::Get()->InitPageModule(); 118 CPDF_ModuleMgr::Get()->InitPageModule();
151 CPDF_ModuleMgr::Get()->InitRenderModule(); 119 CPDF_ModuleMgr::Get()->InitRenderModule();
152 #ifdef FOXIT_CHROME_BUILD
153 CPDF_ModuleMgr * pModuleMgr = CPDF_ModuleMgr::Get(); 120 CPDF_ModuleMgr * pModuleMgr = CPDF_ModuleMgr::Get();
154 if ( pModuleMgr ) 121 if ( pModuleMgr )
155 { 122 {
156 pModuleMgr->LoadEmbeddedGB1CMaps(); 123 pModuleMgr->LoadEmbeddedGB1CMaps();
157 pModuleMgr->LoadEmbeddedJapan1CMaps(); 124 pModuleMgr->LoadEmbeddedJapan1CMaps();
158 pModuleMgr->LoadEmbeddedCNS1CMaps(); 125 pModuleMgr->LoadEmbeddedCNS1CMaps();
159 pModuleMgr->LoadEmbeddedKorea1CMaps(); 126 pModuleMgr->LoadEmbeddedKorea1CMaps();
160 } 127 }
161 #endif
162 #endif
163
164 #ifdef _WIN32
165 // Get module path
166 TCHAR app_path[MAX_PATH];
167 ::GetModuleFileName((HINSTANCE)hInstance, app_path, MAX_PATH);
168 size_t len = _tcslen(app_path);
169 for (size_t i = len; i >= 0; i --)
170 if (app_path[i] == '\\') {
171 app_path[i] = 0;
172 break;
173 }
174
175 #ifdef _UNICODE
176 #ifndef _FXSDK_OPENSOURCE_
177 CPDF_ModuleMgr::Get()->SetModulePath(NULL, CFX_ByteString::FromU nicode(app_path));
178 #endif
179 #else
180 #ifndef _FXSDK_OPENSOURCE_
181 CPDF_ModuleMgr::Get()->SetModulePath(NULL, app_path);
182 #endif
183 #endif
184 #endif
185 } 128 }
186 129
187 130
188 DLLEXPORT void STDCALL FPDF_DestroyLibrary() 131 DLLEXPORT void STDCALL FPDF_DestroyLibrary()
189 { 132 {
190 133
191 #if _FX_OS_ == _FX_LINUX_EMBEDDED_ 134 #if _FX_OS_ == _FX_LINUX_EMBEDDED_
192 if (g_pFontMapper) delete g_pFontMapper; 135 if (g_pFontMapper) delete g_pFontMapper;
193 #endif 136 #endif
194 #ifdef API5 137 #ifdef API5
195 g_pModuleMgr->Destroy(); 138 g_pModuleMgr->Destroy();
196 #else 139 #else
197 CPDF_ModuleMgr::Destroy(); 140 CPDF_ModuleMgr::Destroy();
198 CFX_GEModule::Destroy(); 141 CFX_GEModule::Destroy();
199 g_pCodecModule->Destroy(); 142 g_pCodecModule->Destroy();
200 #endif 143 #endif
201 #ifndef _FXSDK_OPENSOURCE_
202 FXMEM_CollectAll(FXMEM_GetDefaultMgr());
203 #else
204
205 #endif
206 } 144 }
207 145
208 #ifndef _WIN32 146 #ifndef _WIN32
209 int g_LastError; 147 int g_LastError;
210 void SetLastError(int err) 148 void SetLastError(int err)
211 { 149 {
212 g_LastError = err; 150 g_LastError = err;
213 } 151 }
214 152
215 int GetLastError() 153 int GetLastError()
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 664
727 DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap) 665 DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap)
728 { 666 {
729 if (bitmap == NULL) return; 667 if (bitmap == NULL) return;
730 delete (CFX_DIBitmap*)bitmap; 668 delete (CFX_DIBitmap*)bitmap;
731 } 669 }
732 670
733 void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page, int start_ x, int start_y, int size_x, int size_y, 671 void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page, int start_ x, int start_y, int size_x, int size_y,
734 int rotate, int flags,FX_BOOL bN eedToRestore, IFSDK_PAUSE_Adapter * pause ) 672 int rotate, int flags,FX_BOOL bN eedToRestore, IFSDK_PAUSE_Adapter * pause )
735 { 673 {
736 //#ifdef _LICENSED_BUILD_
737 CPDF_Page* pPage = (CPDF_Page*)page; 674 CPDF_Page* pPage = (CPDF_Page*)page;
738 if (pPage == NULL) return; 675 if (pPage == NULL) return;
739 676
740 if (!pContext->m_pOptions) 677 if (!pContext->m_pOptions)
741 pContext->m_pOptions = new CPDF_RenderOptions; 678 pContext->m_pOptions = new CPDF_RenderOptions;
742 // CPDF_RenderOptions options; 679 // CPDF_RenderOptions options;
743 if (flags & FPDF_LCD_TEXT) 680 if (flags & FPDF_LCD_TEXT)
744 pContext->m_pOptions->m_Flags |= RENDER_CLEARTYPE; 681 pContext->m_pOptions->m_Flags |= RENDER_CLEARTYPE;
745 else 682 else
746 pContext->m_pOptions->m_Flags &= ~RENDER_CLEARTYPE; 683 pContext->m_pOptions->m_Flags &= ~RENDER_CLEARTYPE;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 { 792 {
856 if (document == NULL) 793 if (document == NULL)
857 return NULL; 794 return NULL;
858 if (name == NULL || name[0] == 0) 795 if (name == NULL || name[0] == 0)
859 return NULL; 796 return NULL;
860 797
861 CPDF_Document* pDoc = (CPDF_Document*)document; 798 CPDF_Document* pDoc = (CPDF_Document*)document;
862 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); 799 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
863 return name_tree.LookupNamedDest(pDoc, name); 800 return name_tree.LookupNamedDest(pDoc, name);
864 } 801 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698