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

#include <backdrop_filter_layer.h>

Inheritance diagram for flutter::BackdropFilterLayer:
flutter::ContainerLayer flutter::Layer

Public Member Functions

 BackdropFilterLayer (std::shared_ptr< const DlImageFilter > filter, DlBlendMode blend_mode)
 
void Diff (DiffContext *context, const Layer *old_layer) override
 
void Preroll (PrerollContext *context) override
 
void Paint (PaintContext &context) const override
 
- Public Member Functions inherited from flutter::ContainerLayer
 ContainerLayer ()
 
void Diff (DiffContext *context, const Layer *old_layer) override
 
void PreservePaintRegion (DiffContext *context) override
 
virtual void Add (std::shared_ptr< Layer > layer)
 
void Preroll (PrerollContext *context) override
 
void Paint (PaintContext &context) const override
 
const std::vector< std::shared_ptr< Layer > > & layers () const
 
virtual void DiffChildren (DiffContext *context, const ContainerLayer *old_layer)
 
void PaintChildren (PaintContext &context) const override
 
const ContainerLayeras_container_layer () const override
 
const SkRectchild_paint_bounds () const
 
void set_child_paint_bounds (const SkRect &bounds)
 
int children_renderable_state_flags () const
 
void set_children_renderable_state_flags (int flags)
 
- Public Member Functions inherited from flutter::Layer
 Layer ()
 
virtual ~Layer ()
 
void AssignOldLayer (Layer *old_layer)
 
virtual bool IsReplacing (DiffContext *context, const Layer *old_layer) const
 
virtual void Diff (DiffContext *context, const Layer *old_layer)
 
virtual void PreservePaintRegion (DiffContext *context)
 
virtual void Preroll (PrerollContext *context)=0
 
virtual void Paint (PaintContext &context) const =0
 
virtual void PaintChildren (PaintContext &context) const
 
bool subtree_has_platform_view () const
 
void set_subtree_has_platform_view (bool value)
 
const SkRectpaint_bounds () const
 
void set_paint_bounds (const SkRect &paint_bounds)
 
bool is_empty () const
 
bool needs_painting (PaintContext &context) const
 
uint64_t original_layer_id () const
 
uint64_t unique_id () const
 
virtual RasterCacheKeyID caching_key_id () const
 
virtual const ContainerLayeras_container_layer () const
 
virtual const DisplayListLayeras_display_list_layer () const
 
virtual const TextureLayeras_texture_layer () const
 
virtual const PerformanceOverlayLayeras_performance_overlay_layer () const
 
virtual const testing::MockLayeras_mock_layer () const
 

Additional Inherited Members

- Static Public Attributes inherited from flutter::Layer
static constexpr int kSaveLayerRenderFlags
 
static constexpr int kRasterCacheRenderFlags
 
- Protected Member Functions inherited from flutter::ContainerLayer
void PrerollChildren (PrerollContext *context, SkRect *child_paint_bounds)
 

Detailed Description

Definition at line 13 of file backdrop_filter_layer.h.

Constructor & Destructor Documentation

◆ BackdropFilterLayer()

flutter::BackdropFilterLayer::BackdropFilterLayer ( std::shared_ptr< const DlImageFilter filter,
DlBlendMode  blend_mode 
)

Definition at line 9 of file backdrop_filter_layer.cc.

12 : filter_(std::move(filter)), blend_mode_(blend_mode) {}

Member Function Documentation

◆ Diff()

void flutter::BackdropFilterLayer::Diff ( DiffContext context,
const Layer old_layer 
)
overridevirtual

Reimplemented from flutter::Layer.

Definition at line 14 of file backdrop_filter_layer.cc.

14 {
15 DiffContext::AutoSubtreeRestore subtree(context);
16 auto* prev = static_cast<const BackdropFilterLayer*>(old_layer);
17 if (!context->IsSubtreeDirty()) {
19 if (NotEquals(filter_, prev->filter_)) {
20 context->MarkSubtreeDirty(context->GetOldLayerPaintRegion(old_layer));
21 }
22 }
23
24 // Backdrop filter paints everywhere in cull rect
25 auto paint_bounds = context->GetCullRect();
26 context->AddLayerBounds(paint_bounds);
27
28 if (filter_) {
29 paint_bounds = context->MapRect(paint_bounds);
30 auto filter_target_bounds = paint_bounds.roundOut();
31 SkIRect filter_input_bounds; // in screen coordinates
32 filter_->get_input_device_bounds(
33 filter_target_bounds, context->GetTransform3x3(), filter_input_bounds);
34 context->AddReadbackRegion(filter_target_bounds, filter_input_bounds);
35 }
36
37 DiffChildren(context, prev);
38
39 context->SetLayerPaintRegion(this, context->CurrentSubtreeRegion());
40}
static float prev(float f)
BackdropFilterLayer(std::shared_ptr< const DlImageFilter > filter, DlBlendMode blend_mode)
virtual void DiffChildren(DiffContext *context, const ContainerLayer *old_layer)
const SkRect & paint_bounds() const
Definition: layer.h:210
#define FML_DCHECK(condition)
Definition: logging.h:103
bool NotEquals(const T *a, const T *b)
Definition: dl_comparable.h:70
Definition: SkRect.h:32
void roundOut(SkIRect *dst) const
Definition: SkRect.h:1241

◆ Paint()

void flutter::BackdropFilterLayer::Paint ( PaintContext context) const
overridevirtual

Implements flutter::Layer.

Definition at line 56 of file backdrop_filter_layer.cc.

56 {
57 FML_DCHECK(needs_painting(context));
58
59 auto mutator = context.state_stack.save();
60 mutator.applyBackdropFilter(paint_bounds(), filter_, blend_mode_);
61
62 PaintChildren(context);
63}
void PaintChildren(PaintContext &context) const override
bool needs_painting(PaintContext &context) const
Definition: layer.h:232

◆ Preroll()

void flutter::BackdropFilterLayer::Preroll ( PrerollContext context)
overridevirtual

Implements flutter::Layer.

Definition at line 42 of file backdrop_filter_layer.cc.

42 {
43 Layer::AutoPrerollSaveLayerState save =
44 Layer::AutoPrerollSaveLayerState::Create(context, true, bool(filter_));
45 if (filter_ && context->view_embedder != nullptr) {
46 context->view_embedder->PushFilterToVisitedPlatformViews(
47 filter_, context->state_stack.device_cull_rect());
48 }
51 child_paint_bounds.join(context->state_stack.local_cull_rect());
53 context->renderable_state_flags = kSaveLayerRenderFlags;
54}
void PrerollChildren(PrerollContext *context, SkRect *child_paint_bounds)
const SkRect & child_paint_bounds() const
static AutoPrerollSaveLayerState Create(PrerollContext *preroll_context, bool save_layer_is_active=true, bool layer_itself_performs_readback=false)
Definition: layer.cc:40
static constexpr int kSaveLayerRenderFlags
Definition: layer.h:132
void set_paint_bounds(const SkRect &paint_bounds)
Definition: layer.h:223
static constexpr SkRect MakeEmpty()
Definition: SkRect.h:595
void join(const SkRect &r)
Definition: SkRect.cpp:126

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