From 24508dff1636d80be01497e30fccd21533fc0bde Mon Sep 17 00:00:00 2001 From: thestig Date: Fri, 27 May 2016 15:14:20 -0700 Subject: Clean up some Android/Windows code. Review-Url: https://codereview.chromium.org/2004313007 --- core/fxge/android/fx_android_font.h | 41 ++++++++++++++++++------------------ core/fxge/android/fx_android_imp.cpp | 7 ++++-- 2 files changed, 25 insertions(+), 23 deletions(-) (limited to 'core/fxge/android') diff --git a/core/fxge/android/fx_android_font.h b/core/fxge/android/fx_android_font.h index 07d5f5852b..c9c68e347a 100644 --- a/core/fxge/android/fx_android_font.h +++ b/core/fxge/android/fx_android_font.h @@ -18,29 +18,28 @@ class CFPF_SkiaFontMgr; class CFX_AndroidFontInfo : public IFX_SystemFontInfo { public: CFX_AndroidFontInfo(); - virtual void Release() { delete this; } - - virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); - - virtual void* MapFont(int weight, - FX_BOOL bItalic, - int charset, - int pitch_family, - const FX_CHAR* face, - int& bExact); - - virtual void* GetFont(const FX_CHAR* face); - virtual uint32_t GetFontData(void* hFont, - uint32_t table, - uint8_t* buffer, - uint32_t size); - virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); - virtual FX_BOOL GetFontCharset(void* hFont, int& charset); - - virtual void DeleteFont(void* hFont); - virtual void* RetainFont(void* hFont); + ~CFX_AndroidFontInfo() override; + FX_BOOL Init(CFPF_SkiaFontMgr* pFontMgr); + // IFX_SystemFontInfo: + FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; + void* MapFont(int weight, + FX_BOOL bItalic, + int charset, + int pitch_family, + const FX_CHAR* face, + int& bExact) override; + void* GetFont(const FX_CHAR* face) override; + uint32_t GetFontData(void* hFont, + uint32_t table, + uint8_t* buffer, + uint32_t size) override; + FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; + FX_BOOL GetFontCharset(void* hFont, int& charset) override; + void DeleteFont(void* hFont) override; + void* RetainFont(void* hFont) override; + protected: CFPF_SkiaFontMgr* m_pFontMgr; }; diff --git a/core/fxge/android/fx_android_imp.cpp b/core/fxge/android/fx_android_imp.cpp index bbaa2ba27a..08fdea3d89 100644 --- a/core/fxge/android/fx_android_imp.cpp +++ b/core/fxge/android/fx_android_imp.cpp @@ -8,6 +8,9 @@ #if _FX_OS_ == _FX_ANDROID_ +#include +#include + #include "core/fxge/android/fpf_skiamodule.h" #include "core/fxge/android/fx_android_font.h" #include "core/fxge/include/fx_ge.h" @@ -19,9 +22,9 @@ void CFX_GEModule::InitPlatform() { CFPF_SkiaFontMgr* pFontMgr = pDeviceModule->GetFontMgr(); if (pFontMgr) { - CFX_AndroidFontInfo* pFontInfo = new CFX_AndroidFontInfo; + std::unique_ptr pFontInfo(new CFX_AndroidFontInfo); pFontInfo->Init(pFontMgr); - m_pFontMgr->SetSystemFontInfo(pFontInfo); + m_pFontMgr->SetSystemFontInfo(std::move(pFontInfo)); } m_pPlatformData = pDeviceModule; } -- cgit v1.2.3