Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 SkGlyph_DEFINED | 8 #ifndef SkGlyph_DEFINED |
| 9 #define SkGlyph_DEFINED | 9 #define SkGlyph_DEFINED |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 enum { | 27 enum { |
| 28 kSubBits = 2, | 28 kSubBits = 2, |
| 29 kSubMask = ((1 << kSubBits) - 1), | 29 kSubMask = ((1 << kSubBits) - 1), |
| 30 kSubShift = 24, // must be large enough for glyphs and unichars | 30 kSubShift = 24, // must be large enough for glyphs and unichars |
| 31 kCodeMask = ((1 << kSubShift) - 1), | 31 kCodeMask = ((1 << kSubShift) - 1), |
| 32 // relative offsets for X and Y subpixel bits | 32 // relative offsets for X and Y subpixel bits |
| 33 kSubShiftX = kSubBits, | 33 kSubShiftX = kSubBits, |
| 34 kSubShiftY = 0 | 34 kSubShiftY = 0 |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 public: | 37 public: |
| 38 // Support horizontal and vertical skipping strike-through / underlines. | |
| 39 // The caller walks the linked list looking for a match. For a horizontal un derline, | |
| 40 // the fBounds contains the top and bottom of the underline. The fInterval p air contains the | |
| 41 // beginning and end of of the intersection of the bounds and the glyph's pa th. | |
| 42 // If interval[0] >= interval[1], no intesection was found. | |
| 43 struct Intercept { | |
| 44 Intercept* fNext; | |
| 45 SkScalar fBounds[2]; // for horz underlines, the boundaries in Y | |
| 46 SkScalar fInterval[2]; // the outside intersections of the axis and the glyph | |
| 47 }; | |
| 48 | |
| 38 static const SkFixed kSubpixelRound = SK_FixedHalf >> SkGlyph::kSubBits; | 49 static const SkFixed kSubpixelRound = SK_FixedHalf >> SkGlyph::kSubBits; |
| 39 // A value that can never be generated by MakeID. | 50 // A value that can never be generated by MakeID. |
| 40 static const uint32_t kImpossibleID = ~0; | 51 static const uint32_t kImpossibleID = ~0; |
| 41 void* fImage; | 52 void* fImage; |
| 42 SkPath* fPath; | 53 SkPath* fPath; |
| 54 Intercept* fIntercept; | |
|
reed1
2016/02/05 18:56:59
Hmmm, we already have too much stored in Glyphs, s
caryclark
2016/02/05 19:43:36
I can imagine something that looks like
struct Gl
| |
| 43 SkFixed fAdvanceX, fAdvanceY; | 55 SkFixed fAdvanceX, fAdvanceY; |
| 44 | 56 |
| 45 uint16_t fWidth, fHeight; | 57 uint16_t fWidth, fHeight; |
| 46 int16_t fTop, fLeft; | 58 int16_t fTop, fLeft; |
| 47 | 59 |
| 48 uint8_t fMaskFormat; | 60 uint8_t fMaskFormat; |
| 49 int8_t fRsbDelta, fLsbDelta; // used by auto-kerning | 61 int8_t fRsbDelta, fLsbDelta; // used by auto-kerning |
| 50 int8_t fForceBW; | 62 int8_t fForceBW; |
| 51 | 63 |
| 52 void initWithGlyphID(uint32_t glyph_id) { | 64 void initWithGlyphID(uint32_t glyph_id) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 } | 138 } |
| 127 }; | 139 }; |
| 128 | 140 |
| 129 private: | 141 private: |
| 130 // TODO(herb) remove friend statement after SkGlyphCache cleanup. | 142 // TODO(herb) remove friend statement after SkGlyphCache cleanup. |
| 131 friend class SkGlyphCache; | 143 friend class SkGlyphCache; |
| 132 | 144 |
| 133 void initCommon(uint32_t id) { | 145 void initCommon(uint32_t id) { |
| 134 fID = id; | 146 fID = id; |
| 135 fImage = nullptr; | 147 fImage = nullptr; |
| 148 fIntercept = nullptr; | |
| 136 fPath = nullptr; | 149 fPath = nullptr; |
| 137 fMaskFormat = MASK_FORMAT_UNKNOWN; | 150 fMaskFormat = MASK_FORMAT_UNKNOWN; |
| 138 fForceBW = 0; | 151 fForceBW = 0; |
| 139 } | 152 } |
| 140 | 153 |
| 141 static unsigned ID2Code(uint32_t id) { | 154 static unsigned ID2Code(uint32_t id) { |
| 142 return id & kCodeMask; | 155 return id & kCodeMask; |
| 143 } | 156 } |
| 144 | 157 |
| 145 static unsigned ID2SubX(uint32_t id) { | 158 static unsigned ID2SubX(uint32_t id) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 // FIXME - This is needed because the Android frame work directly | 192 // FIXME - This is needed because the Android frame work directly |
| 180 // accesses fID. Remove when fID accesses are cleaned up. | 193 // accesses fID. Remove when fID accesses are cleaned up. |
| 181 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 194 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 182 public: | 195 public: |
| 183 #endif | 196 #endif |
| 184 uint32_t fID; | 197 uint32_t fID; |
| 185 }; | 198 }; |
| 186 SK_END_REQUIRE_DENSE | 199 SK_END_REQUIRE_DENSE |
| 187 | 200 |
| 188 #endif | 201 #endif |
| OLD | NEW |