skia2/gm/bug615686.cpp
caryclark ba150cc283 always compute a cubic tangent
If the inflection of a cubic is also the cusp, the tangent
is degenerate at that t when computed directly. Rather than
giving up, subdivide the curve there and use the computed
control points to compute the tangent.

This strategy also removes the error paths where the tangent
formerly could not be computed.

R=reed@google.com
BUG=615686
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2020293002

Review-Url: https://codereview.chromium.org/2020293002
2016-06-01 04:42:02 -07:00

21 lines
451 B
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm.h"
#include "SkPath.h"
DEF_SIMPLE_GM(bug615686, canvas, 250, 250) {
SkPaint p;
p.setAntiAlias(true);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(20);
SkPath path;
path.moveTo(0, 0);
path.cubicTo(200, 200, 0, 200, 200, 0);
canvas->drawPath(path, p);
}