Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PathTest_Private Class Reference

Public Member Functions

 PathTest_Private (SkPath *path)
 
void setPt (int index, SkScalar x, SkScalar y)
 

Static Public Member Functions

static size_t GetFreeSpace (const SkPath &path)
 
static void TestPathTo (skiatest::Reporter *reporter)
 
static void TestPathrefListeners (skiatest::Reporter *reporter)
 

Public Attributes

SkPathfPath
 

Detailed Description

Definition at line 30 of file PathOpsOpTest.cpp.

Constructor & Destructor Documentation

◆ PathTest_Private()

PathTest_Private::PathTest_Private ( SkPath path)
inline

Definition at line 32 of file PathOpsOpTest.cpp.

33 : fPath(path) {}

Member Function Documentation

◆ GetFreeSpace()

static size_t PathTest_Private::GetFreeSpace ( const SkPath path)
inlinestatic

Definition at line 4558 of file PathTest.cpp.

4558 {
4559 return PathRefTest_Private::GetFreeSpace(*path.fPathRef);
4560 }
static size_t GetFreeSpace(const SkPathRef &ref)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57

◆ setPt()

void PathTest_Private::setPt ( int  index,
SkScalar  x,
SkScalar  y 
)
inline

Definition at line 35 of file PathOpsOpTest.cpp.

35 {
36 fPath->setPt(index, x, y);
37 }
double y
double x

◆ TestPathrefListeners()

static void PathTest_Private::TestPathrefListeners ( skiatest::Reporter reporter)
inlinestatic

Definition at line 4580 of file PathTest.cpp.

4580 {
4581 SkPath p;
4582
4583 bool changed = false;
4584 p.moveTo(0, 0);
4585
4586 // Check that listener is notified on moveTo().
4587
4588 SkPathPriv::AddGenIDChangeListener(p, sk_make_sp<ChangeListener>(&changed));
4589 REPORTER_ASSERT(reporter, !changed);
4590 p.moveTo(10, 0);
4591 REPORTER_ASSERT(reporter, changed);
4592
4593 // Check that listener is notified on lineTo().
4594 SkPathPriv::AddGenIDChangeListener(p, sk_make_sp<ChangeListener>(&changed));
4595 REPORTER_ASSERT(reporter, !changed);
4596 p.lineTo(20, 0);
4597 REPORTER_ASSERT(reporter, changed);
4598
4599 // Check that listener is notified on reset().
4600 SkPathPriv::AddGenIDChangeListener(p, sk_make_sp<ChangeListener>(&changed));
4601 REPORTER_ASSERT(reporter, !changed);
4602 p.reset();
4603 REPORTER_ASSERT(reporter, changed);
4604
4605 p.moveTo(0, 0);
4606
4607 // Check that listener is notified on rewind().
4608 SkPathPriv::AddGenIDChangeListener(p, sk_make_sp<ChangeListener>(&changed));
4609 REPORTER_ASSERT(reporter, !changed);
4610 p.rewind();
4611 REPORTER_ASSERT(reporter, changed);
4612
4613 // Check that listener is notified on transform().
4614 {
4615 SkPath q;
4616 q.moveTo(10, 10);
4617 SkPathPriv::AddGenIDChangeListener(q, sk_make_sp<ChangeListener>(&changed));
4618 REPORTER_ASSERT(reporter, !changed);
4620 matrix.setScale(2, 2);
4621 p.transform(matrix, &q);
4622 REPORTER_ASSERT(reporter, changed);
4623 }
4624
4625 // Check that listener is notified when pathref is deleted.
4626 {
4627 SkPath q;
4628 q.moveTo(10, 10);
4629 SkPathPriv::AddGenIDChangeListener(q, sk_make_sp<ChangeListener>(&changed));
4630 REPORTER_ASSERT(reporter, !changed);
4631 }
4632 // q went out of scope.
4633 REPORTER_ASSERT(reporter, changed);
4634 }
reporter
#define REPORTER_ASSERT(r, cond,...)
Definition Test.h:286
static void AddGenIDChangeListener(const SkPath &path, sk_sp< SkIDChangeListener > listener)
Definition SkPathPriv.h:105
SkPath & moveTo(SkScalar x, SkScalar y)
Definition SkPath.cpp:678
unsigned useCenter Optional< SkMatrix > matrix
Definition SkRecords.h:258

◆ TestPathTo()

static void PathTest_Private::TestPathTo ( skiatest::Reporter reporter)
inlinestatic

Definition at line 4562 of file PathTest.cpp.

4562 {
4563 SkPath p, q;
4564 p.lineTo(4, 4);
4565 p.reversePathTo(q);
4566 check_path_is_line(reporter, &p, 4, 4);
4567 q.moveTo(-4, -4);
4568 p.reversePathTo(q);
4569 check_path_is_line(reporter, &p, 4, 4);
4570 q.lineTo(7, 8);
4571 q.conicTo(8, 7, 6, 5, 0.5f);
4572 q.quadTo(6, 7, 8, 6);
4573 q.cubicTo(5, 6, 7, 8, 7, 5);
4574 q.close();
4575 p.reversePathTo(q);
4576 SkRect reverseExpected = {-4, -4, 8, 8};
4577 REPORTER_ASSERT(reporter, p.getBounds() == reverseExpected);
4578 }
static void check_path_is_line(skiatest::Reporter *reporter, SkPath *p, SkScalar x1, SkScalar y1)
SkPath & lineTo(SkScalar x, SkScalar y)
Definition SkPath.cpp:718
SkPath & quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
Definition SkPath.cpp:736
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
Definition SkPath.cpp:789
SkPath & conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
Definition SkPath.cpp:756
SkPath & close()
Definition SkPath.cpp:813

Member Data Documentation

◆ fPath

SkPath* PathTest_Private::fPath

Definition at line 39 of file PathOpsOpTest.cpp.


The documentation for this class was generated from the following files: