Flutter Engine
flutter::PlatformViewLayer Class Reference

#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, const SkMatrix &matrix) override
 
void Paint (PaintContext &context) const override
 
- Public Member Functions inherited from flutter::Layer
 Layer ()
 
virtual ~Layer ()
 
void AssignOldLayer (Layer *old_layer)
 
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 14 of file platform_view_layer.h.

Constructor & Destructor Documentation

◆ PlatformViewLayer()

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

Definition at line 9 of file platform_view_layer.cc.

12  : offset_(offset), size_(size), view_id_(view_id) {}
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13

Member Function Documentation

◆ Paint()

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

Implements flutter::Layer.

Definition at line 33 of file platform_view_layer.cc.

References flutter::ExternalViewEmbedder::CompositeEmbeddedView(), FML_LOG, flutter::Layer::PaintContext::leaf_nodes_canvas, and flutter::Layer::PaintContext::view_embedder.

33  {
34  if (context.view_embedder == nullptr) {
35  FML_LOG(ERROR) << "Trying to embed a platform view but the PaintContext "
36  "does not support embedding";
37  return;
38  }
39  SkCanvas* canvas = context.view_embedder->CompositeEmbeddedView(view_id_);
40  context.leaf_nodes_canvas = canvas;
41 }
#define FML_LOG(severity)
Definition: logging.h:65

◆ Preroll()

void flutter::PlatformViewLayer::Preroll ( PrerollContext context,
const SkMatrix &  matrix 
)
overridevirtual

Reimplemented from flutter::Layer.

Definition at line 14 of file platform_view_layer.cc.

References FML_LOG, flutter::PrerollContext::has_platform_view, flutter::PrerollContext::mutators_stack, flutter::ExternalViewEmbedder::PrerollCompositeEmbeddedView(), flutter::Layer::set_paint_bounds(), flutter::Layer::set_subtree_has_platform_view(), and flutter::PrerollContext::view_embedder.

15  {
16  set_paint_bounds(SkRect::MakeXYWH(offset_.x(), offset_.y(), size_.width(),
17  size_.height()));
18 
19  if (context->view_embedder == nullptr) {
20  FML_LOG(ERROR) << "Trying to embed a platform view but the PrerollContext "
21  "does not support embedding";
22  return;
23  }
24  context->has_platform_view = true;
26  std::unique_ptr<EmbeddedViewParams> params =
27  std::make_unique<EmbeddedViewParams>(matrix, size_,
28  context->mutators_stack);
29  context->view_embedder->PrerollCompositeEmbeddedView(view_id_,
30  std::move(params));
31 }
void set_subtree_has_platform_view(bool value)
Definition: layer.h:219
#define FML_LOG(severity)
Definition: logging.h:65
void set_paint_bounds(const SkRect &paint_bounds)
Definition: layer.h:240

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