Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
PathRefTest_Private Class Reference

Static Public Member Functions

static size_t GetFreeSpace (const SkPathRef &ref)
 
static void TestPathRef (skiatest::Reporter *reporter)
 

Detailed Description

Definition at line 4467 of file PathTest.cpp.

Member Function Documentation

◆ GetFreeSpace()

static size_t PathRefTest_Private::GetFreeSpace ( const SkPathRef ref)
inlinestatic

Definition at line 4469 of file PathTest.cpp.

4469 {
4470 return (ref.fPoints.capacity() - ref.fPoints.size()) * sizeof(SkPoint)
4471 + (ref.fVerbs.capacity() - ref.fVerbs.size()) * sizeof(uint8_t);
4472 }
int capacity() const
Definition: SkTArray.h:518
int size() const
Definition: SkTArray.h:421

◆ TestPathRef()

static void PathRefTest_Private::TestPathRef ( skiatest::Reporter reporter)
inlinestatic

Definition at line 4474 of file PathTest.cpp.

4474 {
4475 static const int kRepeatCnt = 10;
4476
4477 sk_sp<SkPathRef> pathRef(new SkPathRef);
4478
4479 SkPathRef::Editor ed(&pathRef);
4480
4481 {
4482 ed.growForRepeatedVerb(SkPath::kMove_Verb, kRepeatCnt);
4483 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs());
4484 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countPoints());
4485 REPORTER_ASSERT(reporter, 0 == pathRef->getSegmentMasks());
4486 for (int i = 0; i < kRepeatCnt; ++i) {
4487 REPORTER_ASSERT(reporter, SkPath::kMove_Verb == pathRef->atVerb(i));
4488 }
4489 ed.resetToSize(0, 0, 0);
4490 }
4491
4492 {
4493 ed.growForRepeatedVerb(SkPath::kLine_Verb, kRepeatCnt);
4494 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs());
4495 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countPoints());
4496 REPORTER_ASSERT(reporter, SkPath::kLine_SegmentMask == pathRef->getSegmentMasks());
4497 for (int i = 0; i < kRepeatCnt; ++i) {
4498 REPORTER_ASSERT(reporter, SkPath::kLine_Verb == pathRef->atVerb(i));
4499 }
4500 ed.resetToSize(0, 0, 0);
4501 }
4502
4503 {
4504 ed.growForRepeatedVerb(SkPath::kQuad_Verb, kRepeatCnt);
4505 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs());
4506 REPORTER_ASSERT(reporter, 2*kRepeatCnt == pathRef->countPoints());
4507 REPORTER_ASSERT(reporter, SkPath::kQuad_SegmentMask == pathRef->getSegmentMasks());
4508 for (int i = 0; i < kRepeatCnt; ++i) {
4509 REPORTER_ASSERT(reporter, SkPath::kQuad_Verb == pathRef->atVerb(i));
4510 }
4511 ed.resetToSize(0, 0, 0);
4512 }
4513
4514 {
4515 SkScalar* weights = nullptr;
4516 ed.growForRepeatedVerb(SkPath::kConic_Verb, kRepeatCnt, &weights);
4517 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs());
4518 REPORTER_ASSERT(reporter, 2*kRepeatCnt == pathRef->countPoints());
4519 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countWeights());
4520 REPORTER_ASSERT(reporter, SkPath::kConic_SegmentMask == pathRef->getSegmentMasks());
4521 REPORTER_ASSERT(reporter, weights);
4522 for (int i = 0; i < kRepeatCnt; ++i) {
4523 REPORTER_ASSERT(reporter, SkPath::kConic_Verb == pathRef->atVerb(i));
4524 }
4525 ed.resetToSize(0, 0, 0);
4526 }
4527
4528 {
4529 ed.growForRepeatedVerb(SkPath::kCubic_Verb, kRepeatCnt);
4530 REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs());
4531 REPORTER_ASSERT(reporter, 3*kRepeatCnt == pathRef->countPoints());
4532 REPORTER_ASSERT(reporter, SkPath::kCubic_SegmentMask == pathRef->getSegmentMasks());
4533 for (int i = 0; i < kRepeatCnt; ++i) {
4534 REPORTER_ASSERT(reporter, SkPath::kCubic_Verb == pathRef->atVerb(i));
4535 }
4536 ed.resetToSize(0, 0, 0);
4537 }
4538 }
reporter
Definition: FontMgrTest.cpp:39
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
@ kLine_SegmentMask
Definition: SkPath.h:1445
@ kQuad_SegmentMask
Definition: SkPath.h:1446
@ kCubic_SegmentMask
Definition: SkPath.h:1448
@ kConic_SegmentMask
Definition: SkPath.h:1447
@ kMove_Verb
Definition: SkPath.h:1466
@ kConic_Verb
Definition: SkPath.h:1469
@ kCubic_Verb
Definition: SkPath.h:1470
@ kQuad_Verb
Definition: SkPath.h:1468
@ kLine_Verb
Definition: SkPath.h:1467
float SkScalar
Definition: extension.cpp:12

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