Flutter Engine
The Flutter Engine
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
8#include "flutter/common/settings.h"
9#include "flutter/display_list/image/dl_image.h"
10#include "flutter/flow/surface.h"
11#include "flutter/fml/synchronization/sync_switch.h"
12#include "flutter/lib/ui/snapshot_delegate.h"
13#include "flutter/shell/common/snapshot_surface_producer.h"
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 std::shared_ptr<impeller::AiksContext> GetAiksContext() const = 0;
28 virtual const std::unique_ptr<SnapshotSurfaceProducer>&
30 virtual std::shared_ptr<const fml::SyncSwitch> GetIsGpuDisabledSyncSwitch()
31 const = 0;
32 };
33
34 static std::unique_ptr<SnapshotController> Make(const Delegate& delegate,
35 const Settings& settings);
36
37 virtual ~SnapshotController() = default;
38
39 virtual void MakeRasterSnapshot(
40 sk_sp<DisplayList> display_list,
41 SkISize picture_size,
42 std::function<void(const sk_sp<DlImage>&)> callback) = 0;
43
44 // Note that this image is not guaranteed to be UIThreadSafe and must
45 // be converted to a DlImageGPU if it is to be handed back to the UI
46 // thread.
48 SkISize picture_size) = 0;
49
51
52 virtual void CacheRuntimeStage(
53 const std::shared_ptr<impeller::RuntimeStage>& runtime_stage) = 0;
54
55 protected:
56 explicit SnapshotController(const Delegate& delegate);
57 const Delegate& GetDelegate() { return delegate_; }
58
59 private:
60 const Delegate& delegate_;
61
62 FML_DISALLOW_COPY_AND_ASSIGN(SnapshotController);
63};
64
65} // namespace flutter
66
67#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 void CacheRuntimeStage(const std::shared_ptr< impeller::RuntimeStage > &runtime_stage)=0
virtual void MakeRasterSnapshot(sk_sp< DisplayList > display_list, SkISize 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 sk_sp< DlImage > MakeRasterSnapshotSync(sk_sp< DisplayList > display_list, SkISize picture_size)=0
virtual ~SnapshotController()=default
SnapshotController(const Delegate &delegate)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_NativeFunction function
Definition: fuchsia.cc:51
sk_sp< const SkImage > image
Definition: SkRecords.h:269
Definition: SkSize.h:16