Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
embedder_render_target.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_RENDER_TARGET_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_RENDER_TARGET_H_
7
8#include <memory>
9#include "flutter/fml/closure.h"
10#include "flutter/fml/macros.h"
11#include "flutter/shell/platform/embedder/embedder.h"
14
15namespace impeller {
16class RenderTarget;
17class AiksContext;
18} // namespace impeller
19
20namespace flutter {
21
22//------------------------------------------------------------------------------
23/// @brief Describes a surface whose backing store is managed by the
24/// embedder. The type of surface depends on the client rendering
25/// API used. The embedder is notified of the collection of this
26/// render target via a callback.
27///
29 public:
30 //----------------------------------------------------------------------------
31 /// @brief Destroys this instance of the render target and invokes the
32 /// callback for the embedder to release its resource associated
33 /// with the particular backing store.
34 ///
35 virtual ~EmbedderRenderTarget();
36
37 //----------------------------------------------------------------------------
38 /// @brief A render surface the rasterizer can use to draw into the
39 /// backing store of this render target.
40 ///
41 /// @return The render surface.
42 ///
43 virtual sk_sp<SkSurface> GetSkiaSurface() const = 0;
44
45 //----------------------------------------------------------------------------
46 /// @brief An impeller render target the rasterizer can use to draw into
47 /// the backing store.
48 ///
49 /// @return The Impeller render target.
50 ///
52
53 //----------------------------------------------------------------------------
54 /// @brief Returns the AiksContext that should be used for rendering, if
55 /// this render target is backed by Impeller.
56 ///
57 /// @return The Impeller Aiks context.
58 ///
59 virtual std::shared_ptr<impeller::AiksContext> GetAiksContext() const = 0;
60
61 //----------------------------------------------------------------------------
62 /// @brief Returns the size of the render target.
63 ///
64 /// @return The size of the render target.
65 ///
66 virtual SkISize GetRenderTargetSize() const = 0;
67
68 //----------------------------------------------------------------------------
69 /// @brief The embedder backing store descriptor. This is the descriptor
70 /// that was given to the engine by the embedder. This descriptor
71 /// may contain context the embedder can use to associate it
72 /// resources with the compositor layers when they are given back
73 /// to it in present callback. The engine does not use this in any
74 /// way.
75 ///
76 /// @return The backing store.
77 ///
79
80 protected:
81 //----------------------------------------------------------------------------
82 /// @brief Creates a render target whose backing store is managed by the
83 /// embedder. The way this render target is exposed to the engine
84 /// is via an SkSurface and a callback that is invoked by this
85 /// object in its destructor.
86 ///
87 /// @param[in] backing_store The backing store describing this render
88 /// target.
89 /// @param[in] on_release The callback to invoke (eventually forwarded
90 /// to the embedder) when the backing store is no
91 /// longer required by the engine.
92 ///
94 fml::closure on_release);
95
96 private:
97 FlutterBackingStore backing_store_;
98
99 fml::closure on_release_;
100
102};
103
104} // namespace flutter
105
106#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_RENDER_TARGET_H_
Describes a surface whose backing store is managed by the embedder. The type of surface depends on th...
virtual impeller::RenderTarget * GetImpellerRenderTarget() const =0
An impeller render target the rasterizer can use to draw into the backing store.
virtual sk_sp< SkSurface > GetSkiaSurface() const =0
A render surface the rasterizer can use to draw into the backing store of this render target.
virtual std::shared_ptr< impeller::AiksContext > GetAiksContext() const =0
Returns the AiksContext that should be used for rendering, if this render target is backed by Impelle...
virtual ~EmbedderRenderTarget()
Destroys this instance of the render target and invokes the callback for the embedder to release its ...
const FlutterBackingStore * GetBackingStore() const
The embedder backing store descriptor. This is the descriptor that was given to the engine by the emb...
virtual SkISize GetRenderTargetSize() const =0
Returns the size of the render target.
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
std::function< void()> closure
Definition closure.h:14