Flutter Engine
flutter::Layer Class Referenceabstract

#include <layer.h>

Inheritance diagram for flutter::Layer:
flutter::ContainerLayer flutter::DisplayListLayer flutter::PerformanceOverlayLayer flutter::PictureLayer flutter::PlatformViewLayer flutter::testing::MockLayer flutter::TextureLayer flutter::BackdropFilterLayer flutter::ClipPathLayer flutter::ClipRectLayer flutter::ClipRRectLayer flutter::ColorFilterLayer flutter::MergedContainerLayer flutter::PhysicalShapeLayer flutter::ShaderMaskLayer flutter::TransformLayer

Classes

class  AutoPrerollSaveLayerState
 
class  AutoSaveLayer
 
struct  PaintContext
 

Public Member Functions

 Layer ()
 
virtual ~Layer ()
 
void AssignOldLayer (Layer *old_layer)
 
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
 

Detailed Description

Definition at line 73 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

◆ AssignOldLayer()

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

Definition at line 78 of file layer.h.

78  {
79  original_layer_id_ = old_layer->original_layer_id_;
80  }

◆ is_empty()

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

Definition at line 245 of file layer.h.

245 { return paint_bounds_.isEmpty(); }

◆ needs_painting()

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

Definition at line 249 of file layer.h.

References flutter::Layer::PaintContext::leaf_nodes_canvas.

Referenced by flutter::ClipRectLayer::Paint(), flutter::ClipRRectLayer::Paint(), flutter::ClipPathLayer::Paint(), flutter::testing::MockLayer::Paint(), flutter::BackdropFilterLayer::Paint(), flutter::ImageFilterLayer::Paint(), flutter::ColorFilterLayer::Paint(), flutter::TransformLayer::Paint(), flutter::ShaderMaskLayer::Paint(), flutter::ContainerLayer::Paint(), flutter::TextureLayer::Paint(), flutter::PictureLayer::Paint(), flutter::OpacityLayer::Paint(), flutter::PhysicalShapeLayer::Paint(), flutter::DisplayListLayer::Paint(), and flutter::RasterCache::RasterizeLayer().

249  {
250  if (subtree_has_platform_view_) {
251  // Workaround for the iOS embedder. The iOS embedder expects that
252  // if we preroll it, then we will later call its Paint() method.
253  // Now that we preroll all layers without any culling, we may
254  // call its Preroll() without calling its Paint(). For now, we
255  // will not perform paint culling on any subtree that has a
256  // platform view.
257  // See https://github.com/flutter/flutter/issues/81419
258  return true;
259  }
260  // Workaround for Skia bug (quickReject does not reject empty bounds).
261  // https://bugs.chromium.org/p/skia/issues/detail?id=10951
262  if (paint_bounds_.isEmpty()) {
263  return false;
264  }
265  return !context.leaf_nodes_canvas->quickReject(paint_bounds_);
266  }

◆ original_layer_id()

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

Definition at line 270 of file layer.h.

270 { return original_layer_id_; }

◆ Paint()

◆ paint_bounds()

◆ Preroll()

◆ set_paint_bounds()

◆ set_subtree_has_platform_view()

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

Definition at line 219 of file layer.h.

References value.

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

219  {
220  subtree_has_platform_view_ = value;
221  }
uint8_t value

◆ subtree_has_platform_view()

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

Definition at line 218 of file layer.h.

218 { return subtree_has_platform_view_; }

◆ unique_id()

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

Definition at line 272 of file layer.h.

References FML_DISALLOW_COPY_AND_ASSIGN.

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

272 { return unique_id_; }

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