skia2/src/fonts/SkRemotableFontMgr.cpp
bungeman@google.com 72cf4fcafa A remotable font management interface and DirectWrite implementation.
The introduced SkRemotableFontMgr is a font management interface designed for simple and fast proxy support. SkFontMgr_Indirect bridges a SkRemotableFontMgr and a local SkFontMgr to present a SkFontMgr interface.

This change is to be followed by https://codereview.chromium.org/132113015/ and  https://codereview.chromium.org/206693003 .

R=reed@google.com

Review URL: https://codereview.chromium.org/206683002

git-svn-id: http://skia.googlecode.com/svn/trunk@13897 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-03-21 22:48:32 +00:00

33 lines
974 B
C++

/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkRemotableFontMgr.h"
#include "SkOnce.h"
SkRemotableFontIdentitySet::SkRemotableFontIdentitySet(int count, SkFontIdentity** data)
: fCount(count), fData(count)
{
SkASSERT(data);
*data = fData;
}
static SkRemotableFontIdentitySet* gEmptyRemotableFontIdentitySet = NULL;
static void cleanup_gEmptyRemotableFontIdentitySet() { gEmptyRemotableFontIdentitySet->unref(); }
void SkRemotableFontIdentitySet::NewEmptyImpl(int) {
gEmptyRemotableFontIdentitySet = new SkRemotableFontIdentitySet();
}
SkRemotableFontIdentitySet* SkRemotableFontIdentitySet::NewEmpty() {
SK_DECLARE_STATIC_ONCE(once);
SkOnce(&once, SkRemotableFontIdentitySet::NewEmptyImpl, 0,
cleanup_gEmptyRemotableFontIdentitySet);
gEmptyRemotableFontIdentitySet->ref();
return gEmptyRemotableFontIdentitySet;
}