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