diff options
author | Mike Reed <reed@google.com> | 2018-04-17 17:10:51 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-17 21:48:21 +0000 |
commit | dccfa3568d6c901d09f785f549154bdbac05591e (patch) | |
tree | 07ee786bab0c90a6031bf0d72dbb9ba137c06363 /samplecode | |
parent | c186e17a6b78e4897a9180f33b638d6b6cc6d959 (diff) |
show sum of cubic errors
Bug: skia:
Change-Id: I7738c58af3a641daa386a3be2833c29dc2e17d4b
Reviewed-on: https://skia-review.googlesource.com/121896
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SamplePath.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/samplecode/SamplePath.cpp b/samplecode/SamplePath.cpp index 61098d2cad..7480604ca5 100644 --- a/samplecode/SamplePath.cpp +++ b/samplecode/SamplePath.cpp @@ -669,6 +669,9 @@ protected: paint.setStyle(SkPaint::kStroke_Style); paint.setAntiAlias(true); + SkPaint paint2(paint); + paint2.setColor(0xFF008800); + paint.setColor(0xFF888888); canvas->drawLine(fPts[0], fPts[3], paint); canvas->drawLine(fQuad[0], fQuad[2], paint); @@ -683,15 +686,18 @@ protected: SkVector v0 = (fPts[0] - fPts[1] - fPts[1] + fPts[2]) * fScale; SkVector v1 = (fPts[1] - fPts[2] - fPts[2] + fPts[3]) * fScale; + SkVector v = (v0 + v1) * 0.5f; SkPoint anchor; SkScalar ts[2]; int n = find_max_deviation_cubic(fPts, ts); if (n > 0) { SkEvalCubicAt(fPts, ts[0], &anchor, nullptr, nullptr); + canvas->drawLine(anchor, anchor + v, paint2); canvas->drawLine(anchor, anchor + v0, paint); if (n == 2) { SkEvalCubicAt(fPts, ts[1], &anchor, nullptr, nullptr); + canvas->drawLine(anchor, anchor + v, paint2); } canvas->drawLine(anchor, anchor + v1, paint); } |