Flutter Engine
The Flutter Engine
PathOpsCubicConicIntersectionTest.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2015 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 */
15#include "tests/Test.h"
16
17#include <iterator>
18
19static struct cubicConic {
22} cubicConicTests[] = {
23#if 0
24// FIXME: this triggers an assert in bool SkTSect::extractCoincident() at
25// SkOPASSERT(oppStartT < oppEndT);
26// Throwing an error here breaks one test, but only in release.
27// More work to be done to figure this out.
28 {{{{2.1883804947719909e-05, 3.6366123822517693e-05 },
29 {2.9145950975362211e-05, 2.9117207304807380e-05 },
30 {2.9113532946212217e-05, 2.9173743314458989e-05 },
31 {0.00000000000000000, 5.8282588724978268e-05 }}},
32 {{{{0.00000000000000000, 5.8282581449020654e-05 },
33 {0.00000000000000000, 5.8282563259126619e-05 },
34 {5.8282588724978268e-05, 0.00000000000000000 }}}, 53684.6563f}},
35#endif
36
37 {{{{188.60000610351562, 2041.5999755859375}, {188.60000610351562, 2065.39990234375},
38 {208, 2084.800048828125}, {231.80000305175781, 2084.800048828125}}},
39 {{{{231.80000305175781, 2084.800048828125}, {188.60000610351562, 2084.800048828125},
40 {188.60000610351562, 2041.5999755859375}}}, 0.707107008f}},
41
42 {{{{231.80000305175781, 2084.800048828125}, {255.60000610351562, 2084.800048828125},
43 {275, 2065.39990234375}, {275, 2041.5999755859375}}},
44 {{{{275, 2041.5999755859375}, {275, 2084.800048828125},
45 {231.80000305175781, 2084.800048828125}}}, 0.707107008f}},
46};
47
49
51 const CubicPts& cu = cubicConicTests[index].cubic;
53 cubic.debugSet(cu.fPts);
55 const ConicPts& co = cubicConicTests[index].conic;
57 conic.debugSet(co.fPts.fPts, co.fWeight);
59 SkReduceOrder reduce1;
60 SkReduceOrder reduce2;
61 int order1 = reduce1.reduce(cubic, SkReduceOrder::kNo_Quadratics);
62 int order2 = reduce2.reduce(conic.fPts);
63 if (order1 != 4) {
64 SkDebugf("[%d] cubic order=%d\n", index, order1);
66 }
67 if (order2 != 3) {
68 SkDebugf("[%d] conic order=%d\n", index, order2);
70 }
72 int roots = i.intersect(cubic, conic);
73 for (int pt = 0; pt < roots; ++pt) {
74 double tt1 = i[0][pt];
75 SkDPoint xy1 = cubic.ptAtT(tt1);
76 double tt2 = i[1][pt];
77 SkDPoint xy2 = conic.ptAtT(tt2);
78 if (!xy1.approximatelyEqual(xy2)) {
79 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n",
80 __FUNCTION__, index, pt, tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY);
81 }
83 }
84 reporter->bumpTestCount();
85}
86
87DEF_TEST(PathOpsCubicConicIntersection, reporter) {
88 for (int index = 0; index < cubicConicTests_count; ++index) {
90 reporter->bumpTestCount();
91 }
92}
93
94DEF_TEST(PathOpsCubicConicIntersectionOneOff, reporter) {
96}
reporter
Definition: FontMgrTest.cpp:39
static const int cubicConicTests_count
static struct cubicConic cubicConicTests[]
DEF_TEST(PathOpsCubicConicIntersection, reporter)
static void cubicConicIntersection(skiatest::Reporter *reporter, int index)
bool ValidCubic(const SkDCubic &cubic)
bool ValidConic(const SkDConic &conic)
#define SkASSERT(cond)
Definition: SkAssert.h:116
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
AI float conic(float tolerance, const SkPoint pts[], float w, const VectorXform &vectorXform=VectorXform())
Definition: WangsFormula.h:287
AI float cubic(float precision, const SkPoint pts[], const VectorXform &vectorXform=VectorXform())
Definition: WangsFormula.h:195
SkScalar fWeight
QuadPts fPts
SkDPoint fPts[kPointCount]
SkDPoint fPts[kPointCount]
bool approximatelyEqual(const SkDPoint &a) const
int reduce(const SkDCubic &cubic, Quadratics)