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

Side by Side Diff: core/fxge/include/fx_ge.h

Issue 2154843002: Clean up singleton implementation (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 5 months 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 #ifndef CORE_FXGE_INCLUDE_FX_GE_H_ 7 #ifndef CORE_FXGE_INCLUDE_FX_GE_H_
8 #define CORE_FXGE_INCLUDE_FX_GE_H_ 8 #define CORE_FXGE_INCLUDE_FX_GE_H_
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "core/fxge/include/fx_dib.h" 12 #include "core/fxge/include/fx_dib.h"
13 #include "core/fxge/include/fx_font.h" 13 #include "core/fxge/include/fx_font.h"
14 14
15 class CCodec_ModuleMgr; 15 class CCodec_ModuleMgr;
16 class CFX_FaceCache; 16 class CFX_FaceCache;
17 class CFX_Font; 17 class CFX_Font;
18 class CFX_FontCache; 18 class CFX_FontCache;
19 class CFX_FontMgr; 19 class CFX_FontMgr;
20 class CPDF_ShadingPattern; 20 class CPDF_ShadingPattern;
21 class IFX_RenderDeviceDriver; 21 class IFX_RenderDeviceDriver;
22 class SkPictureRecorder; 22 class SkPictureRecorder;
23 23
24 class CFX_GEModule { 24 class CFX_GEModule {
25 public: 25 public:
26 static void Create(const char** pUserFontPaths,
27 CCodec_ModuleMgr* pCodecModule);
28 static CFX_GEModule* Get(); 26 static CFX_GEModule* Get();
29 static void Destroy(); 27 static void Destroy();
30 28
29 void Init(const char** pUserFontPaths, CCodec_ModuleMgr* pCodecModule);
31 CFX_FontCache* GetFontCache(); 30 CFX_FontCache* GetFontCache();
32 CFX_FontMgr* GetFontMgr() { return m_pFontMgr.get(); } 31 CFX_FontMgr* GetFontMgr() { return m_pFontMgr.get(); }
33 void SetTextGamma(FX_FLOAT gammaValue); 32 void SetTextGamma(FX_FLOAT gammaValue);
34 const uint8_t* GetTextGammaTable() const; 33 const uint8_t* GetTextGammaTable() const;
35 34
36 CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; } 35 CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; }
37 void* GetPlatformData() { return m_pPlatformData; } 36 void* GetPlatformData() { return m_pPlatformData; }
38 37
39 FXFT_Library m_FTLibrary; 38 FXFT_Library m_FTLibrary;
40 39
41 private: 40 private:
42 CFX_GEModule(const char** pUserFontPaths, CCodec_ModuleMgr* pCodecModule); 41 CFX_GEModule();
43 ~CFX_GEModule(); 42 ~CFX_GEModule();
44 43
45 void InitPlatform(); 44 void InitPlatform();
46 void DestroyPlatform(); 45 void DestroyPlatform();
47 46
47 static CFX_GEModule* m_pGEModule;
Lei Zhang 2016/07/16 01:23:03 Leave as a global, for the same reason as CPDFXFA_
Wei Li 2016/07/18 19:07:07 Same here.
48
48 uint8_t m_GammaValue[256]; 49 uint8_t m_GammaValue[256];
49 CFX_FontCache* m_pFontCache; 50 CFX_FontCache* m_pFontCache;
50 std::unique_ptr<CFX_FontMgr> m_pFontMgr; 51 std::unique_ptr<CFX_FontMgr> m_pFontMgr;
51 CCodec_ModuleMgr* const m_pCodecModule; 52 CCodec_ModuleMgr* m_pCodecModule;
52 void* m_pPlatformData; 53 void* m_pPlatformData;
53 const char** m_pUserFontPaths; 54 const char** m_pUserFontPaths;
54 }; 55 };
55 56
56 struct FX_PATHPOINT { 57 struct FX_PATHPOINT {
57 FX_FLOAT m_PointX; 58 FX_FLOAT m_PointX;
58 FX_FLOAT m_PointY; 59 FX_FLOAT m_PointY;
59 int m_Flag; 60 int m_Flag;
60 }; 61 };
61 62
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 bool AttachRecorder(SkPictureRecorder* recorder); 423 bool AttachRecorder(SkPictureRecorder* recorder);
423 SkPictureRecorder* CreateRecorder(int size_x, int size_y); 424 SkPictureRecorder* CreateRecorder(int size_x, int size_y);
424 void DebugVerifyBitmapIsPreMultiplied() const override; 425 void DebugVerifyBitmapIsPreMultiplied() const override;
425 #endif 426 #endif
426 427
427 protected: 428 protected:
428 bool m_bOwnedBitmap; 429 bool m_bOwnedBitmap;
429 }; 430 };
430 431
431 #endif // CORE_FXGE_INCLUDE_FX_GE_H_ 432 #endif // CORE_FXGE_INCLUDE_FX_GE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698