OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrGlyph_DEFINED | 8 #ifndef GrGlyph_DEFINED |
9 #define GrGlyph_DEFINED | 9 #define GrGlyph_DEFINED |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 GrBatchAtlas::AtlasID fID; | 34 GrBatchAtlas::AtlasID fID; |
35 SkPath* fPath; | 35 SkPath* fPath; |
36 PackedID fPackedID; | 36 PackedID fPackedID; |
37 GrMaskFormat fMaskFormat; | 37 GrMaskFormat fMaskFormat; |
38 GrIRect16 fBounds; | 38 GrIRect16 fBounds; |
39 SkIPoint16 fAtlasLocation; | 39 SkIPoint16 fAtlasLocation; |
40 bool fTooLargeForAtlas; | 40 bool fTooLargeForAtlas; |
41 | 41 |
42 void init(GrGlyph::PackedID packed, const SkIRect& bounds, GrMaskFormat form
at) { | 42 void init(GrGlyph::PackedID packed, const SkIRect& bounds, GrMaskFormat form
at) { |
43 fID = GrBatchAtlas::kInvalidAtlasID; | 43 fID = GrBatchAtlas::kInvalidAtlasID; |
44 fPath = NULL; | 44 fPath = nullptr; |
45 fPackedID = packed; | 45 fPackedID = packed; |
46 fBounds.set(bounds); | 46 fBounds.set(bounds); |
47 fMaskFormat = format; | 47 fMaskFormat = format; |
48 fAtlasLocation.set(0, 0); | 48 fAtlasLocation.set(0, 0); |
49 fTooLargeForAtlas = GrBatchAtlas::GlyphTooLargeForAtlas(bounds.width(),
bounds.height()); | 49 fTooLargeForAtlas = GrBatchAtlas::GlyphTooLargeForAtlas(bounds.width(),
bounds.height()); |
50 } | 50 } |
51 | 51 |
52 void free() { | 52 void free() { |
53 if (fPath) { | 53 if (fPath) { |
54 delete fPath; | 54 delete fPath; |
55 fPath = NULL; | 55 fPath = nullptr; |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 int width() const { return fBounds.width(); } | 59 int width() const { return fBounds.width(); } |
60 int height() const { return fBounds.height(); } | 60 int height() const { return fBounds.height(); } |
61 bool isEmpty() const { return fBounds.isEmpty(); } | 61 bool isEmpty() const { return fBounds.isEmpty(); } |
62 uint16_t glyphID() const { return UnpackID(fPackedID); } | 62 uint16_t glyphID() const { return UnpackID(fPackedID); } |
63 | 63 |
64 /////////////////////////////////////////////////////////////////////////// | 64 /////////////////////////////////////////////////////////////////////////// |
65 | 65 |
(...skipping 28 matching lines...) Expand all Loading... |
94 static inline const GrGlyph::PackedID& GetKey(const GrGlyph& glyph) { | 94 static inline const GrGlyph::PackedID& GetKey(const GrGlyph& glyph) { |
95 return glyph.fPackedID; | 95 return glyph.fPackedID; |
96 } | 96 } |
97 | 97 |
98 static inline uint32_t Hash(GrGlyph::PackedID key) { | 98 static inline uint32_t Hash(GrGlyph::PackedID key) { |
99 return SkChecksum::Mix(key); | 99 return SkChecksum::Mix(key); |
100 } | 100 } |
101 }; | 101 }; |
102 | 102 |
103 #endif | 103 #endif |
OLD | NEW |