Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Static Public Attributes | List of all members
flutter::Layer Class Referenceabstract

#include <layer.h>

Inheritance diagram for flutter::Layer:
flutter::ContainerLayer flutter::DisplayListLayer flutter::PerformanceOverlayLayer flutter::PlatformViewLayer flutter::TextureLayer flutter::testing::MockLayer flutter::BackdropFilterLayer flutter::CacheableContainerLayer flutter::TransformLayer flutter::testing::MockCacheableLayer flutter::ClipShapeLayer< SkPath > flutter::ClipShapeLayer< SkRRect > flutter::ClipShapeLayer< SkRect > flutter::ClipShapeLayer< T > flutter::ColorFilterLayer flutter::ImageFilterLayer flutter::OpacityLayer flutter::ShaderMaskLayer flutter::testing::MockCacheableContainerLayer

Classes

class  AutoPrerollSaveLayerState
 

Public Member Functions

 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
 

Static Public Attributes

static constexpr int kSaveLayerRenderFlags
 
static constexpr int kRasterCacheRenderFlags
 

Detailed Description

Definition at line 127 of file layer.h.

Constructor & Destructor Documentation

◆ Layer()

flutter::Layer::Layer ( )

Definition at line 11 of file layer.cc.

12 : paint_bounds_(SkRect::MakeEmpty()),
13 unique_id_(NextUniqueID()),
14 original_layer_id_(unique_id_) {}
static constexpr SkRect MakeEmpty()
Definition: SkRect.h:595

◆ ~Layer()

flutter::Layer::~Layer ( )
virtualdefault

Member Function Documentation

◆ as_container_layer()

virtual const ContainerLayer * flutter::Layer::as_container_layer ( ) const
inlinevirtual

Reimplemented in flutter::ContainerLayer.

Definition at line 258 of file layer.h.

258{ return nullptr; }

◆ as_display_list_layer()

virtual const DisplayListLayer * flutter::Layer::as_display_list_layer ( ) const
inlinevirtual

Reimplemented in flutter::DisplayListLayer.

Definition at line 259 of file layer.h.

259 {
260 return nullptr;
261 }

◆ as_mock_layer()

virtual const testing::MockLayer * flutter::Layer::as_mock_layer ( ) const
inlinevirtual

Reimplemented in flutter::testing::MockLayer.

Definition at line 266 of file layer.h.

266{ return nullptr; }

◆ as_performance_overlay_layer()

virtual const PerformanceOverlayLayer * flutter::Layer::as_performance_overlay_layer ( ) const
inlinevirtual

Reimplemented in flutter::PerformanceOverlayLayer.

Definition at line 263 of file layer.h.

263 {
264 return nullptr;
265 }

◆ as_texture_layer()

virtual const TextureLayer * flutter::Layer::as_texture_layer ( ) const
inlinevirtual

Reimplemented in flutter::TextureLayer.

Definition at line 262 of file layer.h.

262{ return nullptr; }

◆ AssignOldLayer()

void flutter::Layer::AssignOldLayer ( Layer old_layer)
inline

Definition at line 146 of file layer.h.

146 {
147 original_layer_id_ = old_layer->original_layer_id_;
148 }

◆ caching_key_id()

virtual RasterCacheKeyID flutter::Layer::caching_key_id ( ) const
inlinevirtual

Reimplemented in flutter::DisplayListLayer.

Definition at line 254 of file layer.h.

254 {
255 return RasterCacheKeyID(unique_id_, RasterCacheKeyType::kLayer);
256 }

◆ Diff()

virtual void flutter::Layer::Diff ( DiffContext context,
const Layer old_layer 
)
inlinevirtual

◆ is_empty()

bool flutter::Layer::is_empty ( ) const
inline

Definition at line 228 of file layer.h.

228{ return paint_bounds_.isEmpty(); }
bool isEmpty() const
Definition: SkRect.h:693

◆ IsReplacing()

virtual bool flutter::Layer::IsReplacing ( DiffContext context,
const Layer old_layer 
) const
inlinevirtual

Reimplemented in flutter::DisplayListLayer, flutter::PerformanceOverlayLayer, flutter::TextureLayer, and flutter::testing::MockLayer.

Definition at line 153 of file layer.h.

153 {
154 return original_layer_id_ == old_layer->original_layer_id_;
155 }

◆ needs_painting()

bool flutter::Layer::needs_painting ( PaintContext context) const
inline

Definition at line 232 of file layer.h.

232 {
233 if (subtree_has_platform_view_) {
234 // Workaround for the iOS embedder. The iOS embedder expects that
235 // if we preroll it, then we will later call its Paint() method.
236 // Now that we preroll all layers without any culling, we may
237 // call its Preroll() without calling its Paint(). For now, we
238 // will not perform paint culling on any subtree that has a
239 // platform view.
240 // See https://github.com/flutter/flutter/issues/81419
241 return true;
242 }
243 return !context.state_stack.painting_is_nop() &&
244 !context.state_stack.content_culled(paint_bounds_);
245 }

◆ original_layer_id()

uint64_t flutter::Layer::original_layer_id ( ) const
inline

Definition at line 249 of file layer.h.

249{ return original_layer_id_; }

◆ Paint()

virtual void flutter::Layer::Paint ( PaintContext context) const
pure virtual

◆ paint_bounds()

const SkRect & flutter::Layer::paint_bounds ( ) const
inline

Definition at line 210 of file layer.h.

210{ return paint_bounds_; }

◆ PaintChildren()

virtual void flutter::Layer::PaintChildren ( PaintContext context) const
inlinevirtual

Reimplemented in flutter::ContainerLayer.

Definition at line 199 of file layer.h.

199{ FML_DCHECK(false); }
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ Preroll()

virtual void flutter::Layer::Preroll ( PrerollContext context)
pure virtual

◆ PreservePaintRegion()

virtual void flutter::Layer::PreservePaintRegion ( DiffContext context)
inlinevirtual

Reimplemented in flutter::ContainerLayer.

Definition at line 163 of file layer.h.

163 {
164 // retained layer means same instance so 'this' is used to index into both
165 // current and old region
166 context->SetLayerPaintRegion(this, context->GetOldLayerPaintRegion(this));
167 }

◆ set_paint_bounds()

void flutter::Layer::set_paint_bounds ( const SkRect paint_bounds)
inline

Definition at line 223 of file layer.h.

223 {
224 paint_bounds_ = paint_bounds;
225 }
const SkRect & paint_bounds() const
Definition: layer.h:210

◆ set_subtree_has_platform_view()

void flutter::Layer::set_subtree_has_platform_view ( bool  value)
inline

Definition at line 202 of file layer.h.

202 {
203 subtree_has_platform_view_ = value;
204 }
uint8_t value

◆ subtree_has_platform_view()

bool flutter::Layer::subtree_has_platform_view ( ) const
inline

Definition at line 201 of file layer.h.

201{ return subtree_has_platform_view_; }

◆ unique_id()

uint64_t flutter::Layer::unique_id ( ) const
inline

Definition at line 251 of file layer.h.

251{ return unique_id_; }

Member Data Documentation

◆ kRasterCacheRenderFlags

constexpr int flutter::Layer::kRasterCacheRenderFlags
staticconstexpr
Initial value:

Definition at line 140 of file layer.h.

◆ kSaveLayerRenderFlags

constexpr int flutter::Layer::kSaveLayerRenderFlags
staticconstexpr

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