Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | List of all members
skgpu::graphite::IntersectionTree Class Reference

#include <IntersectionTree.h>

Classes

class  LeafNode
 
class  TreeNode
 

Public Types

enum class  SplitType : bool { kX , kY }
 

Public Member Functions

 IntersectionTree ()
 
bool add (Rect rect)
 

Detailed Description

Maintains a collection of non-overlapping rectangles.

add() either adds the given rect to the collection, or returns false if it intersected with a rect already in the collection.

Definition at line 23 of file IntersectionTree.h.

Member Enumeration Documentation

◆ SplitType

Enumerator
kX 
kY 

Definition at line 25 of file IntersectionTree.h.

25 : bool {
26 kX,
27 kY
28 };
const auto kX

Constructor & Destructor Documentation

◆ IntersectionTree()

skgpu::graphite::IntersectionTree::IntersectionTree ( )

Definition at line 205 of file IntersectionTree.cpp.

206 : fRoot(fArena.make<LeafNode>()) {
207 static_assert(kTreeNodeSize == sizeof(TreeNode<SplitType::kX>));
208 static_assert(kTreeNodeSize == sizeof(TreeNode<SplitType::kY>));
209 static_assert(kLeafNodeSize == sizeof(LeafNode));
210}
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
Definition: SkArenaAlloc.h:120

Member Function Documentation

◆ add()

bool skgpu::graphite::IntersectionTree::add ( Rect  rect)
inline

Definition at line 32 of file IntersectionTree.h.

32 {
33 if (rect.isEmptyNegativeOrNaN()) {
34 // Empty and undefined rects can simply pass without modifying the tree.
35 return true;
36 }
37 if (!fRoot->intersects(rect)) {
38 fRoot = fRoot->addNonIntersecting(rect, &fArena);
39 return true;
40 }
41 return false;
42 }
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

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