1/*
2 * Copyright 2010 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrGlyph_DEFINED
9#define GrGlyph_DEFINED
10
11#include "include/private/GrTypesPriv.h"
12#include "src/core/SkGlyph.h"
13#include "src/core/SkMask.h"
14#include "src/gpu/GrDrawOpAtlas.h"
15
16class GrGlyph {
17public:
18 static GrMaskFormat FormatFromSkGlyph(SkMask::Format format) {
19 switch (format) {
20 case SkMask::kBW_Format:
21 case SkMask::kSDF_Format:
22 // fall through to kA8 -- we store BW and SDF glyphs in our 8-bit cache
23 case SkMask::kA8_Format:
24 return kA8_GrMaskFormat;
25 case SkMask::k3D_Format:
26 return kA8_GrMaskFormat; // ignore the mul and add planes, just use the mask
27 case SkMask::kLCD16_Format:
28 return kA565_GrMaskFormat;
29 case SkMask::kARGB32_Format:
30 return kARGB_GrMaskFormat;
31 }
32
33 SkUNREACHABLE;
34 }
35
36 GrGlyph(SkPackedGlyphID packedGlyphID) : fPackedID(packedGlyphID) {}
37
38 const SkPackedGlyphID fPackedID;
39 GrDrawOpAtlas::AtlasLocator fAtlasLocator;
40};
41
42#endif
43