blob: b50b27daeece5c484b39c80b69bd2db1dc6649b1 [file] [log] [blame]
reed@google.comac10a2d2010-12-22 21:39:39 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * 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.
reed@google.comac10a2d2010-12-22 21:39:39 +00006 */
7
reed@google.comac10a2d2010-12-22 21:39:39 +00008#ifndef GrGlyph_DEFINED
9#define GrGlyph_DEFINED
10
Robert Phillips51b3e602020-04-09 12:48:50 -040011#include "include/private/GrTypesPriv.h"
12#include "src/core/SkGlyph.h"
13#include "src/core/SkMask.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050014#include "src/gpu/GrDrawOpAtlas.h"
reed@google.comac10a2d2010-12-22 21:39:39 +000015
Robert Phillips5fa68b42020-03-31 08:34:22 -040016class GrGlyph {
17public:
Herb Derbya4eecd82019-06-25 15:05:30 -040018 static GrMaskFormat FormatFromSkGlyph(SkMask::Format format) {
19 switch (format) {
Herb Derby5a3fdee2018-12-20 14:47:03 -050020 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;
Herb Derby5a3fdee2018-12-20 14:47:03 -050031 }
rmistry@google.comfbfcd562012-08-23 18:09:54 +000032
Robert Phillips5fa68b42020-03-31 08:34:22 -040033 SkUNREACHABLE;
Herb Derby5a3fdee2018-12-20 14:47:03 -050034 }
35
Robert Phillips297a2192020-04-08 15:26:54 -040036 GrGlyph(SkPackedGlyphID packedGlyphID) : fPackedID(packedGlyphID) {}
Herb Derby438ea542018-12-19 18:25:11 -050037
Robert Phillips6d3bc292020-04-06 10:29:28 -040038 const SkPackedGlyphID fPackedID;
39 GrDrawOpAtlas::AtlasLocator fAtlasLocator;
jvanverthdd6d2272014-07-22 13:25:26 -070040};
reed@google.comac10a2d2010-12-22 21:39:39 +000041
42#endif