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 <utility> 10 11 #include "core/fxge/android/cfpf_skiafontmgr.h" 12 #include "third_party/base/ptr_util.h" 13 14 namespace { 15 16 CFPF_SkiaDeviceModule* gs_pPFModule = nullptr; 17 18 } // namespace 19 CFPF_GetSkiaDeviceModule()20CFPF_SkiaDeviceModule* CFPF_GetSkiaDeviceModule() { 21 if (!gs_pPFModule) 22 gs_pPFModule = new CFPF_SkiaDeviceModule; 23 return gs_pPFModule; 24 } 25 CFPF_SkiaDeviceModule()26CFPF_SkiaDeviceModule::CFPF_SkiaDeviceModule() {} 27 ~CFPF_SkiaDeviceModule()28CFPF_SkiaDeviceModule::~CFPF_SkiaDeviceModule() {} 29 Destroy()30void CFPF_SkiaDeviceModule::Destroy() { 31 delete gs_pPFModule; 32 gs_pPFModule = nullptr; 33 } 34 GetFontMgr()35CFPF_SkiaFontMgr* CFPF_SkiaDeviceModule::GetFontMgr() { 36 if (!m_pFontMgr) { 37 auto pNewMgr = pdfium::MakeUnique<CFPF_SkiaFontMgr>(); 38 if (!pNewMgr->InitFTLibrary()) 39 return nullptr; 40 m_pFontMgr = std::move(pNewMgr); 41 } 42 return m_pFontMgr.get(); 43 } 44