diff options
Diffstat (limited to 'core/fxge')
-rw-r--r-- | core/fxge/cfx_facecache.h | 6 | ||||
-rw-r--r-- | core/fxge/ge/cfx_facecache.cpp | 15 |
2 files changed, 11 insertions, 10 deletions
diff --git a/core/fxge/cfx_facecache.h b/core/fxge/cfx_facecache.h index 076ba1f330..d6847debdb 100644 --- a/core/fxge/cfx_facecache.h +++ b/core/fxge/cfx_facecache.h @@ -14,10 +14,6 @@ #include "core/fxge/fx_font.h" #include "core/fxge/fx_freetype.h" -#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_ -#include "third_party/skia/include/core/SkTypeface.h" -#endif - class CFX_FaceCache { public: explicit CFX_FaceCache(FXFT_Face face); @@ -64,7 +60,7 @@ class CFX_FaceCache { std::map<CFX_ByteString, std::unique_ptr<CFX_SizeGlyphCache>> m_SizeMap; std::map<uint32_t, std::unique_ptr<CFX_PathData>> m_PathMap; #if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_ - sk_sp<SkTypeface> m_pTypeface; + CFX_UnownedPtr<CFX_TypeFace> m_pTypeface; #endif }; diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp index e675e11510..6049729089 100644 --- a/core/fxge/ge/cfx_facecache.cpp +++ b/core/fxge/ge/cfx_facecache.cpp @@ -89,6 +89,9 @@ CFX_FaceCache::CFX_FaceCache(FXFT_Face face) } CFX_FaceCache::~CFX_FaceCache() { +#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_ + SkSafeUnref(m_pTypeface.Get()); +#endif } std::unique_ptr<CFX_GlyphBitmap> CFX_FaceCache::RenderGlyph( @@ -355,17 +358,19 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont, #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_ CFX_TypeFace* CFX_FaceCache::GetDeviceCache(const CFX_Font* pFont) { if (!m_pTypeface) { - m_pTypeface = SkTypeface::MakeFromStream( - new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())); + m_pTypeface = + SkTypeface::MakeFromStream( + new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())) + .release(); } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ if (!m_pTypeface) { sk_sp<SkFontMgr> customMgr(SkFontMgr_New_Custom_Empty()); - m_pTypeface.reset(customMgr->createFromStream( - new SkMemoryStream(pFont->GetFontData(), pFont->GetSize()))); + m_pTypeface = customMgr->createFromStream( + new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())); } #endif - return m_pTypeface.get(); + return m_pTypeface.Get(); } #endif |