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 "GrRect.h" | 11 #include "GrRect.h" |
12 #include "GrTypes.h" | 12 #include "SkPath.h" |
13 | |
14 #include "SkChecksum.h" | 13 #include "SkChecksum.h" |
15 #include "SkPath.h" | |
16 | 14 |
17 class GrPlot; | 15 class GrPlot; |
18 | 16 |
19 /* Need this to be quad-state: | 17 /* Need this to be quad-state: |
20 - complete w/ image | 18 - complete w/ image |
21 - just metrics | 19 - just metrics |
22 - failed to get image, but has metrics | 20 - failed to get image, but has metrics |
23 - failed to get metrics | 21 - failed to get metrics |
24 */ | 22 */ |
25 struct GrGlyph { | 23 struct GrGlyph { |
26 typedef uint32_t PackedID; | 24 typedef uint32_t PackedID; |
27 | 25 |
28 GrPlot* fPlot; | 26 GrPlot* fPlot; |
29 SkPath* fPath; | 27 SkPath* fPath; |
30 PackedID fPackedID; | 28 PackedID fPackedID; |
31 GrMaskFormat fMaskFormat; | 29 GrIRect16 fBounds; |
32 GrIRect16 fBounds; | 30 SkIPoint16 fAtlasLocation; |
33 SkIPoint16 fAtlasLocation; | |
34 | 31 |
35 void init(GrGlyph::PackedID packed, const SkIRect& bounds, GrMaskFormat form
at) { | 32 void init(GrGlyph::PackedID packed, const SkIRect& bounds) { |
36 fPlot = NULL; | 33 fPlot = NULL; |
37 fPath = NULL; | 34 fPath = NULL; |
38 fPackedID = packed; | 35 fPackedID = packed; |
39 fBounds.set(bounds); | 36 fBounds.set(bounds); |
40 fMaskFormat = format; | |
41 fAtlasLocation.set(0, 0); | 37 fAtlasLocation.set(0, 0); |
42 } | 38 } |
43 | 39 |
44 void free() { | 40 void free() { |
45 if (fPath) { | 41 if (fPath) { |
46 delete fPath; | 42 delete fPath; |
47 fPath = NULL; | 43 fPath = NULL; |
48 } | 44 } |
49 } | 45 } |
50 | 46 |
(...skipping 30 matching lines...) Expand all Loading... |
81 static inline const GrGlyph::PackedID& GetKey(const GrGlyph& glyph) { | 77 static inline const GrGlyph::PackedID& GetKey(const GrGlyph& glyph) { |
82 return glyph.fPackedID; | 78 return glyph.fPackedID; |
83 } | 79 } |
84 | 80 |
85 static inline uint32_t Hash(GrGlyph::PackedID key) { | 81 static inline uint32_t Hash(GrGlyph::PackedID key) { |
86 return SkChecksum::Murmur3(&key, sizeof(key)); | 82 return SkChecksum::Murmur3(&key, sizeof(key)); |
87 } | 83 } |
88 }; | 84 }; |
89 | 85 |
90 #endif | 86 #endif |
OLD | NEW |