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

Unified 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: correct comment to multiply by two 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkGlyphCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGlyph.h
diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h
index 92f974bc2cf456f8ed367c5f8d0c676baa8a2f26..f9b94a0268f9c9de869f04d09a9cba370c3e42d3 100644
--- a/src/core/SkGlyph.h
+++ b/src/core/SkGlyph.h
@@ -34,12 +34,28 @@ class SkGlyph {
kSubShiftY = 0
};
- public:
+ // Support horizontal and vertical skipping strike-through / underlines.
+ // The caller walks the linked list looking for a match. For a horizontal underline,
+ // the fBounds contains the top and bottom of the underline. The fInterval pair contains the
+ // beginning and end of of the intersection of the bounds and the glyph's path.
+ // If interval[0] >= interval[1], no intesection was found.
+ struct Intercept {
+ Intercept* fNext;
+ SkScalar fBounds[2]; // for horz underlines, the boundaries in Y
+ SkScalar fInterval[2]; // the outside intersections of the axis and the glyph
+ };
+
+ struct PathData {
+ Intercept* fIntercept;
+ SkPath* fPath;
+ };
+
+public:
static const SkFixed kSubpixelRound = SK_FixedHalf >> SkGlyph::kSubBits;
// A value that can never be generated by MakeID.
static const uint32_t kImpossibleID = ~0;
void* fImage;
- SkPath* fPath;
+ PathData* fPathData;
SkFixed fAdvanceX, fAdvanceY;
uint16_t fWidth, fHeight;
@@ -133,7 +149,7 @@ class SkGlyph {
void initCommon(uint32_t id) {
fID = id;
fImage = nullptr;
- fPath = nullptr;
+ fPathData = nullptr;
fMaskFormat = MASK_FORMAT_UNKNOWN;
fForceBW = 0;
}
@@ -176,7 +192,7 @@ class SkGlyph {
return ID;
}
- // FIXME - This is needed because the Android frame work directly
+ // FIXME - This is needed because the Android frame work directly
// accesses fID. Remove when fID accesses are cleaned up.
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
public:
« 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