Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::FrameDamage Class Reference

#include <compositor_context.h>

Public Member Functions

void SetPreviousLayerTree (const LayerTree *prev_layer_tree)
 
void AddAdditionalDamage (const SkIRect &damage)
 
void SetClipAlignment (int horizontal, int vertical)
 
std::optional< SkRectComputeClipRect (flutter::LayerTree &layer_tree, bool has_raster_cache, bool impeller_enabled)
 
std::optional< SkIRectGetFrameDamage () const
 
std::optional< SkIRectGetBufferDamage ()
 
void Reset ()
 

Detailed Description

Definition at line 51 of file compositor_context.h.

Member Function Documentation

◆ AddAdditionalDamage()

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

Definition at line 61 of file compositor_context.h.

61 {
62 additional_damage_.join(damage);
63 }
void join(const SkIRect &r)
Definition: SkRect.cpp:31

◆ ComputeClipRect()

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

Definition at line 14 of file compositor_context.cc.

17 {
18 if (layer_tree.root_layer()) {
19 PaintRegionMap empty_paint_region_map;
20 DiffContext context(layer_tree.frame_size(), layer_tree.paint_region_map(),
21 prev_layer_tree_ ? prev_layer_tree_->paint_region_map()
22 : empty_paint_region_map,
23 has_raster_cache, impeller_enabled);
24 context.PushCullRect(SkRect::MakeIWH(layer_tree.frame_size().width(),
25 layer_tree.frame_size().height()));
26 {
27 DiffContext::AutoSubtreeRestore subtree(&context);
28 const Layer* prev_root_layer = nullptr;
29 if (!prev_layer_tree_ ||
30 prev_layer_tree_->frame_size() != layer_tree.frame_size()) {
31 // If there is no previous layer tree assume the entire frame must be
32 // repainted.
33 context.MarkSubtreeDirty(SkRect::MakeIWH(
34 layer_tree.frame_size().width(), layer_tree.frame_size().height()));
35 } else {
36 prev_root_layer = prev_layer_tree_->root_layer();
37 }
38 layer_tree.root_layer()->Diff(&context, prev_root_layer);
39 }
40
41 damage_ =
42 context.ComputeDamage(additional_damage_, horizontal_clip_alignment_,
43 vertical_clip_alignment_);
44 return SkRect::Make(damage_->buffer_damage);
45 }
46 return std::nullopt;
47}
Layer * root_layer() const
Definition: layer_tree.h:53
const SkISize & frame_size() const
Definition: layer_tree.h:54
const PaintRegionMap & paint_region_map() const
Definition: layer_tree.h:56
virtual void Diff(DiffContext *context, const Layer *old_layer)
Definition: layer.h:158
std::map< uint64_t, PaintRegion > PaintRegionMap
Definition: diff_context.h:41
constexpr int32_t width() const
Definition: SkSize.h:36
constexpr int32_t height() const
Definition: SkSize.h:37
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669
static SkRect MakeIWH(int w, int h)
Definition: SkRect.h:623

◆ GetBufferDamage()

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

Definition at line 86 of file compositor_context.h.

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

◆ GetFrameDamage()

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

Definition at line 81 of file compositor_context.h.

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

◆ Reset()

void flutter::FrameDamage::Reset ( )
inline

Definition at line 96 of file compositor_context.h.

96{ ignore_damage_ = true; }

◆ SetClipAlignment()

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

Definition at line 66 of file compositor_context.h.

66 {
67 horizontal_clip_alignment_ = horizontal;
68 vertical_clip_alignment_ = vertical;
69 }

◆ SetPreviousLayerTree()

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

Definition at line 55 of file compositor_context.h.

55 {
56 prev_layer_tree_ = prev_layer_tree;
57 }

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