141 {
143
144
147};
148#undef DL_OP_TO_ENUM_VALUE
149
161};
162
163class DlOpReceiver;
164class DisplayListBuilder;
165
167 public:
170
172 SaveLayerOptions(
const SaveLayerOptions& options) : flags_(options.flags_) {}
174 : flags_(options->flags_) {}
175
178 options.fRendersWithAttributes = fRendersWithAttributes;
179 options.fBoundsFromCaller = fBoundsFromCaller;
180 return options;
181 }
182
183 bool renders_with_attributes() const { return fRendersWithAttributes; }
186 options.fRendersWithAttributes = true;
187 return options;
188 }
189
190 bool can_distribute_opacity() const { return fCanDistributeOpacity; }
193 options.fCanDistributeOpacity = true;
194 return options;
195 }
196
197
198
199
200 bool bounds_from_caller() const { return fBoundsFromCaller; }
203 options.fBoundsFromCaller = true;
204 return options;
205 }
208 options.fBoundsFromCaller = false;
209 return options;
210 }
211 bool bounds_were_calculated() const { return !fBoundsFromCaller; }
212
213
214
215
216
217 bool content_is_clipped() const { return fContentIsClipped; }
220 options.fContentIsClipped = true;
221 return options;
222 }
223
224 bool contains_backdrop_filter() const { return fHasBackdropFilter; }
227 options.fHasBackdropFilter = true;
228 return options;
229 }
230
231 bool content_is_unbounded() const { return fContentIsUnbounded; }
234 options.fContentIsUnbounded = true;
235 return options;
236 }
237
239 flags_ = other.flags_;
240 return *this;
241 }
242 bool operator==(
const SaveLayerOptions& other)
const {
243 return flags_ == other.flags_;
244 }
245
246 private:
247 union {
248 struct {
249 unsigned fRendersWithAttributes : 1;
250 unsigned fCanDistributeOpacity : 1;
251 unsigned fBoundsFromCaller : 1;
252 unsigned fContentIsClipped : 1;
253 unsigned fHasBackdropFilter : 1;
254 unsigned fContentIsUnbounded : 1;
255 };
256 uint32_t flags_;
257 };
258};
259
261
262
263
264
266 public:
268
269 ~DisplayList();
270
271 void Dispatch(DlOpReceiver& ctx) const;
272 void Dispatch(DlOpReceiver& ctx, const DlRect& cull_rect) const;
273 void Dispatch(DlOpReceiver& ctx, const DlIRect& cull_rect) const;
274
275
276
277
278 size_t bytes(bool nested = true) const {
280 (nested ? nested_byte_count_ : 0);
281 }
282
283 uint32_t op_count(bool nested = false) const {
284 return op_count_ + (nested ? nested_op_count_ : 0);
285 }
286
287 uint32_t total_depth() const { return total_depth_; }
288
289 uint32_t unique_id() const { return unique_id_; }
290
291 const DlRect& GetBounds()
const {
return bounds_; }
292
293 bool has_rtree() const { return rtree_ != nullptr; }
294 sk_sp<const DlRTree> rtree() const { return rtree_; }
295
296 bool Equals(
const DisplayList* other)
const;
297 bool Equals(
const DisplayList& other)
const {
return Equals(&other); }
298 bool Equals(
const sk_sp<const DisplayList>& other)
const {
299 return Equals(other.get());
300 }
301
302 bool can_apply_group_opacity() const { return can_apply_group_opacity_; }
303 bool isUIThreadSafe() const { return is_ui_thread_safe_; }
304
305
306
307
308
309
310
311
312
313
314 bool modifies_transparent_black() const {
315 return modifies_transparent_black_;
316 }
317
318 const DisplayListStorage& GetStorage() const { return storage_; }
319
320
321
322
323
324
325
326
327 bool root_has_backdrop_filter() const { return root_has_backdrop_filter_; }
328
329
330
331
332
333
334
335
336
337
338
339 bool root_is_unbounded() const { return root_is_unbounded_; }
340
341
342
343
344
345
346
347
348 DlBlendMode max_root_blend_mode()
const {
return max_root_blend_mode_; }
349
350
351
352
353 class Iterator {
354 public:
356 bool operator!=(
const Iterator& other) {
return value_ != other.value_; }
357 Iterator& operator++() {
358 value_++;
359 return *this;
360 }
361
362 private:
363 explicit Iterator(DlIndex value) : value_(
value) {}
364
366
368 };
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386 DlIndex GetRecordCount()
const {
return offsets_.size(); }
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403 Iterator begin() const { return Iterator(0u); }
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420 Iterator
end()
const {
return Iterator(offsets_.size()); }
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444 bool Dispatch(DlOpReceiver& receiver, DlIndex index) const;
445
446
447
448
449
450
451
452
453
454
456
457
458
459
460
461
462
463
464
465
467
468
469
470
471
472
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500 std::vector<DlIndex> GetCulledIndices(const DlRect& cull_rect) const;
501
502 private:
504 std::vector<size_t>&& offsets,
505 uint32_t op_count,
506 size_t nested_byte_count,
507 uint32_t nested_op_count,
508 uint32_t total_depth,
509 const DlRect& bounds,
510 bool can_apply_group_opacity,
511 bool is_ui_thread_safe,
512 bool modifies_transparent_black,
513 DlBlendMode max_root_blend_mode,
514 bool root_has_backdrop_filter,
515 bool root_is_unbounded,
516 sk_sp<const DlRTree> rtree);
517
518 static uint32_t next_unique_id();
519
520 static void DisposeOps(const DisplayListStorage& storage,
521 const std::vector<size_t>& offsets);
522
523 const DisplayListStorage storage_;
524 const std::vector<size_t> offsets_;
525
526 const uint32_t op_count_;
527 const size_t nested_byte_count_;
528 const uint32_t nested_op_count_;
529
530 const uint32_t total_depth_;
531
532 const uint32_t unique_id_;
534
535 const bool can_apply_group_opacity_;
536 const bool is_ui_thread_safe_;
537 const bool modifies_transparent_black_;
538 const bool root_has_backdrop_filter_;
539 const bool root_is_unbounded_;
541
542 const sk_sp<const DlRTree> rtree_;
543
544 void DispatchOneOp(DlOpReceiver& receiver, const uint8_t* ptr) const;
545
546 void RTreeResultsToIndexVector(std::vector<DlIndex>& indices,
547 const std::vector<int>& rtree_results) const;
548
549 friend class DisplayListBuilder;
550};
551
552}
553
554#endif
#define FOR_EACH_DISPLAY_LIST_OP(V)
#define DL_OP_TO_ENUM_VALUE(name)
bool operator==(const FlutterPoint &a, const FlutterPoint &b)
static constexpr char kTransform[]
bool Equals(const T *a, const U *b)
impeller::BlendMode DlBlendMode
bool operator!=(const T &value, const UniqueObject< T, Traits > &object)
constexpr Color operator*(T value, const Color &c)
flutter::DisplayList DisplayList
flutter::SaveLayerOptions SaveLayerOptions