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 ()
 
bool needs_system_composite () const
 
void set_needs_system_composite (bool value)
 
const SkRect & paint_bounds () const
 
void set_paint_bounds (const SkRect &paint_bounds)
 
bool needs_painting () 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 37 of file platform_view_layer.cc.

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

37  {
38  if (context.view_embedder == nullptr) {
39 #if !defined(LEGACY_FUCHSIA_EMBEDDER)
40  FML_LOG(ERROR) << "Trying to embed a platform view but the PaintContext "
41  "does not support embedding";
42 #endif
43  return;
44  }
45  SkCanvas* canvas = context.view_embedder->CompositeEmbeddedView(view_id_);
46  context.leaf_nodes_canvas = canvas;
47 }
#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(), and flutter::PrerollContext::view_embedder.

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

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