blob: 4a6d42edbf42bbf5b610b160d269a699be1a7871 [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Mike Kleinc0bd9f92019-04-23 12:05:21 -05003#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04004// HASH=a2b255a7dac1926cc3a247d318d63c62
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(Path_IsQuadDegenerate, 256, 256, true, 0) {
Hal Canary87515122019-03-15 14:22:51 -04006void draw(SkCanvas* canvas) {
7 auto debugster = [](const SkPath& path, bool exact) -> void {
8 SkDebugf("quad (%1.8g,%1.8g), (%1.8g,%1.8g), (%1.8g,%1.8g) is %s" "degenerate, %s\n",
9 path.getPoint(0).fX, path.getPoint(0).fY, path.getPoint(1).fX,
10 path.getPoint(1).fY, path.getPoint(2).fX, path.getPoint(2).fY,
11 SkPath::IsQuadDegenerate(path.getPoint(0), path.getPoint(1), path.getPoint(2), exact) ?
12 "" : "not ", exact ? "exactly" : "nearly");
13 };
14 SkPath path, offset;
15 path.moveTo({100, 100});
16 path.quadTo({100.00001f, 100.00001f}, {100.00002f, 100.00002f});
17 offset.addPath(path, 1000, 1000);
18 for (bool exact : { false, true } ) {
19 debugster(path, exact);
20 debugster(offset, exact);
21 }
22}
23} // END FIDDLE