aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkPathOpsQuad.h
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-02-09 13:25:45 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-09 13:25:45 -0800
commit0449bcfb2fa1dd33cb3a4c0c8b17960d17edf01a (patch)
tree8c9e8f7e7b02e5a337636a5f41e981ba4e363d59 /src/pathops/SkPathOpsQuad.h
parent3cb954245cecf262d740a83913681b9fe4b41555 (diff)
add helper to create fancy underlines
Add a couple of utility functions to SkPaint that return the bounds of glyphs between a pair of lines. The common use case envisioned generates the edges of descenders between the top and bottom bounds of an underline to allow computing a stroke that skips those descenders. The implementation stores a linked list in each glyph containing the bounds of the lines parallel to the advance and the outermost intersections within those bounds. When the glyph cache is constructed, the glyph path is intersected with the bounds and the extreme min and max values within the bounds is added to an intercept. Share the text to path iter to construct the data. Make a half-hearted attempt to support vertical text; while the vertical implementation is complete; surrounding code (e.g. paint align) has short-comings with vertical. R=fmalita@chromium.org, reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1654883003 Review URL: https://codereview.chromium.org/1654883003
Diffstat (limited to 'src/pathops/SkPathOpsQuad.h')
-rw-r--r--src/pathops/SkPathOpsQuad.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pathops/SkPathOpsQuad.h b/src/pathops/SkPathOpsQuad.h
index f20bf6faea..32cfe58ecf 100644
--- a/src/pathops/SkPathOpsQuad.h
+++ b/src/pathops/SkPathOpsQuad.h
@@ -62,6 +62,13 @@ struct SkDQuad {
SkDQuadPair chopAt(double t) const;
SkDVector dxdyAtT(double t) const;
static int FindExtrema(const double src[], double tValue[1]);
+
+ /**
+ * Return the number of valid roots (0 < root < 1) for this cubic intersecting the
+ * specified horizontal line.
+ */
+ int horizontalIntersect(double yIntercept, double roots[2]) const;
+
bool hullIntersects(const SkDQuad& , bool* isLinear) const;
bool hullIntersects(const SkDConic& , bool* isLinear) const;
bool hullIntersects(const SkDCubic& , bool* isLinear) const;
@@ -87,6 +94,12 @@ struct SkDQuad {
return quad.subDivide(a, c, t1, t2);
}
+ /**
+ * Return the number of valid roots (0 < root < 1) for this cubic intersecting the
+ * specified vertical line.
+ */
+ int verticalIntersect(double xIntercept, double roots[2]) const;
+
SkDCubic debugToCubic() const;
// utilities callable by the user from the debugger when the implementation code is linked in
void dump() const;