aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/fonts/SkRemotableFontMgr.cpp
blob: 1139972848be68854deedef3b4d96858cbfba42d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * 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;
}