Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Static Public Member Functions | List of all members
flutter::DlDeferredImageGPUSkia Class Referencefinal

#include <display_list_deferred_image_gpu_skia.h>

Inheritance diagram for flutter::DlDeferredImageGPUSkia:
flutter::DlImage SkRefCnt SkRefCntBase

Public Member Functions

 ~DlDeferredImageGPUSkia () override
 
sk_sp< SkImageskia_image () const override
 If this display list image is meant to be used by the Skia backend, an SkImage instance. Null otherwise. More...
 
std::shared_ptr< impeller::Textureimpeller_texture () const override
 If this display list image is meant to be used by the Impeller backend, an Impeller texture instance. Null otherwise. More...
 
bool isOpaque () const override
 If the pixel format of this image ignores alpha, this returns true. This method might conservatively return false when it cannot guarnatee an opaque image, for example when the pixel format of the image supports alpha but the image is made up of entirely opaque pixels. More...
 
bool isTextureBacked () const override
 
bool isUIThreadSafe () const override
 If the underlying platform image held by this object has no threading requirements for the release of that image (or if arrangements have already been made to forward that image to the correct thread upon deletion), this method returns true. More...
 
SkISize dimensions () const override
 
virtual size_t GetApproximateByteSize () const override
 
std::optional< std::string > get_error () const override
 
OwningContext owning_context () const override
 
- Public Member Functions inherited from flutter::DlImage
virtual ~DlImage ()
 
virtual sk_sp< SkImageskia_image () const =0
 If this display list image is meant to be used by the Skia backend, an SkImage instance. Null otherwise. More...
 
virtual std::shared_ptr< impeller::Textureimpeller_texture () const =0
 If this display list image is meant to be used by the Impeller backend, an Impeller texture instance. Null otherwise. More...
 
virtual bool isOpaque () const =0
 If the pixel format of this image ignores alpha, this returns true. This method might conservatively return false when it cannot guarnatee an opaque image, for example when the pixel format of the image supports alpha but the image is made up of entirely opaque pixels. More...
 
virtual bool isTextureBacked () const =0
 
virtual bool isUIThreadSafe () const =0
 If the underlying platform image held by this object has no threading requirements for the release of that image (or if arrangements have already been made to forward that image to the correct thread upon deletion), this method returns true. More...
 
virtual SkISize dimensions () const =0
 
virtual size_t GetApproximateByteSize () const =0
 
int width () const
 
int height () const
 
SkIRect bounds () const
 
virtual OwningContext owning_context () const
 
virtual std::optional< std::string > get_error () const
 
bool Equals (const DlImage *other) const
 
bool Equals (const DlImage &other) const
 
bool Equals (const sk_sp< const DlImage > &other) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< DlDeferredImageGPUSkiaMake (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)
 
static sk_sp< DlDeferredImageGPUSkiaMakeFromLayerTree (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)
 
- Static Public Member Functions inherited from flutter::DlImage
static sk_sp< DlImageMake (const SkImage *image)
 
static sk_sp< DlImageMake (sk_sp< SkImage > image)
 

Additional Inherited Members

- Public Types inherited from flutter::DlImage
enum class  OwningContext { kRaster , kIO }
 
- Protected Member Functions inherited from flutter::DlImage
 DlImage ()
 

Detailed Description

Definition at line 26 of file display_list_deferred_image_gpu_skia.h.

Constructor & Destructor Documentation

◆ ~DlDeferredImageGPUSkia()

flutter::DlDeferredImageGPUSkia::~DlDeferredImageGPUSkia ( )
override

Definition at line 49 of file display_list_deferred_image_gpu_skia.cc.

49 {
50 fml::TaskRunner::RunNowOrPostTask(raster_task_runner_,
51 [image_wrapper = image_wrapper_]() {
52 if (!image_wrapper) {
53 return;
54 }
55 image_wrapper->Unregister();
56 image_wrapper->DeleteTexture();
57 });
58}
static void RunNowOrPostTask(const fml::RefPtr< fml::TaskRunner > &runner, const fml::closure &task)
Definition: task_runner.cc:55

Member Function Documentation

◆ dimensions()

SkISize flutter::DlDeferredImageGPUSkia::dimensions ( ) const
overridevirtual
Returns
The dimensions of the pixel grid.

Implements flutter::DlImage.

Definition at line 87 of file display_list_deferred_image_gpu_skia.cc.

87 {
88 return image_wrapper_ ? image_wrapper_->image_info().dimensions()
90}
static constexpr SkISize MakeEmpty()
Definition: SkSize.h:22

◆ get_error()

std::optional< std::string > flutter::DlDeferredImageGPUSkia::get_error ( ) const
overridevirtual
Returns
An error, if any, that occurred when trying to create the image.

Reimplemented from flutter::DlImage.

Definition at line 99 of file display_list_deferred_image_gpu_skia.cc.

99 {
100 return image_wrapper_ ? image_wrapper_->get_error() : std::nullopt;
101}

◆ GetApproximateByteSize()

size_t flutter::DlDeferredImageGPUSkia::GetApproximateByteSize ( ) const
overridevirtual
Returns
The approximate byte size of the allocation of this image. This takes into account details such as mip-mapping. The allocation is usually resident in device memory.

Implements flutter::DlImage.

Definition at line 93 of file display_list_deferred_image_gpu_skia.cc.

93 {
94 return sizeof(*this) +
95 (image_wrapper_ ? image_wrapper_->image_info().computeMinByteSize()
96 : 0);
97}

◆ impeller_texture()

std::shared_ptr< impeller::Texture > flutter::DlDeferredImageGPUSkia::impeller_texture ( ) const
overridevirtual

If this display list image is meant to be used by the Impeller backend, an Impeller texture instance. Null otherwise.

Returns
An Impeller texture instance or null.

Implements flutter::DlImage.

Definition at line 66 of file display_list_deferred_image_gpu_skia.cc.

67 {
68 return nullptr;
69}

◆ isOpaque()

bool flutter::DlDeferredImageGPUSkia::isOpaque ( ) const
overridevirtual

If the pixel format of this image ignores alpha, this returns true. This method might conservatively return false when it cannot guarnatee an opaque image, for example when the pixel format of the image supports alpha but the image is made up of entirely opaque pixels.

Returns
True if the pixel format of this image ignores alpha.

Implements flutter::DlImage.

Definition at line 72 of file display_list_deferred_image_gpu_skia.cc.

72 {
73 return image_wrapper_ ? image_wrapper_->image_info().isOpaque() : false;
74}

◆ isTextureBacked()

bool flutter::DlDeferredImageGPUSkia::isTextureBacked ( ) const
overridevirtual

Implements flutter::DlImage.

Definition at line 77 of file display_list_deferred_image_gpu_skia.cc.

77 {
78 return image_wrapper_ ? image_wrapper_->isTextureBacked() : false;
79}

◆ isUIThreadSafe()

bool flutter::DlDeferredImageGPUSkia::isUIThreadSafe ( ) const
overridevirtual

If the underlying platform image held by this object has no threading requirements for the release of that image (or if arrangements have already been made to forward that image to the correct thread upon deletion), this method returns true.

Returns
True if the underlying image is held in a thread-safe manner.

Implements flutter::DlImage.

Definition at line 82 of file display_list_deferred_image_gpu_skia.cc.

82 {
83 return true;
84}

◆ Make()

sk_sp< DlDeferredImageGPUSkia > flutter::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 
)
static

Definition at line 16 of file display_list_deferred_image_gpu_skia.cc.

21 {
22 return sk_sp<DlDeferredImageGPUSkia>(new DlDeferredImageGPUSkia(
23 ImageWrapper::Make(image_info, std::move(display_list),
24 std::move(snapshot_delegate), raster_task_runner,
25 std::move(unref_queue)),
26 raster_task_runner));
27}
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)

◆ MakeFromLayerTree()

sk_sp< DlDeferredImageGPUSkia > flutter::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 
)
static

Definition at line 29 of file display_list_deferred_image_gpu_skia.cc.

34 {
35 return sk_sp<DlDeferredImageGPUSkia>(new DlDeferredImageGPUSkia(
36 ImageWrapper::MakeFromLayerTree(
37 image_info, std::move(layer_tree), std::move(snapshot_delegate),
38 raster_task_runner, std::move(unref_queue)),
39 raster_task_runner));
40}

◆ owning_context()

OwningContext flutter::DlDeferredImageGPUSkia::owning_context ( ) const
inlineoverridevirtual
Returns
Specifies which context was used to create this image. The image must be collected on the same task runner as its context.

Reimplemented from flutter::DlImage.

Definition at line 75 of file display_list_deferred_image_gpu_skia.h.

◆ skia_image()

sk_sp< SkImage > flutter::DlDeferredImageGPUSkia::skia_image ( ) const
overridevirtual

If this display list image is meant to be used by the Skia backend, an SkImage instance. Null otherwise.

Returns
A Skia image instance or null.

Implements flutter::DlImage.

Definition at line 61 of file display_list_deferred_image_gpu_skia.cc.

61 {
62 return image_wrapper_ ? image_wrapper_->CreateSkiaImage() : nullptr;
63};

The documentation for this class was generated from the following files: