Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SkRegion::Cliperator Class Reference

#include <SkRegion.h>

Public Member Functions

 Cliperator (const SkRegion &region, const SkIRect &clip)
 
bool done ()
 
void next ()
 
const SkIRectrect () const
 

Detailed Description

Returns the sequence of rectangles, sorted along y-axis, then x-axis, that make up SkRegion intersected with the specified clip rectangle.

Definition at line 520 of file SkRegion.h.

Constructor & Destructor Documentation

◆ Cliperator()

SkRegion::Cliperator::Cliperator ( const SkRegion region,
const SkIRect clip 
)

Sets SkRegion::Cliperator to return elements of SkIRect array in SkRegion within clip.

Parameters
regionSkRegion to iterate
clipbounds of iteration
Returns
SkRegion iterator

example: https://fiddle.skia.org/c/@Region_Cliperator_const_SkRegion_const_SkIRect

Definition at line 1427 of file SkRegion.cpp.

1428 : fIter(rgn), fClip(clip), fDone(true) {
1429 const SkIRect& r = fIter.rect();
1430
1431 while (!fIter.done()) {
1432 if (r.fTop >= clip.fBottom) {
1433 break;
1434 }
1435 if (fRect.intersect(clip, r)) {
1436 fDone = false;
1437 break;
1438 }
1439 fIter.next();
1440 }
1441}
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition SkPath.cpp:3824
const SkIRect & rect() const
Definition SkRegion.h:501
bool done() const
Definition SkRegion.h:488
bool intersect(const SkIRect &r)
Definition SkRect.h:513
int32_t fTop
smaller y-axis bounds
Definition SkRect.h:34

Member Function Documentation

◆ done()

bool SkRegion::Cliperator::done ( )
inline

Returns true if SkRegion::Cliperator is pointing to final SkIRect in SkRegion.

Returns
true if data parsing is complete

Definition at line 537 of file SkRegion.h.

537{ return fDone; }

◆ next()

void SkRegion::Cliperator::next ( )

Advances iterator to next SkIRect in SkRegion contained by clip.

example: https://fiddle.skia.org/c/@Region_Cliperator_next

Definition at line 1443 of file SkRegion.cpp.

1443 {
1444 if (fDone) {
1445 return;
1446 }
1447
1448 const SkIRect& r = fIter.rect();
1449
1450 fDone = true;
1451 fIter.next();
1452 while (!fIter.done()) {
1453 if (r.fTop >= fClip.fBottom) {
1454 break;
1455 }
1456 if (fRect.intersect(fClip, r)) {
1457 fDone = false;
1458 break;
1459 }
1460 fIter.next();
1461 }
1462}
int32_t fBottom
larger y-axis bounds
Definition SkRect.h:36

◆ rect()

const SkIRect & SkRegion::Cliperator::rect ( ) const
inline

Returns SkIRect element in SkRegion, intersected with clip passed to SkRegion::Cliperator constructor. Does not return predictable results if SkRegion is empty.

Returns
part of SkRegion inside clip as SkIRect

Definition at line 551 of file SkRegion.h.

551{ return fRect; }

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