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_
13#include "flutter/common/graphics/texture.h"
14#include "flutter/display_list/display_list.h"
15#include "flutter/display_list/image/dl_image.h"
16#include "flutter/flow/layers/layer_tree.h"
17#include "flutter/fml/macros.h"
18#include "flutter/fml/memory/weak_ptr.h"
19#include "flutter/lib/ui/io_manager.h"
20#include "flutter/lib/ui/snapshot_delegate.h"
37 std::unique_ptr<LayerTree> layer_tree,
72 std::optional<std::string>
get_error()
const override;
80 class ImageWrapper final :
public std::enable_shared_from_this<ImageWrapper>,
83 static std::shared_ptr<ImageWrapper>
Make(
92 std::unique_ptr<LayerTree> layer_tree,
97 const SkImageInfo image_info()
const {
return image_info_; }
103 void DeleteTexture();
111 std::shared_ptr<TextureRegistry> texture_registry_;
113 mutable std::mutex error_mutex_;
114 std::optional<std::string> error_;
132 void SnapshotDisplayList(std::unique_ptr<LayerTree> layer_tree =
nullptr);
135 void OnGrContextCreated()
override;
138 void OnGrContextDestroyed()
override;
141 const std::shared_ptr<ImageWrapper> image_wrapper_;
145 DlDeferredImageGPUSkia(std::shared_ptr<ImageWrapper> image_wrapper,
148 FML_DISALLOW_COPY_AND_ASSIGN(DlDeferredImageGPUSkia);
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_