Flutter Engine
The Flutter Engine
PreChopPathCurvesTest.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
11#include "tests/Test.h"
12
13namespace skgpu::tess {
14
16 // These particular test cases can get stuck in infinite recursion due to limited fp32
17 // precision. (Although they will not with the provided tessellationPrecision values; we had to
18 // lower precision in order to avoid the "viewport size" assert in PreChopPathCurves.) Bump the
19 // tessellationPreciion up to 4 and run these tests in order to verify our bail condition for
20 // infinite recursion caused by bad fp32 precision. If the test completes, it passed.
21 SkPath p = SkPath().moveTo(11.171727877046647f, -11.78621173228717f)
22 .quadTo(11.171727877046647f, -11.78621173228717f,
23 8.33583747124031f, 77.27177002747368f)
24 .cubicTo(8.33583747124031f, 77.27177002747368f,
25 8.33583747124031f, 77.27177002747368f,
26 11.171727877046647f, -11.78621173228717f)
27 .conicTo(11.171727877046647f, -11.78621173228717f,
28 8.33583747124031f, 77.27177002747368f,
29 1e-6f)
30 .conicTo(8.33583747124031f, 77.27177002747368f,
31 11.171727877046647f, -11.78621173228717f,
32 1e6f);
33
34 SkMatrix m = SkMatrix::Scale(138.68622826903837f, 74192976757580.44189f);
35 PreChopPathCurves(1/16.f, p, m, {1000, -74088852800000.f, 3000, -74088852700000.f});
36
37 m = SkMatrix::Scale(138.68622826903837f, 74192976757580.44189f*.3f);
38 PreChopPathCurves(.25f, p, m, {1000, -22226658140000.f, 3000, -22226658130000.f});
39
40 m = SkMatrix::Scale(138.68622826903837f, 74192976757580.44189f/4);
41 PreChopPathCurves(.25f, p, m, {1000, -18522213200000.f, 3000, -18522213100000.f});
42}
43
44} // namespace skgpu::tess
reporter
Definition: FontMgrTest.cpp:39
static SkMatrix Scale(SkScalar sx, SkScalar sy)
Definition: SkMatrix.h:75
Definition: SkPath.h:59
SkPath & moveTo(SkScalar x, SkScalar y)
Definition: SkPath.cpp:688
SkPath & quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
Definition: SkPath.cpp:746
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
Definition: SkPath.cpp:799
SkPath & conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
Definition: SkPath.cpp:766
SkPath PreChopPathCurves(float tessellationPrecision, const SkPath &path, const SkMatrix &matrix, const SkRect &viewport)
DEF_TEST(CullTestTest, reporter)