Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
snapshot_controller.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_COMMON_SNAPSHOT_CONTROLLER_H_
6#define FLUTTER_SHELL_COMMON_SNAPSHOT_CONTROLLER_H_
7
15
16namespace impeller {
17class AiksContext;
18class Texture;
19class RuntimeStage;
20} // namespace impeller
21
22namespace flutter {
23
25 public:
26 class Delegate {
27 public:
28 virtual ~Delegate() = default;
29 virtual const std::unique_ptr<Surface>& GetSurface() const = 0;
30 virtual bool IsAiksContextInitialized() const = 0;
31 virtual std::shared_ptr<impeller::AiksContext> GetAiksContext() const = 0;
32 virtual const std::unique_ptr<SnapshotSurfaceProducer>&
34 virtual std::shared_ptr<const fml::SyncSwitch> GetIsGpuDisabledSyncSwitch()
35 const = 0;
36 };
37
38 static std::unique_ptr<SnapshotController> Make(const Delegate& delegate,
39 const Settings& settings);
40
41 virtual ~SnapshotController() = default;
42
43 virtual void MakeSkiaSnapshot(
44 sk_sp<DisplayList> display_list,
45 DlISize picture_size,
46 std::function<void(const sk_sp<SkImage>&)> callback,
47 SnapshotPixelFormat pixel_format) = 0;
48
49 virtual sk_sp<SkImage> MakeSkiaSnapshotSync(
50 sk_sp<DisplayList> display_list,
51 DlISize picture_size,
52 SnapshotPixelFormat pixel_format) = 0;
53
55 sk_sp<DisplayList> display_list,
56 DlISize picture_size,
57 std::function<void(const std::shared_ptr<impeller::Texture>&)> callback,
58 SnapshotPixelFormat pixel_format) = 0;
59
60 virtual std::shared_ptr<impeller::Texture> MakeImpellerSnapshotSync(
61 sk_sp<DisplayList> display_list,
62 DlISize picture_size,
63 SnapshotPixelFormat pixel_format) = 0;
64
65 /// Creates a texture-backed DlImage from the provided SkImage.
66 ///
67 /// This is primarily used by `decodeImageFromPixelsSync` to upload pixels
68 /// to the GPU synchronously.
69 virtual sk_sp<SkImage> MakeSkiaTextureImage(
70 sk_sp<SkImage> image,
71 SnapshotPixelFormat pixel_format) = 0;
72
73 virtual std::shared_ptr<impeller::Texture> MakeImpellerTextureImage(
74 sk_sp<SkImage> image,
75 SnapshotPixelFormat pixel_format) = 0;
76
77 virtual sk_sp<SkImage> ConvertToRasterImage(sk_sp<SkImage> image) = 0;
78
79 virtual void CacheRuntimeStage(
80 const std::shared_ptr<impeller::RuntimeStage>& runtime_stage) = 0;
81
82 virtual bool MakeRenderContextCurrent() = 0;
83
84 protected:
85 explicit SnapshotController(const Delegate& delegate);
86 const Delegate& GetDelegate() { return delegate_; }
87
88 private:
89 const Delegate& delegate_;
90
92};
93
94} // namespace flutter
95
96#endif // FLUTTER_SHELL_COMMON_SNAPSHOT_CONTROLLER_H_
virtual const std::unique_ptr< SnapshotSurfaceProducer > & GetSnapshotSurfaceProducer() const =0
virtual const std::unique_ptr< Surface > & GetSurface() const =0
virtual std::shared_ptr< const fml::SyncSwitch > GetIsGpuDisabledSyncSwitch() const =0
virtual std::shared_ptr< impeller::AiksContext > GetAiksContext() const =0
virtual bool IsAiksContextInitialized() const =0
virtual void MakeImpellerSnapshot(sk_sp< DisplayList > display_list, DlISize picture_size, std::function< void(const std::shared_ptr< impeller::Texture > &)> callback, SnapshotPixelFormat pixel_format)=0
virtual void CacheRuntimeStage(const std::shared_ptr< impeller::RuntimeStage > &runtime_stage)=0
virtual sk_sp< SkImage > MakeSkiaSnapshotSync(sk_sp< DisplayList > display_list, DlISize picture_size, SnapshotPixelFormat pixel_format)=0
virtual sk_sp< SkImage > MakeSkiaTextureImage(sk_sp< SkImage > image, SnapshotPixelFormat pixel_format)=0
virtual bool MakeRenderContextCurrent()=0
virtual sk_sp< SkImage > ConvertToRasterImage(sk_sp< SkImage > image)=0
static std::unique_ptr< SnapshotController > Make(const Delegate &delegate, const Settings &settings)
virtual std::shared_ptr< impeller::Texture > MakeImpellerSnapshotSync(sk_sp< DisplayList > display_list, DlISize picture_size, SnapshotPixelFormat pixel_format)=0
virtual std::shared_ptr< impeller::Texture > MakeImpellerTextureImage(sk_sp< SkImage > image, SnapshotPixelFormat pixel_format)=0
virtual ~SnapshotController()=default
virtual void MakeSkiaSnapshot(sk_sp< DisplayList > display_list, DlISize picture_size, std::function< void(const sk_sp< SkImage > &)> callback, SnapshotPixelFormat pixel_format)=0
FlutterVulkanImage * image
FlutterDesktopBinaryReply callback
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27