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 21 matching lines...) Expand all Loading... |
32 typedef uint32_t PackedID; | 32 typedef uint32_t PackedID; |
33 | 33 |
34 // TODO either plot or AtlasID will be valid, not both | 34 // TODO either plot or AtlasID will be valid, not both |
35 GrBatchAtlas::AtlasID fID; | 35 GrBatchAtlas::AtlasID fID; |
36 GrPlot* fPlot; | 36 GrPlot* fPlot; |
37 SkPath* fPath; | 37 SkPath* fPath; |
38 PackedID fPackedID; | 38 PackedID fPackedID; |
39 GrMaskFormat fMaskFormat; | 39 GrMaskFormat fMaskFormat; |
40 GrIRect16 fBounds; | 40 GrIRect16 fBounds; |
41 SkIPoint16 fAtlasLocation; | 41 SkIPoint16 fAtlasLocation; |
| 42 bool fTooLargeForAtlas; |
42 | 43 |
43 void init(GrGlyph::PackedID packed, const SkIRect& bounds, GrMaskFormat form
at) { | 44 void init(GrGlyph::PackedID packed, const SkIRect& bounds, GrMaskFormat form
at) { |
44 fID = GrBatchAtlas::kInvalidAtlasID; | 45 fID = GrBatchAtlas::kInvalidAtlasID; |
45 fPlot = NULL; | 46 fPlot = NULL; |
46 fPath = NULL; | 47 fPath = NULL; |
47 fPackedID = packed; | 48 fPackedID = packed; |
48 fBounds.set(bounds); | 49 fBounds.set(bounds); |
49 fMaskFormat = format; | 50 fMaskFormat = format; |
50 fAtlasLocation.set(0, 0); | 51 fAtlasLocation.set(0, 0); |
| 52 fTooLargeForAtlas = GrBatchAtlas::GlyphTooLargeForAtlas(bounds.width(),
bounds.height()); |
51 } | 53 } |
52 | 54 |
53 void free() { | 55 void free() { |
54 if (fPath) { | 56 if (fPath) { |
55 delete fPath; | 57 delete fPath; |
56 fPath = NULL; | 58 fPath = NULL; |
57 } | 59 } |
58 } | 60 } |
59 | 61 |
60 int width() const { return fBounds.width(); } | 62 int width() const { return fBounds.width(); } |
(...skipping 29 matching lines...) Expand all Loading... |
90 | 92 |
91 static inline uint16_t UnpackID(PackedID packed) { | 93 static inline uint16_t UnpackID(PackedID packed) { |
92 return (uint16_t)packed; | 94 return (uint16_t)packed; |
93 } | 95 } |
94 | 96 |
95 static inline const GrGlyph::PackedID& GetKey(const GrGlyph& glyph) { | 97 static inline const GrGlyph::PackedID& GetKey(const GrGlyph& glyph) { |
96 return glyph.fPackedID; | 98 return glyph.fPackedID; |
97 } | 99 } |
98 | 100 |
99 static inline uint32_t Hash(GrGlyph::PackedID key) { | 101 static inline uint32_t Hash(GrGlyph::PackedID key) { |
100 return SkChecksum::Murmur3(&key, sizeof(key)); | 102 return SkChecksum::Mix(key); |
101 } | 103 } |
102 }; | 104 }; |
103 | 105 |
104 #endif | 106 #endif |
OLD | NEW |