Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: src/core/SkGlyph.h

Issue 1654883003: add helper to create fancy underlines (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make bounds const Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkGlyphCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 };
herb_g 2016/02/05 21:09:37 Can this struct and fIntercept go in the private
caryclark 2016/02/05 21:25:59 Done.
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;
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
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
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
OLDNEW
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkGlyphCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698