1 // Copyright 2016 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "core/fxge/android/cfpf_skiadevicemodule.h" 8 9 #include <utility> 10 11 #include "core/fxge/android/cfpf_skiafontmgr.h" 12 13 namespace { 14 15 CFPF_SkiaDeviceModule* gs_pPFModule = nullptr; 16 17 } // namespace 18 CFPF_GetSkiaDeviceModule()19CFPF_SkiaDeviceModule* CFPF_GetSkiaDeviceModule() { 20 if (!gs_pPFModule) 21 gs_pPFModule = new CFPF_SkiaDeviceModule; 22 return gs_pPFModule; 23 } 24 25 CFPF_SkiaDeviceModule::CFPF_SkiaDeviceModule() = default; 26 27 CFPF_SkiaDeviceModule::~CFPF_SkiaDeviceModule() = default; 28 Destroy()29void CFPF_SkiaDeviceModule::Destroy() { 30 delete gs_pPFModule; 31 gs_pPFModule = nullptr; 32 } 33 GetFontMgr()34CFPF_SkiaFontMgr* CFPF_SkiaDeviceModule::GetFontMgr() { 35 if (!m_pFontMgr) { 36 auto pNewMgr = std::make_unique<CFPF_SkiaFontMgr>(); 37 if (!pNewMgr->InitFTLibrary()) 38 return nullptr; 39 m_pFontMgr = std::move(pNewMgr); 40 } 41 return m_pFontMgr.get(); 42 } 43