Flutter Engine
 
Loading...
Searching...
No Matches
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
13#include "flutter/fml/macros.h"
14
15#include "third_party/skia/include/core/SkData.h"
16
17class GrDirectContext;
18
19namespace impeller {
20class AiksContext;
21} // namespace impeller
22
23namespace flutter {
24
25/// Abstract Base Class that represents where we will be rendering content.
26class Surface {
27 public:
28 /// A screenshot of the surface's raw data.
29 struct SurfaceData {
30 std::string pixel_format;
31 sk_sp<SkData> data;
32 };
33
35
36 virtual ~Surface();
37
38 virtual bool IsValid() = 0;
39
40 virtual std::unique_ptr<SurfaceFrame> AcquireFrame(const DlISize& size) = 0;
41
42 virtual DlMatrix GetRootTransformation() const = 0;
43
44 virtual GrDirectContext* GetContext() = 0;
45
46 virtual std::unique_ptr<GLContextResult> MakeRenderContextCurrent();
47
48 virtual bool ClearRenderContext();
49
50 virtual bool AllowsDrawingWhenGpuDisabled() const;
51
52 virtual bool EnableRasterCache() const;
53
54 virtual std::shared_ptr<impeller::AiksContext> GetAiksContext() const;
55
56 /// Capture the `SurfaceData` currently present in the surface.
57 ///
58 /// Not guaranteed to work on all setups and not intended to be used in
59 /// production. The data field will be null if it was unable to work.
60 virtual SurfaceData GetSurfaceData() const;
61
62 private:
64};
65
66} // namespace flutter
67
68#endif // FLUTTER_FLOW_SURFACE_H_
Abstract Base Class that represents where we will be rendering content.
Definition surface.h:26
virtual std::shared_ptr< impeller::AiksContext > GetAiksContext() const
Definition surface.cc:29
virtual std::unique_ptr< SurfaceFrame > AcquireFrame(const DlISize &size)=0
virtual bool AllowsDrawingWhenGpuDisabled() const
Definition surface.cc:21
virtual std::unique_ptr< GLContextResult > MakeRenderContextCurrent()
Definition surface.cc:13
virtual bool IsValid()=0
virtual bool ClearRenderContext()
Definition surface.cc:17
virtual ~Surface()
virtual GrDirectContext * GetContext()=0
virtual bool EnableRasterCache() const
Definition surface.cc:25
virtual DlMatrix GetRootTransformation() const =0
virtual SurfaceData GetSurfaceData() const
Definition surface.cc:33
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all 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
A screenshot of the surface's raw data.
Definition surface.h:29
A 4x4 matrix using column-major storage.
Definition matrix.h:37