Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
display_list_deferred_image_gpu_impeller.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_PAINTING_DISPLAY_LIST_DEFERRED_IMAGE_GPU_IMPELLER_H_
6#define FLUTTER_LIB_UI_PAINTING_DISPLAY_LIST_DEFERRED_IMAGE_GPU_IMPELLER_H_
7
8#include <variant>
12#include "flutter/fml/macros.h"
19
20namespace flutter {
21
22namespace testing {
24} // namespace testing
25
27 public:
28 static sk_sp<DlDeferredImageGPUImpeller> Make(
29 std::unique_ptr<LayerTree> layer_tree,
31 fml::RefPtr<fml::TaskRunner> raster_task_runner);
32
33 static sk_sp<DlDeferredImageGPUImpeller> Make(
34 sk_sp<DisplayList> display_list,
35 const DlISize& size,
36 SnapshotPixelFormat pixel_format,
38 fml::RefPtr<fml::TaskRunner> raster_task_runner);
39
40 // |DlImage|
42
43 // |DlImageImpeller|
44 std::shared_ptr<impeller::Texture> GetImpellerTexture(
45 const std::shared_ptr<impeller::Context>& context) const override;
46
47 // |DlImage|
48 flutter::DlColorSpace GetColorSpace() const override;
49
50 // |DlImage|
51 bool isOpaque() const override;
52
53 // |DlImage|
54 bool isUIThreadSafe() const override;
55
56 // |DlImage|
57 DlISize GetSize() const override;
58
59 // |DlImage|
60 size_t GetApproximateByteSize() const override;
61
62 // |DlImage|
63 OwningContext owning_context() const override {
65 }
66
67 private:
68 FML_FRIEND_TEST(testing::DlDeferredImageGPUImpeller, TrashesDisplayList);
69
70 class ImageWrapper final : public std::enable_shared_from_this<ImageWrapper>,
71 public ContextListener {
72 public:
73 ~ImageWrapper();
74
75 static std::shared_ptr<ImageWrapper> Make(
76 sk_sp<DisplayList> display_list,
77 const DlISize& size,
78 SnapshotPixelFormat pixel_format,
80 fml::RefPtr<fml::TaskRunner> raster_task_runner);
81
82 static std::shared_ptr<ImageWrapper> Make(
83 std::unique_ptr<LayerTree> layer_tree,
85 fml::RefPtr<fml::TaskRunner> raster_task_runner);
86
87 std::shared_ptr<impeller::Texture> texture() const;
88
89 const DlISize size() const { return size_; }
90
91 std::optional<std::string> get_error();
92
93 private:
94 FML_FRIEND_TEST(testing::DlDeferredImageGPUImpeller, TrashesDisplayList);
95 DlISize size_;
96 SnapshotPixelFormat pixel_format_;
97 std::shared_ptr<impeller::Texture> texture_;
99 fml::RefPtr<fml::TaskRunner> raster_task_runner_;
100
101 mutable std::mutex error_mutex_;
102 std::optional<std::string> error_;
103
104 ImageWrapper(
105 const DlISize& size,
106 SnapshotPixelFormat pixel_format,
108 fml::RefPtr<fml::TaskRunner> raster_task_runner);
109
110 // If a layer tree is provided, it will be flattened into a display list
111 // during the raster thread task spawned by this method.
112 void SnapshotDisplayList(
113 std::variant<sk_sp<DisplayList>, std::unique_ptr<LayerTree>> content);
114
115 // |ContextListener|
116 void OnGrContextCreated() override;
117
118 // |ContextListener|
119 void OnGrContextDestroyed() override;
120
121 FML_DISALLOW_COPY_AND_ASSIGN(ImageWrapper);
122 };
123
124 const std::shared_ptr<ImageWrapper> wrapper_;
125
126 explicit DlDeferredImageGPUImpeller(std::shared_ptr<ImageWrapper> wrapper);
127
128 FML_DISALLOW_COPY_AND_ASSIGN(DlDeferredImageGPUImpeller);
129};
130
131} // namespace flutter
132
133#endif // FLUTTER_LIB_UI_PAINTING_DISPLAY_LIST_DEFERRED_IMAGE_GPU_IMPELLER_H_
bool isUIThreadSafe() const override
If the underlying platform image held by this object has no threading requirements for the release of...
flutter::DlColorSpace GetColorSpace() const override
Gets the color space of the image.
bool isOpaque() const override
If the pixel format of this image ignores alpha, this returns true. This method might conservatively ...
static sk_sp< DlDeferredImageGPUImpeller > Make(std::unique_ptr< LayerTree > layer_tree, fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > snapshot_delegate, fml::RefPtr< fml::TaskRunner > raster_task_runner)
std::shared_ptr< impeller::Texture > GetImpellerTexture(const std::shared_ptr< impeller::Context > &context) const override
fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > snapshot_delegate_
#define FML_FRIEND_TEST(test_case_name, test_name)
Definition macros.h:47
#define FML_TEST_CLASS(test_case_name, test_name)
Definition macros.h:44
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
union flutter::testing::@2883::KeyboardChange::@77 content
FlTexture * texture
impeller::ISize32 DlISize
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
DlColorSpace
Definition dl_color.h:13