Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Protected Member Functions | List of all members
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 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
 

Protected Member Functions

virtual const SkRectclip_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, SkRect *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:103
@ kNone
Definition: layer.h:53

◆ ~ClipShapeLayer()

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

Member Function Documentation

◆ ApplyClip()

template<class T >
virtual void flutter::ClipShapeLayer< T >::ApplyClip ( LayerStateStack::MutatorContext mutator) const
protectedpure virtual

◆ clip_behavior()

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

Definition at line 116 of file clip_shape_layer.h.

116{ return clip_behavior_; }

◆ clip_shape()

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

Definition at line 115 of file clip_shape_layer.h.

115{ return clip_shape_; }

◆ clip_shape_bounds()

template<class T >
virtual const SkRect & 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()) {
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 }
static float prev(float f)
virtual const SkRect & clip_shape_bounds() const =0
virtual void DiffChildren(DiffContext *context, const ContainerLayer *old_layer)

◆ Paint()

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

Implements flutter::Layer.

Definition at line 77 of file clip_shape_layer.h.

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

◆ 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.transform_3x3());
54#endif // !SLIMPELLER
55
56 Layer::AutoPrerollSaveLayerState save =
58
59 auto mutator = context->state_stack.save();
60 ApplyClip(mutator);
61
66 } else {
68 }
69
70 // If we use a SaveLayer then we can accept opacity on behalf
71 // of our children and apply it in the saveLayer.
72 if (uses_save_layer) {
73 context->renderable_state_flags = kSaveLayerRenderFlags;
74 }
75 }
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
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
Definition: switches.h:191
static constexpr SkRect MakeEmpty()
Definition: SkRect.h:595
bool intersect(const SkRect &r)
Definition: SkRect.cpp:114

◆ UsesSaveLayer()

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

Definition at line 106 of file clip_shape_layer.h.

106 {
107 return clip_behavior_ == Clip::kAntiAliasWithSaveLayer;
108 }
@ kAntiAliasWithSaveLayer
Definition: layer.h:53

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