Flutter Engine
flutter::Layer Class Referenceabstract

#include <layer.h>

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

Classes

class  AutoCachePaint
 
class  AutoPrerollSaveLayerState
 
class  AutoSaveLayer
 
struct  PaintContext
 

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, const SkMatrix &matrix)
 
virtual void Paint (PaintContext &context) const =0
 
bool subtree_has_platform_view () const
 
void set_subtree_has_platform_view (bool value)
 
const SkRect & paint_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 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
 

Detailed Description

Definition at line 111 of file layer.h.

Constructor & Destructor Documentation

◆ Layer()

flutter::Layer::Layer ( )

Definition at line 12 of file layer.cc.

References id, and ~Layer().

13  : paint_bounds_(SkRect::MakeEmpty()),
14  unique_id_(NextUniqueID()),
15  original_layer_id_(unique_id_),
16  subtree_has_platform_view_(false) {}

◆ ~Layer()

flutter::Layer::~Layer ( )
virtualdefault

Referenced by Layer().

Member Function Documentation

◆ as_container_layer()

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

Reimplemented in flutter::ContainerLayer.

Definition at line 361 of file layer.h.

Referenced by flutter::RasterCache::Prepare(), and flutter::RasterCache::RasterizeLayer().

361 { return nullptr; }

◆ as_display_list_layer()

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

Reimplemented in flutter::DisplayListLayer.

Definition at line 362 of file layer.h.

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

362  {
363  return nullptr;
364  }

◆ as_mock_layer()

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

Reimplemented in flutter::testing::MockLayer.

Definition at line 369 of file layer.h.

References FML_DISALLOW_COPY_AND_ASSIGN.

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

369 { return nullptr; }

◆ as_performance_overlay_layer()

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

Reimplemented in flutter::PerformanceOverlayLayer.

Definition at line 366 of file layer.h.

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

366  {
367  return nullptr;
368  }

◆ as_texture_layer()

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

Reimplemented in flutter::TextureLayer.

Definition at line 365 of file layer.h.

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

365 { return nullptr; }

◆ AssignOldLayer()

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

Definition at line 116 of file layer.h.

116  {
117  original_layer_id_ = old_layer->original_layer_id_;
118  }

◆ Diff()

◆ is_empty()

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

Definition at line 329 of file layer.h.

329 { return paint_bounds_.isEmpty(); }

◆ IsReplacing()

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

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

Definition at line 123 of file layer.h.

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

123  {
124  return original_layer_id_ == old_layer->original_layer_id_;
125  }

◆ needs_painting()

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

Definition at line 333 of file layer.h.

References flutter::Layer::PaintContext::inherited_opacity, and flutter::Layer::PaintContext::leaf_nodes_canvas.

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

333  {
334  if (subtree_has_platform_view_) {
335  // Workaround for the iOS embedder. The iOS embedder expects that
336  // if we preroll it, then we will later call its Paint() method.
337  // Now that we preroll all layers without any culling, we may
338  // call its Preroll() without calling its Paint(). For now, we
339  // will not perform paint culling on any subtree that has a
340  // platform view.
341  // See https://github.com/flutter/flutter/issues/81419
342  return true;
343  }
344  if (context.inherited_opacity == 0) {
345  return false;
346  }
347  // Workaround for Skia bug (quickReject does not reject empty bounds).
348  // https://bugs.chromium.org/p/skia/issues/detail?id=10951
349  if (paint_bounds_.isEmpty()) {
350  return false;
351  }
352  return !context.leaf_nodes_canvas->quickReject(paint_bounds_);
353  }

◆ original_layer_id()

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

Definition at line 357 of file layer.h.

357 { return original_layer_id_; }

◆ Paint()

◆ paint_bounds()

◆ Preroll()

◆ PreservePaintRegion()

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

Reimplemented in flutter::ContainerLayer.

Definition at line 133 of file layer.h.

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

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

133  {
134  // retained layer means same instance so 'this' is used to index into both
135  // current and old region
136  context->SetLayerPaintRegion(this, context->GetOldLayerPaintRegion(this));
137  }

◆ set_paint_bounds()

◆ set_subtree_has_platform_view()

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

Definition at line 303 of file layer.h.

References value.

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

303  {
304  subtree_has_platform_view_ = value;
305  }
uint8_t value

◆ subtree_has_platform_view()

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

Definition at line 302 of file layer.h.

302 { return subtree_has_platform_view_; }

◆ unique_id()

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

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