OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_CFX_FACECACHE_H_ | 7 #ifndef CORE_FXGE_INCLUDE_CFX_FACECACHE_H_ |
8 #define CORE_FXGE_INCLUDE_CFX_FACECACHE_H_ | 8 #define CORE_FXGE_INCLUDE_CFX_FACECACHE_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "core/fxge/include/fx_font.h" | 12 #include "core/fxge/include/fx_font.h" |
13 #include "core/fxge/include/fx_freetype.h" | 13 #include "core/fxge/include/fx_freetype.h" |
14 | 14 |
15 class CFX_FaceCache { | 15 class CFX_FaceCache { |
16 public: | 16 public: |
17 explicit CFX_FaceCache(FXFT_Face face); | 17 explicit CFX_FaceCache(FXFT_Face face); |
18 ~CFX_FaceCache(); | 18 ~CFX_FaceCache(); |
19 const CFX_GlyphBitmap* LoadGlyphBitmap(CFX_Font* pFont, | 19 const CFX_GlyphBitmap* LoadGlyphBitmap(const CFX_Font* pFont, |
20 uint32_t glyph_index, | 20 uint32_t glyph_index, |
21 FX_BOOL bFontStyle, | 21 FX_BOOL bFontStyle, |
22 const CFX_Matrix* pMatrix, | 22 const CFX_Matrix* pMatrix, |
23 int dest_width, | 23 int dest_width, |
24 int anti_alias, | 24 int anti_alias, |
25 int& text_flags); | 25 int& text_flags); |
26 const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, | 26 const CFX_PathData* LoadGlyphPath(const CFX_Font* pFont, |
27 uint32_t glyph_index, | 27 uint32_t glyph_index, |
28 int dest_width); | 28 int dest_width); |
29 | 29 |
30 #ifdef _SKIA_SUPPORT_ | 30 #ifdef _SKIA_SUPPORT_ |
31 CFX_TypeFace* GetDeviceCache(CFX_Font* pFont); | 31 CFX_TypeFace* GetDeviceCache(const CFX_Font* pFont); |
32 #endif | 32 #endif |
33 | 33 |
34 private: | 34 private: |
35 CFX_GlyphBitmap* RenderGlyph(CFX_Font* pFont, | 35 CFX_GlyphBitmap* RenderGlyph(const CFX_Font* pFont, |
36 uint32_t glyph_index, | 36 uint32_t glyph_index, |
37 FX_BOOL bFontStyle, | 37 FX_BOOL bFontStyle, |
38 const CFX_Matrix* pMatrix, | 38 const CFX_Matrix* pMatrix, |
39 int dest_width, | 39 int dest_width, |
40 int anti_alias); | 40 int anti_alias); |
41 CFX_GlyphBitmap* RenderGlyph_Nativetext(CFX_Font* pFont, | 41 CFX_GlyphBitmap* RenderGlyph_Nativetext(const CFX_Font* pFont, |
42 uint32_t glyph_index, | 42 uint32_t glyph_index, |
43 const CFX_Matrix* pMatrix, | 43 const CFX_Matrix* pMatrix, |
44 int dest_width, | 44 int dest_width, |
45 int anti_alias); | 45 int anti_alias); |
46 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, | 46 CFX_GlyphBitmap* LookUpGlyphBitmap(const CFX_Font* pFont, |
47 const CFX_Matrix* pMatrix, | 47 const CFX_Matrix* pMatrix, |
48 const CFX_ByteString& FaceGlyphsKey, | 48 const CFX_ByteString& FaceGlyphsKey, |
49 uint32_t glyph_index, | 49 uint32_t glyph_index, |
50 FX_BOOL bFontStyle, | 50 FX_BOOL bFontStyle, |
51 int dest_width, | 51 int dest_width, |
52 int anti_alias); | 52 int anti_alias); |
53 void InitPlatform(); | 53 void InitPlatform(); |
54 void DestroyPlatform(); | 54 void DestroyPlatform(); |
55 | 55 |
56 FXFT_Face const m_Face; | 56 FXFT_Face const m_Face; |
57 std::map<CFX_ByteString, std::unique_ptr<CFX_SizeGlyphCache>> m_SizeMap; | 57 std::map<CFX_ByteString, std::unique_ptr<CFX_SizeGlyphCache>> m_SizeMap; |
58 std::map<uint32_t, std::unique_ptr<CFX_PathData>> m_PathMap; | 58 std::map<uint32_t, std::unique_ptr<CFX_PathData>> m_PathMap; |
59 #ifdef _SKIA_SUPPORT_ | 59 #ifdef _SKIA_SUPPORT_ |
60 CFX_TypeFace* m_pTypeface; | 60 CFX_TypeFace* m_pTypeface; |
61 #endif | 61 #endif |
62 }; | 62 }; |
63 | 63 |
64 #endif // CORE_FXGE_INCLUDE_CFX_FACECACHE_H_ | 64 #endif // CORE_FXGE_INCLUDE_CFX_FACECACHE_H_ |
OLD | NEW |