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;
18} // namespace impeller
19
20namespace flutter {
21
23 public:
24 class Delegate {
25 public:
26 virtual ~Delegate() = default;
27 virtual const std::unique_ptr<Surface>& GetSurface() const = 0;
28 virtual bool IsAiksContextInitialized() const = 0;
29 virtual std::shared_ptr<impeller::AiksContext> GetAiksContext() const = 0;
30 virtual const std::unique_ptr<SnapshotSurfaceProducer>&
32 virtual std::shared_ptr<const fml::SyncSwitch> GetIsGpuDisabledSyncSwitch()
33 const = 0;
34 };
35
36 static std::unique_ptr<SnapshotController> Make(const Delegate& delegate,
37 const Settings& settings);
38
39 virtual ~SnapshotController() = default;
40
41 virtual void MakeRasterSnapshot(
42 sk_sp<DisplayList> display_list,
43 DlISize picture_size,
44 std::function<void(const sk_sp<DlImage>&)> callback,
45 SnapshotPixelFormat pixel_format) = 0;
46
47 // Note that this image is not guaranteed to be UIThreadSafe and must
48 // be converted to a DlImageGPU if it is to be handed back to the UI
49 // thread.
50 virtual sk_sp<DlImage> MakeRasterSnapshotSync(
51 sk_sp<DisplayList> display_list,
52 DlISize picture_size,
53 SnapshotPixelFormat pixel_format) = 0;
54
55 /// Creates a texture-backed DlImage from the provided SkImage.
56 ///
57 /// This is primarily used by `decodeImageFromPixelsSync` to upload pixels
58 /// to the GPU synchronously.
59 virtual sk_sp<DlImage> MakeTextureImage(sk_sp<SkImage> image,
60 SnapshotPixelFormat pixel_format) = 0;
61
62 virtual sk_sp<SkImage> ConvertToRasterImage(sk_sp<SkImage> image) = 0;
63
64 virtual void CacheRuntimeStage(
65 const std::shared_ptr<impeller::RuntimeStage>& runtime_stage) = 0;
66
67 virtual bool MakeRenderContextCurrent() = 0;
68
69 protected:
70 explicit SnapshotController(const Delegate& delegate);
71 const Delegate& GetDelegate() { return delegate_; }
72
73 private:
74 const Delegate& delegate_;
75
77};
78
79} // namespace flutter
80
81#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 CacheRuntimeStage(const std::shared_ptr< impeller::RuntimeStage > &runtime_stage)=0
virtual bool MakeRenderContextCurrent()=0
virtual void MakeRasterSnapshot(sk_sp< DisplayList > display_list, DlISize picture_size, std::function< void(const sk_sp< DlImage > &)> callback, SnapshotPixelFormat pixel_format)=0
virtual sk_sp< SkImage > ConvertToRasterImage(sk_sp< SkImage > image)=0
static std::unique_ptr< SnapshotController > Make(const Delegate &delegate, const Settings &settings)
virtual sk_sp< DlImage > MakeTextureImage(sk_sp< SkImage > image, SnapshotPixelFormat pixel_format)=0
virtual sk_sp< DlImage > MakeRasterSnapshotSync(sk_sp< DisplayList > display_list, DlISize picture_size, SnapshotPixelFormat pixel_format)=0
virtual ~SnapshotController()=default
FlutterVulkanImage * image
FlutterDesktopBinaryReply callback
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27