Flutter Engine
 
Loading...
Searching...
No Matches
flutter::ClipShapeLayer< T > Class Template Referenceabstract

#include <clip_shape_layer.h>

Inheritance diagram for flutter::ClipShapeLayer< T >:
flutter::CacheableContainerLayer flutter::ContainerLayer flutter::Layer

Public Types

using ClipShape = T
 

Public Member Functions

 ClipShapeLayer (const ClipShape &clip_shape, Clip clip_behavior)
 
void Diff (DiffContext *context, const Layer *old_layer) override
 
void Preroll (PrerollContext *context) override
 
void Paint (PaintContext &context) const override
 
bool UsesSaveLayer () const
 
- Public Member Functions inherited from flutter::CacheableContainerLayer
 CacheableContainerLayer (int layer_cached_threshold=RasterCacheUtil::kMinimumRendersBeforeCachingFilterLayer, bool can_cache_children=false)
 
const LayerRasterCacheItemraster_cache_item () const
 
- 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 DlRectchild_paint_bounds () const
 
void set_child_paint_bounds (const DlRect &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
 
bool subtree_has_platform_view () const
 
void set_subtree_has_platform_view (bool value)
 
const DlRectpaint_bounds () const
 
void set_paint_bounds (const DlRect &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 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
 

Protected Member Functions

virtual const DlRect clip_shape_bounds () const =0
 
virtual void ApplyClip (LayerStateStack::MutatorContext &mutator) const =0
 
virtual ~ClipShapeLayer ()=default
 
const ClipShapeclip_shape () const
 
Clip clip_behavior () const
 
- Protected Member Functions inherited from flutter::ContainerLayer
void PrerollChildren (PrerollContext *context, DlRect *child_paint_bounds)
 

Additional Inherited Members

- Static Public Attributes inherited from flutter::Layer
static constexpr int kSaveLayerRenderFlags
 
static constexpr int kRasterCacheRenderFlags
 
- Protected Attributes inherited from flutter::CacheableContainerLayer
std::unique_ptr< LayerRasterCacheItemlayer_raster_cache_item_
 

Detailed Description

template<class T>
class flutter::ClipShapeLayer< T >

Definition at line 15 of file clip_shape_layer.h.

Member Typedef Documentation

◆ ClipShape

template<class T >
using flutter::ClipShapeLayer< T >::ClipShape = T

Definition at line 17 of file clip_shape_layer.h.

Constructor & Destructor Documentation

◆ ClipShapeLayer()

template<class T >
flutter::ClipShapeLayer< T >::ClipShapeLayer ( const ClipShape clip_shape,
Clip  clip_behavior 
)
inline

Definition at line 18 of file clip_shape_layer.h.

20 clip_shape_(clip_shape),
21 clip_behavior_(clip_behavior) {
23 }
CacheableContainerLayer(int layer_cached_threshold=RasterCacheUtil::kMinimumRendersBeforeCachingFilterLayer, bool can_cache_children=false)
const ClipShape & clip_shape() const
#define FML_DCHECK(condition)
Definition logging.h:122
@ kNone
Definition layer.h:43

References flutter::ClipShapeLayer< T >::clip_behavior(), FML_DCHECK, and flutter::kNone.

◆ ~ClipShapeLayer()

template<class T >
virtual flutter::ClipShapeLayer< T >::~ClipShapeLayer ( )
protectedvirtualdefault

Member Function Documentation

◆ ApplyClip()

◆ clip_behavior()

template<class T >
Clip flutter::ClipShapeLayer< T >::clip_behavior ( ) const
inlineprotected

Definition at line 113 of file clip_shape_layer.h.

113{ return clip_behavior_; }

Referenced by flutter::ClipShapeLayer< T >::ClipShapeLayer().

◆ clip_shape()

template<class T >
const ClipShape & flutter::ClipShapeLayer< T >::clip_shape ( ) const
inlineprotected

Definition at line 112 of file clip_shape_layer.h.

112{ return clip_shape_; }

◆ clip_shape_bounds()

template<class T >
virtual const DlRect flutter::ClipShapeLayer< T >::clip_shape_bounds ( ) const
protectedpure virtual

◆ Diff()

template<class T >
void flutter::ClipShapeLayer< T >::Diff ( DiffContext context,
const Layer old_layer 
)
inlineoverridevirtual

Reimplemented from flutter::Layer.

Definition at line 25 of file clip_shape_layer.h.

25 {
26 DiffContext::AutoSubtreeRestore subtree(context);
27 auto* prev = static_cast<const ClipShapeLayer<ClipShape>*>(old_layer);
28 if (!context->IsSubtreeDirty()) {
29 FML_DCHECK(prev);
30 if (clip_behavior_ != prev->clip_behavior_ ||
31 clip_shape_ != prev->clip_shape_) {
32 context->MarkSubtreeDirty(context->GetOldLayerPaintRegion(old_layer));
33 }
34 }
35 if (UsesSaveLayer() && context->has_raster_cache()) {
36 context->WillPaintWithIntegralTransform();
37 }
38 if (context->PushCullRect(clip_shape_bounds())) {
39 DiffChildren(context, prev);
40 }
41 context->SetLayerPaintRegion(this, context->CurrentSubtreeRegion());
42 }
virtual const DlRect clip_shape_bounds() const =0
virtual void DiffChildren(DiffContext *context, const ContainerLayer *old_layer)

References flutter::ClipShapeLayer< T >::clip_shape_bounds(), flutter::DiffContext::CurrentSubtreeRegion(), flutter::ContainerLayer::DiffChildren(), FML_DCHECK, flutter::DiffContext::GetOldLayerPaintRegion(), flutter::DiffContext::has_raster_cache(), flutter::DiffContext::IsSubtreeDirty(), flutter::DiffContext::MarkSubtreeDirty(), flutter::DiffContext::PushCullRect(), flutter::DiffContext::SetLayerPaintRegion(), flutter::ClipShapeLayer< T >::UsesSaveLayer(), and flutter::DiffContext::WillPaintWithIntegralTransform().

◆ Paint()

template<class T >
void flutter::ClipShapeLayer< T >::Paint ( PaintContext context) const
inlineoverridevirtual

Implements flutter::Layer.

Definition at line 74 of file clip_shape_layer.h.

74 {
75 FML_DCHECK(needs_painting(context));
76
77 auto mutator = context.state_stack.save();
78 ApplyClip(mutator);
79
80 if (!UsesSaveLayer()) {
81 PaintChildren(context);
82 return;
83 }
84
85#if !SLIMPELLER
86 if (context.raster_cache) {
87 mutator.integralTransform();
88 auto restore_apply = context.state_stack.applyState(
90
91 DlPaint paint;
92 if (layer_raster_cache_item_->Draw(context,
93 context.state_stack.fill(paint))) {
94 return;
95 }
96 }
97#endif // !SLIMPELLER
98
99 mutator.saveLayer(paint_bounds());
100 PaintChildren(context);
101 }
std::unique_ptr< LayerRasterCacheItem > layer_raster_cache_item_
virtual void ApplyClip(LayerStateStack::MutatorContext &mutator) const =0
void PaintChildren(PaintContext &context) const override
bool needs_painting(PaintContext &context) const
Definition layer.h:218
const DlRect & paint_bounds() const
Definition layer.h:196
static constexpr int kCallerCanApplyOpacity
flutter::DlPaint DlPaint

References flutter::ClipShapeLayer< T >::ApplyClip(), flutter::LayerStateStack::applyState(), flutter::LayerStateStack::fill(), FML_DCHECK, flutter::LayerStateStack::kCallerCanApplyOpacity, flutter::CacheableContainerLayer::layer_raster_cache_item_, flutter::Layer::needs_painting(), flutter::Layer::paint_bounds(), flutter::ContainerLayer::PaintChildren(), flutter::LayerStateStack::save(), flutter::PaintContext::state_stack, and flutter::ClipShapeLayer< T >::UsesSaveLayer().

◆ Preroll()

template<class T >
void flutter::ClipShapeLayer< T >::Preroll ( PrerollContext context)
inlineoverridevirtual

Implements flutter::Layer.

Definition at line 44 of file clip_shape_layer.h.

44 {
45 bool uses_save_layer = UsesSaveLayer();
46
47#if !SLIMPELLER
48 // We can use the raster_cache for children only when the use_save_layer is
49 // true so if use_save_layer is false we pass the layer_raster_item is
50 // nullptr which mean we don't do raster cache logic.
51 AutoCache cache =
52 AutoCache(uses_save_layer ? layer_raster_cache_item_.get() : nullptr,
53 context, context->state_stack.matrix());
54#endif // !SLIMPELLER
55
56 Layer::AutoPrerollSaveLayerState save =
58
59 auto mutator = context->state_stack.save();
60 ApplyClip(mutator);
61
66
67 // If we use a SaveLayer then we can accept opacity on behalf
68 // of our children and apply it in the saveLayer.
69 if (uses_save_layer) {
70 context->renderable_state_flags = kSaveLayerRenderFlags;
71 }
72 }
const DlRect & child_paint_bounds() const
void PrerollChildren(PrerollContext *context, DlRect *child_paint_bounds)
static AutoPrerollSaveLayerState Create(PrerollContext *preroll_context, bool save_layer_is_active=true, bool layer_itself_performs_readback=false)
Definition layer.cc:37
static constexpr int kSaveLayerRenderFlags
Definition layer.h:118
void set_paint_bounds(const DlRect &paint_bounds)
Definition layer.h:209
impeller::Rect DlRect
constexpr TRect IntersectionOrEmpty(const TRect &o) const
Definition rect.h:542

References flutter::ClipShapeLayer< T >::ApplyClip(), flutter::ContainerLayer::child_paint_bounds(), flutter::ClipShapeLayer< T >::clip_shape_bounds(), flutter::Layer::AutoPrerollSaveLayerState::Create(), impeller::TRect< T >::IntersectionOrEmpty(), flutter::Layer::kSaveLayerRenderFlags, flutter::CacheableContainerLayer::layer_raster_cache_item_, flutter::LayerStateStack::matrix(), flutter::ContainerLayer::PrerollChildren(), flutter::PrerollContext::renderable_state_flags, flutter::LayerStateStack::save(), flutter::Layer::set_paint_bounds(), flutter::PrerollContext::state_stack, and flutter::ClipShapeLayer< T >::UsesSaveLayer().

◆ UsesSaveLayer()

template<class T >
bool flutter::ClipShapeLayer< T >::UsesSaveLayer ( ) const
inline

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