From dccfa3568d6c901d09f785f549154bdbac05591e Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Tue, 17 Apr 2018 17:10:51 -0400 Subject: show sum of cubic errors Bug: skia: Change-Id: I7738c58af3a641daa386a3be2833c29dc2e17d4b Reviewed-on: https://skia-review.googlesource.com/121896 Reviewed-by: Mike Reed Commit-Queue: Mike Reed --- samplecode/SamplePath.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'samplecode') 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); } -- cgit v1.2.3