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 13 matching lines...) Expand all Loading... |
24 - failed to get metrics | 24 - failed to get metrics |
25 */ | 25 */ |
26 struct GrGlyph { | 26 struct GrGlyph { |
27 enum MaskStyle { | 27 enum MaskStyle { |
28 kCoverage_MaskStyle, | 28 kCoverage_MaskStyle, |
29 kDistance_MaskStyle | 29 kDistance_MaskStyle |
30 }; | 30 }; |
31 | 31 |
32 typedef uint32_t PackedID; | 32 typedef uint32_t PackedID; |
33 | 33 |
34 // TODO either plot or AtlasID will be valid, not both | |
35 GrBatchAtlas::AtlasID fID; | 34 GrBatchAtlas::AtlasID fID; |
36 GrPlot* fPlot; | |
37 SkPath* fPath; | 35 SkPath* fPath; |
38 PackedID fPackedID; | 36 PackedID fPackedID; |
39 GrMaskFormat fMaskFormat; | 37 GrMaskFormat fMaskFormat; |
40 GrIRect16 fBounds; | 38 GrIRect16 fBounds; |
41 SkIPoint16 fAtlasLocation; | 39 SkIPoint16 fAtlasLocation; |
42 bool fTooLargeForAtlas; | 40 bool fTooLargeForAtlas; |
43 | 41 |
44 void init(GrGlyph::PackedID packed, const SkIRect& bounds, GrMaskFormat form
at) { | 42 void init(GrGlyph::PackedID packed, const SkIRect& bounds, GrMaskFormat form
at) { |
45 fID = GrBatchAtlas::kInvalidAtlasID; | 43 fID = GrBatchAtlas::kInvalidAtlasID; |
46 fPlot = NULL; | |
47 fPath = NULL; | 44 fPath = NULL; |
48 fPackedID = packed; | 45 fPackedID = packed; |
49 fBounds.set(bounds); | 46 fBounds.set(bounds); |
50 fMaskFormat = format; | 47 fMaskFormat = format; |
51 fAtlasLocation.set(0, 0); | 48 fAtlasLocation.set(0, 0); |
52 fTooLargeForAtlas = GrBatchAtlas::GlyphTooLargeForAtlas(bounds.width(),
bounds.height()); | 49 fTooLargeForAtlas = GrBatchAtlas::GlyphTooLargeForAtlas(bounds.width(),
bounds.height()); |
53 } | 50 } |
54 | 51 |
55 void free() { | 52 void free() { |
56 if (fPath) { | 53 if (fPath) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 static inline const GrGlyph::PackedID& GetKey(const GrGlyph& glyph) { | 94 static inline const GrGlyph::PackedID& GetKey(const GrGlyph& glyph) { |
98 return glyph.fPackedID; | 95 return glyph.fPackedID; |
99 } | 96 } |
100 | 97 |
101 static inline uint32_t Hash(GrGlyph::PackedID key) { | 98 static inline uint32_t Hash(GrGlyph::PackedID key) { |
102 return SkChecksum::Mix(key); | 99 return SkChecksum::Mix(key); |
103 } | 100 } |
104 }; | 101 }; |
105 | 102 |
106 #endif | 103 #endif |
OLD | NEW |