Flutter Engine
The Flutter Engine
snapshot_delegate.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_LIB_UI_SNAPSHOT_DELEGATE_H_
6#define FLUTTER_LIB_UI_SNAPSHOT_DELEGATE_H_
7
8#include <string>
9
10#include "flutter/common/graphics/texture.h"
11#include "flutter/display_list/display_list.h"
16
17namespace flutter {
18
19class DlImage;
20
22 public:
23 //----------------------------------------------------------------------------
24 /// @brief A data structure used by the Skia implementation of deferred
25 /// GPU based images.
28#if !SLIMPELLER
29 const GrBackendTexture& p_texture,
30#endif // !SLIMPELLER
31 sk_sp<GrDirectContext> p_context,
32 sk_sp<SkImage> p_image = nullptr,
33 const std::string& p_error = "")
34 :
35#if !SLIMPELLER
36 texture(p_texture),
37#endif // !SLIMPELLER
38 context(std::move(p_context)),
39 image(std::move(p_image)),
40 error(p_error) {
41 }
42
43#if !SLIMPELLER
45#endif // !SLIMPELLER
46 // If texture.isValid() == true, this is a pointer to a GrDirectContext that
47 // can be used to create an image from the texture.
49 // If MakeGpuImage could not create a GPU resident image, a raster copy
50 // is available in this member and texture.isValid() is false.
52
53 // A non-empty string containing an error message if neither a GPU backed
54 // texture nor a raster backed image could be created.
55 const std::string error;
56 };
57
58 //----------------------------------------------------------------------------
59 /// @brief Attempts to create a GrBackendTexture for the specified
60 /// DisplayList. May result in a raster bitmap if no GPU context
61 /// is available.
62 virtual std::unique_ptr<GpuImageResult> MakeSkiaGpuImage(
63 sk_sp<DisplayList> display_list,
64 const SkImageInfo& image_info) = 0;
65
66 //----------------------------------------------------------------------------
67 /// @brief Gets the registry of external textures currently in use by the
68 /// rasterizer. These textures may be updated at a cadence
69 /// different from that of the Flutter application. When an
70 /// external texture is referenced in the Flutter layer tree, that
71 /// texture is composited within the Flutter layer tree.
72 ///
73 /// @return A pointer to the external texture registry.
74 ///
75 virtual std::shared_ptr<TextureRegistry> GetTextureRegistry() = 0;
76
78
79 virtual void MakeRasterSnapshot(
80 sk_sp<DisplayList> display_list,
81 SkISize picture_size,
83
85 SkISize picture_size) = 0;
86
88
89 /// Load and compile and initial PSO for the provided [runtime_stage].
90 ///
91 /// Impeller only.
92 virtual void CacheRuntimeStage(
93 const std::shared_ptr<impeller::RuntimeStage>& runtime_stage) = 0;
94};
95
96} // namespace flutter
97
98#endif // FLUTTER_LIB_UI_SNAPSHOT_DELEGATE_H_
virtual std::shared_ptr< TextureRegistry > GetTextureRegistry()=0
Gets the registry of external textures currently in use by the rasterizer. These textures may be upda...
virtual void MakeRasterSnapshot(sk_sp< DisplayList > display_list, SkISize picture_size, std::function< void(sk_sp< DlImage >)> callback)=0
virtual sk_sp< SkImage > ConvertToRasterImage(sk_sp< SkImage > image)=0
virtual GrDirectContext * GetGrContext()=0
virtual std::unique_ptr< GpuImageResult > MakeSkiaGpuImage(sk_sp< DisplayList > display_list, const SkImageInfo &image_info)=0
Attempts to create a GrBackendTexture for the specified DisplayList. May result in a raster bitmap if...
virtual sk_sp< DlImage > MakeRasterSnapshotSync(sk_sp< DisplayList > display_list, SkISize picture_size)=0
virtual void CacheRuntimeStage(const std::shared_ptr< impeller::RuntimeStage > &runtime_stage)=0
if(end==-1)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_NativeFunction function
Definition: fuchsia.cc:51
sk_sp< const SkImage > image
Definition: SkRecords.h:269
Definition: ref_ptr.h:256
flutter::DlImage DlImage
Definition: SkSize.h:16
A data structure used by the Skia implementation of deferred GPU based images.
GpuImageResult(const GrBackendTexture &p_texture, sk_sp< GrDirectContext > p_context, sk_sp< SkImage > p_image=nullptr, const std::string &p_error="")