1 /*
2  * Copyright 2019 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 
9 
10 #include "src/core/SkStrikeForGPU.h"
11 
12 #include "src/core/SkGlyphRunPainter.h"
13 
CanDrawAsMask(const SkGlyph & glyph)14 bool SkStrikeForGPU::CanDrawAsMask(const SkGlyph& glyph) {
15     return FitsInAtlas(glyph);
16 }
17 
CanDrawAsSDFT(const SkGlyph & glyph)18 bool SkStrikeForGPU::CanDrawAsSDFT(const SkGlyph& glyph) {
19     return FitsInAtlas(glyph) && glyph.maskFormat() == SkMask::kSDF_Format;
20 }
21 
CanDrawAsPath(const SkGlyph & glyph)22 bool SkStrikeForGPU::CanDrawAsPath(const SkGlyph& glyph) {
23     SkASSERT(glyph.isColor() || glyph.setPathHasBeenCalled());
24     return !glyph.isColor() && glyph.path() != nullptr;
25 }
26 
FitsInAtlas(const SkGlyph & glyph)27 bool SkStrikeForGPU::FitsInAtlas(const SkGlyph& glyph) {
28     return glyph.maxDimension() <= SkStrikeCommon::kSkSideTooBigForAtlas;
29 }
30 
31