5#ifndef FLUTTER_LIB_UI_PAINTING_DISPLAY_LIST_DEFERRED_IMAGE_GPU_SKIA_H_
6#define FLUTTER_LIB_UI_PAINTING_DISPLAY_LIST_DEFERRED_IMAGE_GPU_SKIA_H_
11#include "flutter/common/graphics/texture.h"
12#include "flutter/display_list/display_list.h"
13#include "flutter/display_list/image/dl_image.h"
14#include "flutter/flow/layers/layer_tree.h"
15#include "flutter/fml/macros.h"
16#include "flutter/fml/memory/weak_ptr.h"
17#include "flutter/lib/ui/io_manager.h"
18#include "flutter/lib/ui/snapshot_delegate.h"
35 std::unique_ptr<LayerTree> layer_tree,
70 std::optional<std::string>
get_error()
const override;
78 class ImageWrapper final :
public std::enable_shared_from_this<ImageWrapper>,
81 static std::shared_ptr<ImageWrapper> Make(
88 static std::shared_ptr<ImageWrapper> MakeFromLayerTree(
90 std::unique_ptr<LayerTree> layer_tree,
95 const SkImageInfo image_info()
const {
return image_info_; }
97 bool isTextureBacked()
const;
98 std::optional<std::string> get_error();
101 void DeleteTexture();
109 std::shared_ptr<TextureRegistry> texture_registry_;
111 mutable std::mutex error_mutex_;
112 std::optional<std::string> error_;
130 void SnapshotDisplayList(std::unique_ptr<LayerTree> layer_tree =
nullptr);
133 void OnGrContextCreated()
override;
136 void OnGrContextDestroyed()
override;
139 const std::shared_ptr<ImageWrapper> image_wrapper_;
143 DlDeferredImageGPUSkia(std::shared_ptr<ImageWrapper> image_wrapper,
sk_sp< SkImage > skia_image() const override
If this display list image is meant to be used by the Skia backend, an SkImage instance....
std::optional< std::string > get_error() const override
static sk_sp< DlDeferredImageGPUSkia > Make(const SkImageInfo &image_info, sk_sp< DisplayList > display_list, fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > snapshot_delegate, const fml::RefPtr< fml::TaskRunner > &raster_task_runner, fml::RefPtr< SkiaUnrefQueue > unref_queue)
std::shared_ptr< impeller::Texture > impeller_texture() const override
If this display list image is meant to be used by the Impeller backend, an Impeller texture instance....
bool isTextureBacked() const override
SkISize dimensions() const override
OwningContext owning_context() const override
~DlDeferredImageGPUSkia() override
bool isOpaque() const override
If the pixel format of this image ignores alpha, this returns true. This method might conservatively ...
static sk_sp< DlDeferredImageGPUSkia > MakeFromLayerTree(const SkImageInfo &image_info, std::unique_ptr< LayerTree > layer_tree, fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > snapshot_delegate, const fml::RefPtr< fml::TaskRunner > &raster_task_runner, fml::RefPtr< SkiaUnrefQueue > unref_queue)
bool isUIThreadSafe() const override
If the underlying platform image held by this object has no threading requirements for the release of...
virtual size_t GetApproximateByteSize() const override
Represents an image whose allocation is (usually) resident on device memory.
fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > snapshot_delegate_
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)