Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::PlatformViewLayer Class Reference

Represents a platform view layer, including all mutations. More...

#include <platform_view_layer.h>

Inheritance diagram for flutter::PlatformViewLayer:
flutter::Layer

Public Member Functions

 PlatformViewLayer (const SkPoint &offset, const SkSize &size, int64_t view_id)
 
void Preroll (PrerollContext *context) override
 
void Paint (PaintContext &context) const override
 
 PlatformViewLayer (const FlutterLayer *_Nonnull layer)
 
 PlatformViewLayer (FlutterPlatformViewIdentifier identifier, const std::vector< FlutterPlatformViewMutation > &mutations, FlutterPoint offset, FlutterSize size)
 
FlutterPlatformViewIdentifier identifier () const
 
const std::vector< FlutterPlatformViewMutation > & mutations () const
 
FlutterPoint offset () const
 
FlutterSize size () const
 
- 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
 

Additional Inherited Members

- Static Public Attributes inherited from flutter::Layer
static constexpr int kSaveLayerRenderFlags
 
static constexpr int kRasterCacheRenderFlags
 

Detailed Description

Represents a platform view layer, including all mutations.

Definition at line 15 of file platform_view_layer.h.

Constructor & Destructor Documentation

◆ PlatformViewLayer() [1/3]

flutter::PlatformViewLayer::PlatformViewLayer ( const SkPoint offset,
const SkSize size,
int64_t  view_id 
)

Definition at line 11 of file platform_view_layer.cc.

14 : offset_(offset), size_(size), view_id_(view_id) {}
FlutterPoint offset() const

◆ PlatformViewLayer() [2/3]

flutter::PlatformViewLayer::PlatformViewLayer ( const FlutterLayer *_Nonnull  layer)
explicit

Creates platform view from provided FlutterLayer, which must be of type kFlutterLayerContentTypePlatformView.

◆ PlatformViewLayer() [3/3]

flutter::PlatformViewLayer::PlatformViewLayer ( FlutterPlatformViewIdentifier  identifier,
const std::vector< FlutterPlatformViewMutation > &  mutations,
FlutterPoint  offset,
FlutterSize  size 
)

Definition at line 26 of file FlutterMutatorView.mm.

30 : identifier_(identifier), mutations_(mutations), offset_(offset), size_(size) {}
const std::vector< FlutterPlatformViewMutation > & mutations() const
FlutterPlatformViewIdentifier identifier() const

Member Function Documentation

◆ identifier()

FlutterPlatformViewIdentifier flutter::PlatformViewLayer::identifier ( ) const
inline

Definition at line 27 of file FlutterMutatorView.h.

27{ return identifier_; }

◆ mutations()

const std::vector< FlutterPlatformViewMutation > & flutter::PlatformViewLayer::mutations ( ) const
inline

Definition at line 28 of file FlutterMutatorView.h.

28{ return mutations_; }

◆ offset()

FlutterPoint flutter::PlatformViewLayer::offset ( ) const
inline

Definition at line 29 of file FlutterMutatorView.h.

29{ return offset_; }

◆ Paint()

void flutter::PlatformViewLayer::Paint ( PaintContext context) const
overridevirtual

Implements flutter::Layer.

Definition at line 37 of file platform_view_layer.cc.

37 {
38 if (context.view_embedder == nullptr) {
39 FML_DLOG(ERROR) << "Trying to embed a platform view but the PaintContext "
40 "does not support embedding";
41 return;
42 }
43 DlCanvas* canvas = context.view_embedder->CompositeEmbeddedView(view_id_);
44 context.canvas = canvas;
45 context.state_stack.set_delegate(canvas);
46 context.rendering_above_platform_view = true;
47}
#define FML_DLOG(severity)
Definition: logging.h:102
flutter::DlCanvas DlCanvas
#define ERROR(message)
Definition: elf_loader.cc:260

◆ Preroll()

void flutter::PlatformViewLayer::Preroll ( PrerollContext context)
overridevirtual

Implements flutter::Layer.

Definition at line 16 of file platform_view_layer.cc.

16 {
17 set_paint_bounds(SkRect::MakeXYWH(offset_.x(), offset_.y(), size_.width(),
18 size_.height()));
19
20 if (context->view_embedder == nullptr) {
21 FML_DLOG(ERROR) << "Trying to embed a platform view but the PrerollContext "
22 "does not support embedding";
23 return;
24 }
25 context->has_platform_view = true;
27 MutatorsStack mutators;
28 context->state_stack.fill(&mutators);
29 std::unique_ptr<EmbeddedViewParams> params =
30 std::make_unique<EmbeddedViewParams>(context->state_stack.transform_3x3(),
31 size_, mutators);
32 context->view_embedder->PrerollCompositeEmbeddedView(view_id_,
33 std::move(params));
34 context->view_embedder->PushVisitedPlatformView(view_id_);
35}
void set_subtree_has_platform_view(bool value)
Definition: layer.h:202
void set_paint_bounds(const SkRect &paint_bounds)
Definition: layer.h:223
const EmbeddedViewParams * params
constexpr float y() const
Definition: SkPoint_impl.h:187
constexpr float x() const
Definition: SkPoint_impl.h:181
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
SkScalar width() const
Definition: SkSize.h:76
SkScalar height() const
Definition: SkSize.h:77

◆ size()

FlutterSize flutter::PlatformViewLayer::size ( ) const
inline

Definition at line 30 of file FlutterMutatorView.h.

30{ return size_; }

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