Flutter Engine
 
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
14
15namespace impeller {
16class AiksContext;
17}
18
19namespace flutter {
20
22 public:
23 class Delegate {
24 public:
25 virtual ~Delegate() = default;
26 virtual const std::unique_ptr<Surface>& GetSurface() const = 0;
27 virtual bool IsAiksContextInitialized() const = 0;
28 virtual std::shared_ptr<impeller::AiksContext> GetAiksContext() const = 0;
29 virtual const std::unique_ptr<SnapshotSurfaceProducer>&
31 virtual std::shared_ptr<const fml::SyncSwitch> GetIsGpuDisabledSyncSwitch()
32 const = 0;
33 };
34
35 static std::unique_ptr<SnapshotController> Make(const Delegate& delegate,
36 const Settings& settings);
37
38 virtual ~SnapshotController() = default;
39
40 virtual void MakeRasterSnapshot(
41 sk_sp<DisplayList> display_list,
42 DlISize picture_size,
43 std::function<void(const sk_sp<DlImage>&)> callback) = 0;
44
45 // Note that this image is not guaranteed to be UIThreadSafe and must
46 // be converted to a DlImageGPU if it is to be handed back to the UI
47 // thread.
48 virtual sk_sp<DlImage> MakeRasterSnapshotSync(sk_sp<DisplayList> display_list,
49 DlISize picture_size) = 0;
50
51 virtual sk_sp<SkImage> ConvertToRasterImage(sk_sp<SkImage> image) = 0;
52
53 virtual void CacheRuntimeStage(
54 const std::shared_ptr<impeller::RuntimeStage>& runtime_stage) = 0;
55
56 virtual bool MakeRenderContextCurrent() = 0;
57
58 protected:
59 explicit SnapshotController(const Delegate& delegate);
60 const Delegate& GetDelegate() { return delegate_; }
61
62 private:
63 const Delegate& delegate_;
64
66};
67
68} // namespace flutter
69
70#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)=0
virtual sk_sp< SkImage > ConvertToRasterImage(sk_sp< SkImage > image)=0
static std::unique_ptr< SnapshotController > Make(const Delegate &delegate, const Settings &settings)
virtual ~SnapshotController()=default
virtual sk_sp< DlImage > MakeRasterSnapshotSync(sk_sp< DisplayList > display_list, DlISize picture_size)=0
FlutterVulkanImage * image
FlutterDesktopBinaryReply callback
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27