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

Side by Side Diff: core/fxge/android/fpf_skiafontmgr.h

Issue 2032613003: Get rid of NULLs in core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: s/NULL/nullptr/ Created 4 years, 6 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_ANDROID_FPF_SKIAFONTMGR_H_ 7 #ifndef CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_
8 #define CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ 8 #define CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_
9 9
10 #include "core/fxcrt/include/fx_system.h" 10 #include "core/fxcrt/include/fx_system.h"
(...skipping 10 matching lines...) Expand all
21 #define FPF_SKIAFONTTYPE_File 2 21 #define FPF_SKIAFONTTYPE_File 2
22 #define FPF_SKIAFONTTYPE_Buffer 3 22 #define FPF_SKIAFONTTYPE_Buffer 3
23 23
24 #define FPF_MATCHFONT_REPLACEANSI 1 24 #define FPF_MATCHFONT_REPLACEANSI 1
25 25
26 class CFPF_SkiaFont; 26 class CFPF_SkiaFont;
27 27
28 class CFPF_SkiaFontDescriptor { 28 class CFPF_SkiaFontDescriptor {
29 public: 29 public:
30 CFPF_SkiaFontDescriptor() 30 CFPF_SkiaFontDescriptor()
31 : m_pFamily(NULL), 31 : m_pFamily(nullptr),
32 m_dwStyle(0), 32 m_dwStyle(0),
33 m_iFaceIndex(0), 33 m_iFaceIndex(0),
34 m_dwCharsets(0), 34 m_dwCharsets(0),
35 m_iGlyphNum(0) {} 35 m_iGlyphNum(0) {}
36 virtual ~CFPF_SkiaFontDescriptor() { FX_Free(m_pFamily); } 36 virtual ~CFPF_SkiaFontDescriptor() { FX_Free(m_pFamily); }
37 37
38 virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; } 38 virtual int32_t GetType() const { return FPF_SKIAFONTTYPE_Unknown; }
39 39
40 void SetFamily(const FX_CHAR* pFamily) { 40 void SetFamily(const FX_CHAR* pFamily) {
41 FX_Free(m_pFamily); 41 FX_Free(m_pFamily);
42 int32_t iSize = FXSYS_strlen(pFamily); 42 int32_t iSize = FXSYS_strlen(pFamily);
43 m_pFamily = FX_Alloc(FX_CHAR, iSize + 1); 43 m_pFamily = FX_Alloc(FX_CHAR, iSize + 1);
44 FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(FX_CHAR)); 44 FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(FX_CHAR));
45 m_pFamily[iSize] = 0; 45 m_pFamily[iSize] = 0;
46 } 46 }
47 FX_CHAR* m_pFamily; 47 FX_CHAR* m_pFamily;
48 uint32_t m_dwStyle; 48 uint32_t m_dwStyle;
49 int32_t m_iFaceIndex; 49 int32_t m_iFaceIndex;
50 uint32_t m_dwCharsets; 50 uint32_t m_dwCharsets;
51 int32_t m_iGlyphNum; 51 int32_t m_iGlyphNum;
52 }; 52 };
53 53
54 class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor { 54 class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor {
55 public: 55 public:
56 CFPF_SkiaPathFont() : m_pPath(NULL) {} 56 CFPF_SkiaPathFont() : m_pPath(nullptr) {}
57 ~CFPF_SkiaPathFont() override { FX_Free(m_pPath); } 57 ~CFPF_SkiaPathFont() override { FX_Free(m_pPath); }
58 58
59 // CFPF_SkiaFontDescriptor 59 // CFPF_SkiaFontDescriptor
60 int32_t GetType() const override { return FPF_SKIAFONTTYPE_Path; } 60 int32_t GetType() const override { return FPF_SKIAFONTTYPE_Path; }
61 61
62 void SetPath(const FX_CHAR* pPath) { 62 void SetPath(const FX_CHAR* pPath) {
63 FX_Free(m_pPath); 63 FX_Free(m_pPath);
64 int32_t iSize = FXSYS_strlen(pPath); 64 int32_t iSize = FXSYS_strlen(pPath);
65 m_pPath = FX_Alloc(FX_CHAR, iSize + 1); 65 m_pPath = FX_Alloc(FX_CHAR, iSize + 1);
66 FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(FX_CHAR)); 66 FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(FX_CHAR));
67 m_pPath[iSize] = 0; 67 m_pPath[iSize] = 0;
68 } 68 }
69 FX_CHAR* m_pPath; 69 FX_CHAR* m_pPath;
70 }; 70 };
71 71
72 class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { 72 class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor {
73 public: 73 public:
74 CFPF_SkiaFileFont() : m_pFile(NULL) {} 74 CFPF_SkiaFileFont() : m_pFile(nullptr) {}
75 75
76 // CFPF_SkiaFontDescriptor 76 // CFPF_SkiaFontDescriptor
77 int32_t GetType() const override { return FPF_SKIAFONTTYPE_File; } 77 int32_t GetType() const override { return FPF_SKIAFONTTYPE_File; }
78 IFX_FileRead* m_pFile; 78 IFX_FileRead* m_pFile;
79 }; 79 };
80 80
81 class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor { 81 class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor {
82 public: 82 public:
83 CFPF_SkiaBufferFont() : m_pBuffer(NULL), m_szBuffer(0) {} 83 CFPF_SkiaBufferFont() : m_pBuffer(nullptr), m_szBuffer(0) {}
84 84
85 // CFPF_SkiaFontDescriptor 85 // CFPF_SkiaFontDescriptor
86 int32_t GetType() const override { return FPF_SKIAFONTTYPE_Buffer; } 86 int32_t GetType() const override { return FPF_SKIAFONTTYPE_Buffer; }
87 87
88 void* m_pBuffer; 88 void* m_pBuffer;
89 size_t m_szBuffer; 89 size_t m_szBuffer;
90 }; 90 };
91 91
92 class CFPF_SkiaFontMgr { 92 class CFPF_SkiaFontMgr {
93 public: 93 public:
(...skipping 24 matching lines...) Expand all
118 118
119 FX_BOOL m_bLoaded; 119 FX_BOOL m_bLoaded;
120 FXFT_Library m_FTLibrary; 120 FXFT_Library m_FTLibrary;
121 std::vector<CFPF_SkiaFontDescriptor*> m_FontFaces; 121 std::vector<CFPF_SkiaFontDescriptor*> m_FontFaces;
122 std::map<uint32_t, CFPF_SkiaFont*> m_FamilyFonts; 122 std::map<uint32_t, CFPF_SkiaFont*> m_FamilyFonts;
123 }; 123 };
124 124
125 #endif // _FX_OS_ == _FX_ANDROID_ 125 #endif // _FX_OS_ == _FX_ANDROID_
126 126
127 #endif // CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_ 127 #endif // CORE_FXGE_ANDROID_FPF_SKIAFONTMGR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698