Flutter Engine
 
Loading...
Searching...
No Matches
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< DlPath > flutter::ClipShapeLayer< DlRoundRect > flutter::ClipShapeLayer< DlRoundSuperellipse > flutter::ClipShapeLayer< DlRect > 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 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 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 113 of file layer.h.

Constructor & Destructor Documentation

◆ Layer()

flutter::Layer::Layer ( )

Definition at line 11 of file layer.cc.

11: unique_id_(NextUniqueID()), original_layer_id_(unique_id_) {}

◆ ~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 244 of file layer.h.

244{ return nullptr; }

Referenced by flutter::RasterCacheKeyID::LayerChildrenIds().

◆ as_display_list_layer()

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

Reimplemented in flutter::DisplayListLayer.

Definition at line 245 of file layer.h.

245 {
246 return nullptr;
247 }

Referenced by flutter::DisplayListLayer::Diff(), and flutter::DisplayListLayer::IsReplacing().

◆ as_mock_layer()

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

Reimplemented in flutter::testing::MockLayer.

Definition at line 252 of file layer.h.

252{ return nullptr; }

Referenced by flutter::testing::MockLayer::IsReplacing().

◆ as_performance_overlay_layer()

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

Reimplemented in flutter::PerformanceOverlayLayer.

Definition at line 249 of file layer.h.

249 {
250 return nullptr;
251 }

Referenced by flutter::PerformanceOverlayLayer::Diff(), and flutter::PerformanceOverlayLayer::IsReplacing().

◆ as_texture_layer()

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

Reimplemented in flutter::TextureLayer.

Definition at line 248 of file layer.h.

248{ return nullptr; }

Referenced by flutter::TextureLayer::Diff(), and flutter::TextureLayer::IsReplacing().

◆ AssignOldLayer()

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

Definition at line 132 of file layer.h.

132 {
133 original_layer_id_ = old_layer->original_layer_id_;
134 }

◆ caching_key_id()

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

Reimplemented in flutter::DisplayListLayer.

Definition at line 240 of file layer.h.

240 {
241 return RasterCacheKeyID(unique_id_, RasterCacheKeyType::kLayer);
242 }

References flutter::kLayer.

◆ Diff()

◆ is_empty()

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

Definition at line 214 of file layer.h.

214{ return paint_bounds_.IsEmpty(); }
constexpr bool IsEmpty() const
Returns true if either of the width or height are 0, negative, or NaN.
Definition rect.h:297

References impeller::TRect< T >::IsEmpty().

◆ 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 139 of file layer.h.

139 {
140 return original_layer_id_ == old_layer->original_layer_id_;
141 }

Referenced by flutter::ContainerLayer::DiffChildren().

◆ needs_painting()

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

Definition at line 218 of file layer.h.

218 {
219 if (subtree_has_platform_view_) {
220 // Workaround for the iOS embedder. The iOS embedder expects that
221 // if we preroll it, then we will later call its Paint() method.
222 // Now that we preroll all layers without any culling, we may
223 // call its Preroll() without calling its Paint(). For now, we
224 // will not perform paint culling on any subtree that has a
225 // platform view.
226 // See https://github.com/flutter/flutter/issues/81419
227 return true;
228 }
229 return !context.state_stack.painting_is_nop() &&
230 !context.state_stack.content_culled(paint_bounds_);
231 }

References flutter::LayerStateStack::content_culled(), flutter::LayerStateStack::painting_is_nop(), and flutter::PaintContext::state_stack.

Referenced by flutter::BackdropFilterLayer::Paint(), flutter::ClipShapeLayer< T >::Paint(), flutter::ColorFilterLayer::Paint(), flutter::ContainerLayer::Paint(), flutter::DisplayListLayer::Paint(), flutter::ImageFilterLayer::Paint(), flutter::OpacityLayer::Paint(), flutter::ShaderMaskLayer::Paint(), flutter::TextureLayer::Paint(), flutter::TransformLayer::Paint(), flutter::testing::MockLayer::Paint(), and flutter::Rasterize().

◆ original_layer_id()

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

Definition at line 235 of file layer.h.

235{ return original_layer_id_; }

◆ Paint()

◆ paint_bounds()

◆ PaintChildren()

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

Reimplemented in flutter::ContainerLayer.

Definition at line 185 of file layer.h.

185{ FML_DCHECK(false); }
#define FML_DCHECK(condition)
Definition logging.h:122

References FML_DCHECK.

Referenced by flutter::Rasterize().

◆ Preroll()

◆ PreservePaintRegion()

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

Reimplemented in flutter::ContainerLayer.

Definition at line 149 of file layer.h.

149 {
150 // retained layer means same instance so 'this' is used to index into both
151 // current and old region
152 context->SetLayerPaintRegion(this, context->GetOldLayerPaintRegion(this));
153 }

References flutter::DiffContext::GetOldLayerPaintRegion(), and flutter::DiffContext::SetLayerPaintRegion().

Referenced by flutter::ContainerLayer::PreservePaintRegion().

◆ set_paint_bounds()

◆ set_subtree_has_platform_view()

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

Definition at line 188 of file layer.h.

188 {
189 subtree_has_platform_view_ = value;
190 }
int32_t value

References value.

Referenced by flutter::PlatformViewLayer::Preroll(), and flutter::ContainerLayer::PrerollChildren().

◆ subtree_has_platform_view()

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

Definition at line 187 of file layer.h.

187{ return subtree_has_platform_view_; }

◆ unique_id()

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

Member Data Documentation

◆ kRasterCacheRenderFlags

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

Definition at line 126 of file layer.h.

◆ kSaveLayerRenderFlags


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