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 |
| 11 #include "GrBatchAtlas.h" |
11 #include "GrRect.h" | 12 #include "GrRect.h" |
12 #include "GrTypes.h" | 13 #include "GrTypes.h" |
13 | 14 |
14 #include "SkChecksum.h" | 15 #include "SkChecksum.h" |
15 #include "SkPath.h" | 16 #include "SkPath.h" |
16 | 17 |
17 class GrPlot; | 18 class GrPlot; |
18 | 19 |
19 /* Need this to be quad-state: | 20 /* Need this to be quad-state: |
20 - complete w/ image | 21 - complete w/ image |
21 - just metrics | 22 - just metrics |
22 - failed to get image, but has metrics | 23 - failed to get image, but has metrics |
23 - failed to get metrics | 24 - failed to get metrics |
24 */ | 25 */ |
25 struct GrGlyph { | 26 struct GrGlyph { |
26 enum MaskStyle { | 27 enum MaskStyle { |
27 kCoverage_MaskStyle, | 28 kCoverage_MaskStyle, |
28 kDistance_MaskStyle | 29 kDistance_MaskStyle |
29 }; | 30 }; |
30 | 31 |
31 typedef uint32_t PackedID; | 32 typedef uint32_t PackedID; |
32 | 33 |
33 GrPlot* fPlot; | 34 // TODO either plot or AtlasID will be valid, not both |
34 SkPath* fPath; | 35 GrBatchAtlas::AtlasID fID; |
35 PackedID fPackedID; | 36 GrPlot* fPlot; |
36 GrMaskFormat fMaskFormat; | 37 SkPath* fPath; |
37 GrIRect16 fBounds; | 38 PackedID fPackedID; |
38 SkIPoint16 fAtlasLocation; | 39 GrMaskFormat fMaskFormat; |
| 40 GrIRect16 fBounds; |
| 41 SkIPoint16 fAtlasLocation; |
39 | 42 |
40 void init(GrGlyph::PackedID packed, const SkIRect& bounds, GrMaskFormat form
at) { | 43 void init(GrGlyph::PackedID packed, const SkIRect& bounds, GrMaskFormat form
at) { |
| 44 fID = GrBatchAtlas::kInvalidAtlasID; |
41 fPlot = NULL; | 45 fPlot = NULL; |
42 fPath = NULL; | 46 fPath = NULL; |
43 fPackedID = packed; | 47 fPackedID = packed; |
44 fBounds.set(bounds); | 48 fBounds.set(bounds); |
45 fMaskFormat = format; | 49 fMaskFormat = format; |
46 fAtlasLocation.set(0, 0); | 50 fAtlasLocation.set(0, 0); |
47 } | 51 } |
48 | 52 |
49 void free() { | 53 void free() { |
50 if (fPath) { | 54 if (fPath) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 static inline const GrGlyph::PackedID& GetKey(const GrGlyph& glyph) { | 95 static inline const GrGlyph::PackedID& GetKey(const GrGlyph& glyph) { |
92 return glyph.fPackedID; | 96 return glyph.fPackedID; |
93 } | 97 } |
94 | 98 |
95 static inline uint32_t Hash(GrGlyph::PackedID key) { | 99 static inline uint32_t Hash(GrGlyph::PackedID key) { |
96 return SkChecksum::Murmur3(&key, sizeof(key)); | 100 return SkChecksum::Murmur3(&key, sizeof(key)); |
97 } | 101 } |
98 }; | 102 }; |
99 | 103 |
100 #endif | 104 #endif |
OLD | NEW |