Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions | Variables
PathOpsThreeWayTest.cpp File Reference
#include "include/core/SkTypes.h"
#include "include/private/base/SkMalloc.h"
#include "include/private/base/SkTDArray.h"
#include "src/pathops/SkIntersections.h"
#include "src/pathops/SkPathOpsCubic.h"
#include "src/pathops/SkPathOpsLine.h"
#include "src/pathops/SkPathOpsPoint.h"
#include "tests/PathOpsTestCommon.h"
#include "tests/Test.h"
#include <array>

Go to the source code of this file.

Classes

struct  Curve
 
struct  TestSet
 

Functions

static void testSetTest (skiatest::Reporter *reporter, int index)
 
 DEF_TEST (PathOpsThreeWay, reporter)
 
 DEF_TEST (PathOpsThreeWayOneOff, reporter)
 

Variables

static const Curve testSet0 []
 
static const Curve testSet1 []
 
static const struct TestSet testSets []
 
static const int testSetsCount = (int) std::size(testSets)
 

Function Documentation

◆ DEF_TEST() [1/2]

DEF_TEST ( PathOpsThreeWay  ,
reporter   
)

Definition at line 81 of file PathOpsThreeWayTest.cpp.

81 {
82 for (int index = 0; index < testSetsCount; ++index) {
83 testSetTest(reporter, index);
84 reporter->bumpTestCount();
85 }
86}
reporter
static const int testSetsCount
static void testSetTest(skiatest::Reporter *reporter, int index)

◆ DEF_TEST() [2/2]

DEF_TEST ( PathOpsThreeWayOneOff  ,
reporter   
)

Definition at line 88 of file PathOpsThreeWayTest.cpp.

88 {
89 int index = 0;
90 testSetTest(reporter, index);
91}

◆ testSetTest()

static void testSetTest ( skiatest::Reporter reporter,
int  index 
)
static

Definition at line 49 of file PathOpsThreeWayTest.cpp.

49 {
50 const TestSet& testSet = testSets[index];
51 int testCount = testSet.testCount;
54 for (int outer = 0; outer < testCount - 1; ++outer) {
55 const Curve& oTest = testSet.tests[outer];
56 for (int inner = outer + 1; inner < testCount; ++inner) {
57 const Curve& iTest = testSet.tests[inner];
58 SkIntersections* i = combos.append();
59 sk_bzero(i, sizeof(SkIntersections));
60 SkDLine oLine = {{ oTest.curve.fPts[0], oTest.curve.fPts[1] }};
61 SkDLine iLine = {{ iTest.curve.fPts[0], iTest.curve.fPts[1] }};
62 SkDCubic iCurve, oCurve;
63 iCurve.debugSet(iTest.curve.fPts);
64 oCurve.debugSet(oTest.curve.fPts);
65 if (oTest.ptCount == 1 && iTest.ptCount == 1) {
66 i->intersect(oLine, iLine);
67 } else if (oTest.ptCount == 1 && iTest.ptCount == 4) {
68 i->intersect(iCurve, oLine);
69 } else if (oTest.ptCount == 4 && iTest.ptCount == 1) {
70 i->intersect(oCurve, iLine);
71 } else if (oTest.ptCount == 4 && iTest.ptCount == 4) {
72 i->intersect(oCurve, iCurve);
73 } else {
74 SkASSERT(0);
75 }
76// i->dump();
77 }
78 }
79}
static const size_t testCount
static const ConicPts testSet[]
static const struct TestSet testSets[]
#define SkASSERT(cond)
Definition SkAssert.h:116
static void sk_bzero(void *buffer, size_t size)
Definition SkMalloc.h:105
int intersect(const SkDLine &, const SkDLine &)
T * append()
Definition SkTDArray.h:191
SkDPoint fPts[kPointCount]
void debugSet(const SkDPoint *pts)

Variable Documentation

◆ testSet0

const Curve testSet0[]
static
Initial value:
= {
{4, {{{134,11414}, {131.990234,11414}, {130.32666,11415.4824}, {130.042755,11417.4131}}} },
{4, {{{130.042755,11417.4131}, {130.233124,11418.3193}, {131.037079,11419}, {132,11419}}} },
{4, {{{132,11419}, {130.895432,11419}, {130,11418.1045}, {130,11417}}} },
}

Definition at line 26 of file PathOpsThreeWayTest.cpp.

26 { // extracted from skpClip2
27 {4, {{{134,11414}, {131.990234,11414}, {130.32666,11415.4824}, {130.042755,11417.4131}}} },
28 {4, {{{130.042755,11417.4131}, {130.233124,11418.3193}, {131.037079,11419}, {132,11419}}} },
29 {4, {{{132,11419}, {130.895432,11419}, {130,11418.1045}, {130,11417}}} },
30};

◆ testSet1

const Curve testSet1[]
static
Initial value:
= {
{4, {{{3,4}, {1,5}, {4,3}, {6,4}}} },
{1, {{{6,4}, {3,4}}} },
{4, {{{3,4}, {4,6}, {4,3}, {5,1}}} },
{1, {{{5,1}, {3,4}}} },
}

Definition at line 32 of file PathOpsThreeWayTest.cpp.

32 { // extracted from cubicOp85i
33 {4, {{{3,4}, {1,5}, {4,3}, {6,4}}} },
34 {1, {{{6,4}, {3,4}}} },
35 {4, {{{3,4}, {4,6}, {4,3}, {5,1}}} },
36 {1, {{{5,1}, {3,4}}} },
37};

◆ testSets

const struct TestSet testSets[]
static
Initial value:
= {
{ testSet0, (int) std::size(testSet0) },
{ testSet1, (int) std::size(testSet1) },
}
static const Curve testSet1[]
static const Curve testSet0[]
Type::kYUV Type::kRGBA() int(0.7 *637)

◆ testSetsCount

const int testSetsCount = (int) std::size(testSets)
static

Definition at line 47 of file PathOpsThreeWayTest.cpp.