Flutter Engine
The Flutter Engine
surface.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_FLOW_SURFACE_H_
6#define FLUTTER_FLOW_SURFACE_H_
7
8#include <memory>
9
10#include "flutter/common/graphics/gl_context_switch.h"
11#include "flutter/flow/embedded_views.h"
12#include "flutter/flow/surface_frame.h"
13#include "flutter/fml/macros.h"
14
15class GrDirectContext;
16
17namespace impeller {
18class AiksContext;
19} // namespace impeller
20
21namespace flutter {
22
23/// Abstract Base Class that represents where we will be rendering content.
24class Surface {
25 public:
26 /// A screenshot of the surface's raw data.
27 struct SurfaceData {
28 std::string pixel_format;
30 };
31
33
34 virtual ~Surface();
35
36 virtual bool IsValid() = 0;
37
38 virtual std::unique_ptr<SurfaceFrame> AcquireFrame(const SkISize& size) = 0;
39
40 virtual SkMatrix GetRootTransformation() const = 0;
41
43
44 virtual std::unique_ptr<GLContextResult> MakeRenderContextCurrent();
45
46 virtual bool ClearRenderContext();
47
48 virtual bool AllowsDrawingWhenGpuDisabled() const;
49
50 virtual bool EnableRasterCache() const;
51
52 virtual std::shared_ptr<impeller::AiksContext> GetAiksContext() const;
53
54 /// Capture the `SurfaceData` currently present in the surface.
55 ///
56 /// Not guaranteed to work on all setups and not intended to be used in
57 /// production. The data field will be null if it was unable to work.
58 virtual SurfaceData GetSurfaceData() const;
59
60 private:
61 FML_DISALLOW_COPY_AND_ASSIGN(Surface);
62};
63
64} // namespace flutter
65
66#endif // FLUTTER_FLOW_SURFACE_H_
Abstract Base Class that represents where we will be rendering content.
Definition: surface.h:24
virtual bool EnableRasterCache() const
Definition: surface.cc:25
virtual SkMatrix GetRootTransformation() const =0
virtual bool AllowsDrawingWhenGpuDisabled() const
Definition: surface.cc:21
virtual SurfaceData GetSurfaceData() const
Definition: surface.cc:33
virtual ~Surface()
virtual std::unique_ptr< SurfaceFrame > AcquireFrame(const SkISize &size)=0
virtual bool ClearRenderContext()
Definition: surface.cc:17
virtual std::shared_ptr< impeller::AiksContext > GetAiksContext() const
Definition: surface.cc:29
virtual bool IsValid()=0
virtual GrDirectContext * GetContext()=0
virtual std::unique_ptr< GLContextResult > MakeRenderContextCurrent()
Definition: surface.cc:13
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
Definition: SkSize.h:16
A screenshot of the surface's raw data.
Definition: surface.h:27
sk_sp< SkData > data
Definition: surface.h:29