1 // Copyright 2016 PDFium Authors. All rights reserved. 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 "core/fxge/android/cfpf_skiafontmgr.h" 10 11 namespace { 12 13 CFPF_SkiaDeviceModule* gs_pPFModule = nullptr; 14 15 } // namespace 16 CFPF_GetSkiaDeviceModule()17CFPF_SkiaDeviceModule* CFPF_GetSkiaDeviceModule() { 18 if (!gs_pPFModule) 19 gs_pPFModule = new CFPF_SkiaDeviceModule; 20 return gs_pPFModule; 21 } 22 ~CFPF_SkiaDeviceModule()23CFPF_SkiaDeviceModule::~CFPF_SkiaDeviceModule() { 24 delete m_pFontMgr; 25 } 26 Destroy()27void CFPF_SkiaDeviceModule::Destroy() { 28 delete gs_pPFModule; 29 gs_pPFModule = nullptr; 30 } 31 GetFontMgr()32CFPF_SkiaFontMgr* CFPF_SkiaDeviceModule::GetFontMgr() { 33 if (!m_pFontMgr) { 34 m_pFontMgr = new CFPF_SkiaFontMgr; 35 if (!m_pFontMgr->InitFTLibrary()) { 36 delete m_pFontMgr; 37 return nullptr; 38 } 39 } 40 return m_pFontMgr; 41 } 42