Flutter Engine
 
Loading...
Searching...
No Matches
flutter::EmbedderRenderTargetSkia Class Referencefinal

#include <embedder_render_target_skia.h>

Inheritance diagram for flutter::EmbedderRenderTargetSkia:
flutter::EmbedderRenderTarget

Public Member Functions

 EmbedderRenderTargetSkia (FlutterBackingStore backing_store, sk_sp< SkSurface > render_surface, fml::closure on_release, MakeOrClearCurrentCallback on_make_current, MakeOrClearCurrentCallback on_clear_current)
 
 ~EmbedderRenderTargetSkia () override
 
sk_sp< SkSurface > GetSkiaSurface () const override
 A render surface the rasterizer can use to draw into the backing store of this render target.
 
impeller::RenderTargetGetImpellerRenderTarget () const override
 An impeller render target the rasterizer can use to draw into the backing store.
 
std::shared_ptr< impeller::AiksContextGetAiksContext () const override
 Returns the AiksContext that should be used for rendering, if this render target is backed by Impeller.
 
DlISize GetRenderTargetSize () const override
 Returns the size of the render target.
 
SetCurrentResult MaybeMakeCurrent () const override
 Make the render target current.
 
SetCurrentResult MaybeClearCurrent () const override
 Clear the current render target.
 
- Public Member Functions inherited from flutter::EmbedderRenderTarget
virtual ~EmbedderRenderTarget ()
 Destroys this instance of the render target and invokes the callback for the embedder to release its resource associated with the particular backing store.
 
const FlutterBackingStoreGetBackingStore () const
 The embedder backing store descriptor. This is the descriptor that was given to the engine by the embedder. This descriptor may contain context the embedder can use to associate it resources with the compositor layers when they are given back to it in present callback. The engine does not use this in any way.
 

Additional Inherited Members

- Public Types inherited from flutter::EmbedderRenderTarget
using MakeOrClearCurrentCallback = std::function< SetCurrentResult()>
 
- Protected Member Functions inherited from flutter::EmbedderRenderTarget
 EmbedderRenderTarget (FlutterBackingStore backing_store, fml::closure on_release)
 Creates a render target whose backing store is managed by the embedder. The way this render target is exposed to the engine is via an SkSurface and a callback that is invoked by this object in its destructor.
 

Detailed Description

Definition at line 12 of file embedder_render_target_skia.h.

Constructor & Destructor Documentation

◆ EmbedderRenderTargetSkia()

flutter::EmbedderRenderTargetSkia::EmbedderRenderTargetSkia ( FlutterBackingStore  backing_store,
sk_sp< SkSurface >  render_surface,
fml::closure  on_release,
MakeOrClearCurrentCallback  on_make_current,
MakeOrClearCurrentCallback  on_clear_current 
)

Definition at line 11 of file embedder_render_target_skia.cc.

17 : EmbedderRenderTarget(backing_store, std::move(on_release)),
18 render_surface_(std::move(render_surface)),
19 on_make_current_(std::move(on_make_current)),
20 on_clear_current_(std::move(on_clear_current)) {
21 FML_DCHECK(render_surface_);
22}
EmbedderRenderTarget(FlutterBackingStore backing_store, fml::closure on_release)
Creates a render target whose backing store is managed by the embedder. The way this render target is...
#define FML_DCHECK(condition)
Definition logging.h:122

References FML_DCHECK.

◆ ~EmbedderRenderTargetSkia()

flutter::EmbedderRenderTargetSkia::~EmbedderRenderTargetSkia ( )
overridedefault

Member Function Documentation

◆ GetAiksContext()

std::shared_ptr< impeller::AiksContext > flutter::EmbedderRenderTargetSkia::GetAiksContext ( ) const
overridevirtual

Returns the AiksContext that should be used for rendering, if this render target is backed by Impeller.

Returns
The Impeller Aiks context.

Implements flutter::EmbedderRenderTarget.

Definition at line 36 of file embedder_render_target_skia.cc.

36 {
37 return nullptr;
38}

◆ GetImpellerRenderTarget()

impeller::RenderTarget * flutter::EmbedderRenderTargetSkia::GetImpellerRenderTarget ( ) const
overridevirtual

An impeller render target the rasterizer can use to draw into the backing store.

Returns
The Impeller render target.

Implements flutter::EmbedderRenderTarget.

Definition at line 30 of file embedder_render_target_skia.cc.

31 {
32 return nullptr;
33}

◆ GetRenderTargetSize()

DlISize flutter::EmbedderRenderTargetSkia::GetRenderTargetSize ( ) const
overridevirtual

Returns the size of the render target.

Returns
The size of the render target.

Implements flutter::EmbedderRenderTarget.

Definition at line 40 of file embedder_render_target_skia.cc.

40 {
41 return DlISize(render_surface_->width(), render_surface_->height());
42}
impeller::ISize32 DlISize

◆ GetSkiaSurface()

sk_sp< SkSurface > flutter::EmbedderRenderTargetSkia::GetSkiaSurface ( ) const
overridevirtual

A render surface the rasterizer can use to draw into the backing store of this render target.

Returns
The render surface.

Implements flutter::EmbedderRenderTarget.

Definition at line 26 of file embedder_render_target_skia.cc.

26 {
27 return render_surface_;
28}

◆ MaybeClearCurrent()

EmbedderRenderTarget::SetCurrentResult flutter::EmbedderRenderTargetSkia::MaybeClearCurrent ( ) const
overridevirtual

Clear the current render target.

See also
MaybeMakeCurrent
Returns
The result of the operation.

Reimplemented from flutter::EmbedderRenderTarget.

Definition at line 54 of file embedder_render_target_skia.cc.

54 {
55 if (on_clear_current_ != nullptr) {
56 return on_clear_current_();
57 }
58
59 return {true, false};
60}

◆ MaybeMakeCurrent()

EmbedderRenderTarget::SetCurrentResult flutter::EmbedderRenderTargetSkia::MaybeMakeCurrent ( ) const
overridevirtual

Make the render target current.

        Sometimes render targets are actually (for example)
        EGL surfaces instead of framebuffers or textures.
        In that case, we can't fully wrap them as SkSurfaces, instead,
        the embedder will provide a callback that should be called
        when the target surface should be made current.
Returns
The result of the operation.

Reimplemented from flutter::EmbedderRenderTarget.

Definition at line 45 of file embedder_render_target_skia.cc.

45 {
46 if (on_make_current_ != nullptr) {
47 return on_make_current_();
48 }
49
50 return {true, false};
51}

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