Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::VectorCuller Class Referencefinal
Inheritance diagram for flutter::VectorCuller:
flutter::Culler

Public Member Functions

 VectorCuller (const DlRTree *rtree, const std::vector< int > &rect_indices)
 
 ~VectorCuller ()=default
 
bool init (DispatchContext &context) override
 
void update (DispatchContext &context) override
 
- Public Member Functions inherited from flutter::Culler
virtual ~Culler ()=default
 
virtual bool init (DispatchContext &context)=0
 
virtual void update (DispatchContext &context)=0
 

Detailed Description

Definition at line 97 of file display_list.cc.

Constructor & Destructor Documentation

◆ VectorCuller()

flutter::VectorCuller::VectorCuller ( const DlRTree rtree,
const std::vector< int > &  rect_indices 
)
inline

Definition at line 99 of file display_list.cc.

100 : rtree_(rtree), cur_(rect_indices.begin()), end_(rect_indices.end()) {}

◆ ~VectorCuller()

flutter::VectorCuller::~VectorCuller ( )
default

Member Function Documentation

◆ init()

bool flutter::VectorCuller::init ( DispatchContext context)
inlineoverridevirtual

Implements flutter::Culler.

Definition at line 104 of file display_list.cc.

104 {
105 if (cur_ < end_) {
106 context.next_render_index = rtree_->id(*cur_++);
107 return true;
108 } else {
109 // Setting next_render_index to MAX_INT means that
110 // all rendering ops will be "before" that index and
111 // they will skip themselves and all clip and transform
112 // ops will see that the next render index is not
113 // before the next restore index (even if both are MAX_INT)
114 // and so they will also not execute.
115 // None of this really matters because returning false
116 // here should cause the Dispatch operation to abort,
117 // but this value is conceptually correct if that short
118 // circuit optimization isn't used.
119 context.next_render_index = std::numeric_limits<int>::max();
120 return false;
121 }
122 }
int id(int result_index) const
Definition: dl_rtree.h:85
static float max(float r, float g, float b)
Definition: hsl.cpp:49

◆ update()

void flutter::VectorCuller::update ( DispatchContext context)
inlineoverridevirtual

Implements flutter::Culler.

Definition at line 123 of file display_list.cc.

123 {
124 if (++context.cur_index > context.next_render_index) {
125 while (cur_ < end_) {
126 context.next_render_index = rtree_->id(*cur_++);
127 if (context.next_render_index >= context.cur_index) {
128 // It should be rare that we have duplicate indices
129 // but if we do, then having a while loop is a cheap
130 // insurance for those cases.
131 // The main cause of duplicate indices is when a
132 // DrawDisplayListOp was added to this DisplayList and
133 // both are computing an R-Tree, in which case the
134 // builder method will forward all of the child
135 // DisplayList's rects to this R-Tree with the same
136 // op_index.
137 return;
138 }
139 }
140 context.next_render_index = std::numeric_limits<int>::max();
141 }
142 }

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