diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-08-17 16:26:03 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-08-17 16:26:03 -0700 |
commit | ce4ffb8183af3fa2bb5133f0f7370a88e064c516 (patch) | |
tree | 16f05f79aed56678b45bea435addaa75fbb9f85f /core/include | |
parent | 52a48aadc19b2dee8abeb702269bb168eb6b6999 (diff) | |
download | pdfium-ce4ffb8183af3fa2bb5133f0f7370a88e064c516.tar.xz |
CFX_MapByteStringToPtr considered harmful.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1297723002 .
Diffstat (limited to 'core/include')
-rw-r--r-- | core/include/fxcrt/fx_basic.h | 69 | ||||
-rw-r--r-- | core/include/fxge/fx_font.h | 16 |
2 files changed, 10 insertions, 75 deletions
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 8f0212a467..e1025a2433 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -660,75 +660,6 @@ class CFX_CMapDWordToDWord { protected: CFX_BinaryBuf m_Buffer; }; -class CFX_MapByteStringToPtr { - protected: - struct CAssoc { - CAssoc* pNext; - - FX_DWORD nHashValue; - - CFX_ByteString key; - - void* value; - }; - - public: - CFX_MapByteStringToPtr(int nBlockSize = 10); - - int GetCount() const { return m_nCount; } - - FX_BOOL IsEmpty() const { return m_nCount == 0; } - - FX_BOOL Lookup(const CFX_ByteStringC& key, void*& rValue) const; - - void*& operator[](const CFX_ByteStringC& key); - - void SetAt(const CFX_ByteStringC& key, void* newValue) { - (*this)[key] = newValue; - } - - FX_BOOL RemoveKey(const CFX_ByteStringC& key); - - void RemoveAll(); - - FX_POSITION GetStartPosition() const { - return (m_nCount == 0) ? NULL : (FX_POSITION)-1; - } - - void GetNextAssoc(FX_POSITION& rNextPosition, - CFX_ByteString& rKey, - void*& rValue) const; - - void* GetNextValue(FX_POSITION& rNextPosition) const; - - FX_DWORD GetHashTableSize() const { return m_nHashTableSize; } - - void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow = TRUE); - - FX_DWORD HashKey(const CFX_ByteStringC& key) const; - - protected: - CAssoc** m_pHashTable; - - FX_DWORD m_nHashTableSize; - - int m_nCount; - - CAssoc* m_pFreeList; - - struct CFX_Plex* m_pBlocks; - - int m_nBlockSize; - - CAssoc* NewAssoc(); - - void FreeAssoc(CAssoc* pAssoc); - - CAssoc* GetAssocAt(const CFX_ByteStringC& key, FX_DWORD& hash) const; - - public: - ~CFX_MapByteStringToPtr(); -}; class CFX_CMapByteStringToPtr { public: CFX_CMapByteStringToPtr(); diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h index d9b557a87b..4111acee39 100644 --- a/core/include/fxge/fx_font.h +++ b/core/include/fxge/fx_font.h @@ -14,11 +14,16 @@ typedef struct FT_FaceRec_* FXFT_Face; typedef void* FXFT_Library; -class CFontFileFaceInfo; + class CFX_FaceCache; +class CFX_FontFaceInfo; class CFX_FontMapper; class CFX_PathData; +class CFX_SizeGlyphCache; class CFX_SubstFont; +class CFontFileFaceInfo; +class CTTFontDesc; +class IFX_FontEncoding; class IFX_SystemFontInfo; #define FXFONT_FIXED_PITCH 0x01 @@ -221,12 +226,11 @@ class CFX_FontMgr { int italic_angle, int CharsetCP, CFX_SubstFont* pSubstFont); - void FreeCache(); - FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); + CFX_FontMapper* m_pBuiltinMapper; - CFX_MapByteStringToPtr m_FaceMap; + std::map<CFX_ByteString, CTTFontDesc*> m_FaceMap; FXFT_Library m_FTLibrary; FoxitFonts m_ExternalFonts[16]; }; @@ -344,7 +348,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { FX_BOOL GetFontCharset(void* hFont, int& charset) override; protected: - CFX_MapByteStringToPtr m_FontList; + std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList; CFX_ByteStringArray m_PathList; CFX_FontMapper* m_pMapper; void ScanPath(CFX_ByteString& path); @@ -424,7 +428,7 @@ class CFX_FaceCache { FX_BOOL bFontStyle, int dest_width, int anti_alias); - CFX_MapByteStringToPtr m_SizeMap; + std::map<CFX_ByteString, CFX_SizeGlyphCache*> m_SizeMap; CFX_MapPtrToPtr m_PathMap; CFX_DIBitmap* m_pBitmap; |