2 * Copyright 2010 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef sktext_gpu_Glyph_DEFINED
9 #define sktext_gpu_Glyph_DEFINED
11 #include "src/core/SkGlyph.h"
12 #include "src/core/SkMask.h"
13 #include "src/gpu/AtlasTypes.h"
15 namespace sktext::gpu {
19 static skgpu::MaskFormat FormatFromSkGlyph(SkMask::Format format) {
21 case SkMask::kBW_Format:
22 case SkMask::kSDF_Format:
23 // fall through to kA8 -- we store BW and SDF glyphs in our 8-bit cache
24 case SkMask::kA8_Format:
25 return skgpu::MaskFormat::kA8;
26 case SkMask::k3D_Format:
27 return skgpu::MaskFormat::kA8; // ignore the mul and add planes, just use the mask
28 case SkMask::kLCD16_Format:
29 return skgpu::MaskFormat::kA565;
30 case SkMask::kARGB32_Format:
31 return skgpu::MaskFormat::kARGB;
37 Glyph(SkPackedGlyphID packedGlyphID) : fPackedID(packedGlyphID) {}
39 const SkPackedGlyphID fPackedID;
40 skgpu::AtlasLocator fAtlasLocator;
43 } // namespace sktext::gpu
45 #endif // sktext_gpu_Glyph_DEFINED