Flutter Engine
 
Loading...
Searching...
No Matches
flutter::FrameDamage Class Reference

#include <compositor_context.h>

Public Member Functions

void SetPreviousLayerTree (const LayerTree *prev_layer_tree)
 
void AddAdditionalDamage (const DlIRect &damage)
 
void SetClipAlignment (int horizontal, int vertical)
 
std::optional< DlRectComputeClipRect (flutter::LayerTree &layer_tree, bool has_raster_cache, bool impeller_enabled)
 
std::optional< DlIRectGetFrameDamage () const
 
std::optional< DlIRectGetBufferDamage ()
 
void Reset ()
 

Detailed Description

Definition at line 49 of file compositor_context.h.

Member Function Documentation

◆ AddAdditionalDamage()

void flutter::FrameDamage::AddAdditionalDamage ( const DlIRect damage)
inline

Definition at line 59 of file compositor_context.h.

59 {
60 additional_damage_ = additional_damage_.Union(damage);
61 }
constexpr TRect Union(const TRect &o) const
Definition rect.h:513

References impeller::TRect< T >::Union().

◆ ComputeClipRect()

std::optional< DlRect > flutter::FrameDamage::ComputeClipRect ( flutter::LayerTree layer_tree,
bool  has_raster_cache,
bool  impeller_enabled 
)

Definition at line 13 of file compositor_context.cc.

16 {
17 if (layer_tree.root_layer()) {
18 PaintRegionMap empty_paint_region_map;
19 DiffContext context(layer_tree.frame_size(), layer_tree.paint_region_map(),
20 prev_layer_tree_ ? prev_layer_tree_->paint_region_map()
21 : empty_paint_region_map,
22 has_raster_cache, impeller_enabled);
23 context.PushCullRect(DlRect::MakeSize(layer_tree.frame_size()));
24 {
25 DiffContext::AutoSubtreeRestore subtree(&context);
26 const Layer* prev_root_layer = nullptr;
27 if (!prev_layer_tree_ ||
28 prev_layer_tree_->frame_size() != layer_tree.frame_size()) {
29 // If there is no previous layer tree assume the entire frame must be
30 // repainted.
31 context.MarkSubtreeDirty(DlRect::MakeSize(layer_tree.frame_size()));
32 } else {
33 prev_root_layer = prev_layer_tree_->root_layer();
34 }
35 layer_tree.root_layer()->Diff(&context, prev_root_layer);
36 }
37
38 damage_ =
39 context.ComputeDamage(additional_damage_, horizontal_clip_alignment_,
40 vertical_clip_alignment_);
41 return DlRect::Make(damage_->buffer_damage);
42 }
43 return std::nullopt;
44}
virtual void Diff(DiffContext *context, const Layer *old_layer)
Definition layer.h:144
Layer * root_layer() const
Definition layer_tree.h:53
const PaintRegionMap & paint_region_map() const
Definition layer_tree.h:56
const DlISize & frame_size() const
Definition layer_tree.h:54
std::map< uint64_t, PaintRegion > PaintRegionMap
static constexpr std::enable_if_t< std::is_floating_point_v< FT >, TRect > Make(const TRect< U > &rect)
Definition rect.h:157
static constexpr TRect MakeSize(const TSize< U > &size)
Definition rect.h:150

References flutter::Layer::Diff(), flutter::LayerTree::frame_size(), impeller::TRect< Scalar >::Make(), impeller::TRect< Scalar >::MakeSize(), flutter::LayerTree::paint_region_map(), flutter::DiffContext::PushCullRect(), and flutter::LayerTree::root_layer().

Referenced by flutter::CompositorContext::ScopedFrame::Raster().

◆ GetBufferDamage()

std::optional< DlIRect > flutter::FrameDamage::GetBufferDamage ( )
inline

Definition at line 84 of file compositor_context.h.

84 {
85 return (damage_ && !ignore_damage_)
86 ? std::make_optional(damage_->buffer_damage)
87 : std::nullopt;
88 }
Definition ref_ptr.h:261

◆ GetFrameDamage()

std::optional< DlIRect > flutter::FrameDamage::GetFrameDamage ( ) const
inline

Definition at line 79 of file compositor_context.h.

79 {
80 return damage_ ? std::make_optional(damage_->frame_damage) : std::nullopt;
81 }

◆ Reset()

void flutter::FrameDamage::Reset ( )
inline

Definition at line 94 of file compositor_context.h.

94{ ignore_damage_ = true; }

Referenced by flutter::CompositorContext::ScopedFrame::Raster().

◆ SetClipAlignment()

void flutter::FrameDamage::SetClipAlignment ( int  horizontal,
int  vertical 
)
inline

Definition at line 64 of file compositor_context.h.

64 {
65 horizontal_clip_alignment_ = horizontal;
66 vertical_clip_alignment_ = vertical;
67 }

◆ SetPreviousLayerTree()

void flutter::FrameDamage::SetPreviousLayerTree ( const LayerTree prev_layer_tree)
inline

Definition at line 53 of file compositor_context.h.

53 {
54 prev_layer_tree_ = prev_layer_tree;
55 }

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