| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 | |
| 10 | |
| 11 #ifndef GrGlyph_DEFINED | 8 #ifndef GrGlyph_DEFINED |
| 12 #define GrGlyph_DEFINED | 9 #define GrGlyph_DEFINED |
| 13 | 10 |
| 14 #include "GrRect.h" | 11 #include "GrRect.h" |
| 15 #include "SkPath.h" | 12 #include "SkPath.h" |
| 16 | 13 |
| 17 class GrAtlas; | 14 class GrAtlas; |
| 18 | 15 |
| 19 /* Need this to be quad-state: | 16 /* Need this to be quad-state: |
| 20 - complete w/ image | 17 - complete w/ image |
| 21 - just metrics | 18 - just metrics |
| 22 - failed to get image, but has metrics | 19 - failed to get image, but has metrics |
| 23 - failed to get metrics | 20 - failed to get metrics |
| 24 */ | 21 */ |
| 25 struct GrGlyph { | 22 struct GrGlyph { |
| 26 typedef uint32_t PackedID; | 23 typedef uint32_t PackedID; |
| 27 | 24 |
| 28 GrAtlas* fAtlas; | 25 GrAtlas* fAtlas; |
| 29 SkPath* fPath; | 26 SkPath* fPath; |
| 30 PackedID fPackedID; | 27 PackedID fPackedID; |
| 31 GrIRect16 fBounds; | 28 GrIRect16 fBounds; |
| 32 GrIPoint16 fAtlasLocation; | 29 GrIPoint16 fAtlasLocation; |
| 33 | 30 |
| 34 void init(GrGlyph::PackedID packed, const GrIRect& bounds) { | 31 void init(GrGlyph::PackedID packed, const SkIRect& bounds) { |
| 35 fAtlas = NULL; | 32 fAtlas = NULL; |
| 36 fPath = NULL; | 33 fPath = NULL; |
| 37 fPackedID = packed; | 34 fPackedID = packed; |
| 38 fBounds.set(bounds); | 35 fBounds.set(bounds); |
| 39 fAtlasLocation.set(0, 0); | 36 fAtlasLocation.set(0, 0); |
| 40 } | 37 } |
| 41 | 38 |
| 42 void free() { | 39 void free() { |
| 43 if (fPath) { | 40 if (fPath) { |
| 44 delete fPath; | 41 delete fPath; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 72 return ((packed >> 16) & 3) << 14; | 69 return ((packed >> 16) & 3) << 14; |
| 73 } | 70 } |
| 74 | 71 |
| 75 static inline uint16_t UnpackID(PackedID packed) { | 72 static inline uint16_t UnpackID(PackedID packed) { |
| 76 return (uint16_t)packed; | 73 return (uint16_t)packed; |
| 77 } | 74 } |
| 78 }; | 75 }; |
| 79 | 76 |
| 80 | 77 |
| 81 #endif | 78 #endif |
| OLD | NEW |