Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
flutter::DlImage Class Referenceabstract

Represents an image whose allocation is (usually) resident on device memory. More...

#include <dl_image.h>

Inheritance diagram for flutter::DlImage:
SkRefCnt SkRefCntBase flutter::DlDeferredImageGPUImpeller flutter::DlDeferredImageGPUSkia flutter::DlImageGPU flutter::DlImageSkia impeller::DlImageImpeller

Public Types

enum class  OwningContext { kRaster , kIO }
 

Public Member Functions

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< DlImageMake (const SkImage *image)
 
static sk_sp< DlImageMake (sk_sp< SkImage > image)
 

Protected Member Functions

 DlImage ()
 

Detailed Description

Represents an image whose allocation is (usually) resident on device memory.

Since it is usually impossible or expensive to transmute images for one rendering backend to another, these objects are backend specific.

Definition at line 30 of file dl_image.h.

Member Enumeration Documentation

◆ OwningContext

Enumerator
kRaster 
kIO 

Definition at line 33 of file dl_image.h.

33{ kRaster, kIO };
@ kRaster
Suitable for thread which raster data.
Definition: embedder.h:266

Constructor & Destructor Documentation

◆ ~DlImage()

flutter::DlImage::~DlImage ( )
virtualdefault

◆ DlImage()

flutter::DlImage::DlImage ( )
protecteddefault

Member Function Documentation

◆ bounds()

SkIRect flutter::DlImage::bounds ( ) const
Returns
The bounds of the pixel grid with 0, 0 as origin. A convenience method that calls |DlImage::dimensions|.

Definition at line 31 of file dl_image.cc.

31 {
33}
virtual SkISize dimensions() const =0
static constexpr SkIRect MakeSize(const SkISize &size)
Definition: SkRect.h:66

◆ dimensions()

virtual SkISize flutter::DlImage::dimensions ( ) const
pure virtual

◆ Equals() [1/3]

bool flutter::DlImage::Equals ( const DlImage other) const
inline

Definition at line 132 of file dl_image.h.

132{ return Equals(&other); }
bool Equals(const DlImage *other) const
Definition: dl_image.h:121

◆ Equals() [2/3]

bool flutter::DlImage::Equals ( const DlImage other) const
inline

Definition at line 121 of file dl_image.h.

121 {
122 if (!other) {
123 return false;
124 }
125 if (this == other) {
126 return true;
127 }
128 return skia_image() == other->skia_image() &&
129 impeller_texture() == other->impeller_texture();
130 }
virtual std::shared_ptr< impeller::Texture > impeller_texture() const =0
If this display list image is meant to be used by the Impeller backend, an Impeller texture instance....
virtual sk_sp< SkImage > skia_image() const =0
If this display list image is meant to be used by the Skia backend, an SkImage instance....

◆ Equals() [3/3]

bool flutter::DlImage::Equals ( const sk_sp< const DlImage > &  other) const
inline

Definition at line 134 of file dl_image.h.

134 {
135 return Equals(other.get());
136 }
T * get() const
Definition: SkRefCnt.h:303

◆ get_error()

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

Reimplemented in flutter::DlDeferredImageGPUSkia.

Definition at line 35 of file dl_image.cc.

35 {
36 return std::nullopt;
37}

◆ GetApproximateByteSize()

virtual size_t flutter::DlImage::GetApproximateByteSize ( ) const
pure virtual
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.

Implemented in flutter::DlImageSkia, impeller::DlImageImpeller, flutter::DlDeferredImageGPUImpeller, flutter::DlDeferredImageGPUSkia, and flutter::DlImageGPU.

◆ height()

int flutter::DlImage::height ( ) const
Returns
The height of the pixel grid. A convenience method that calls |DlImage::dimensions|.

Definition at line 27 of file dl_image.cc.

27 {
28 return dimensions().fHeight;
29};
int32_t fHeight
Definition: SkSize.h:18

◆ impeller_texture()

virtual std::shared_ptr< impeller::Texture > flutter::DlImage::impeller_texture ( ) const
pure virtual

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.

Implemented in flutter::DlImageSkia, impeller::DlImageImpeller, flutter::DlDeferredImageGPUImpeller, flutter::DlDeferredImageGPUSkia, and flutter::DlImageGPU.

◆ isOpaque()

virtual bool flutter::DlImage::isOpaque ( ) const
pure virtual

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.

Implemented in flutter::DlImageSkia, impeller::DlImageImpeller, flutter::DlDeferredImageGPUImpeller, flutter::DlDeferredImageGPUSkia, and flutter::DlImageGPU.

◆ isTextureBacked()

virtual bool flutter::DlImage::isTextureBacked ( ) const
pure virtual

◆ isUIThreadSafe()

virtual bool flutter::DlImage::isUIThreadSafe ( ) const
pure virtual

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.

Implemented in flutter::DlImageSkia, impeller::DlImageImpeller, flutter::DlDeferredImageGPUImpeller, flutter::DlDeferredImageGPUSkia, and flutter::DlImageGPU.

◆ Make() [1/2]

sk_sp< DlImage > flutter::DlImage::Make ( const SkImage image)
static

Definition at line 11 of file dl_image.cc.

11 {
12 return Make(sk_ref_sp(image));
13}
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
static sk_sp< DlImage > Make(const SkImage *image)
Definition: dl_image.cc:11
sk_sp< const SkImage > image
Definition: SkRecords.h:269

◆ Make() [2/2]

sk_sp< DlImage > flutter::DlImage::Make ( sk_sp< SkImage image)
static

Definition at line 15 of file dl_image.cc.

15 {
16 return sk_make_sp<DlImageSkia>(std::move(image));
17}

◆ owning_context()

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

Reimplemented in impeller::DlImageImpeller, flutter::DlDeferredImageGPUImpeller, and flutter::DlDeferredImageGPUSkia.

Definition at line 114 of file dl_image.h.

◆ skia_image()

virtual sk_sp< SkImage > flutter::DlImage::skia_image ( ) const
pure virtual

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.

Implemented in flutter::DlImageSkia, impeller::DlImageImpeller, flutter::DlDeferredImageGPUImpeller, flutter::DlDeferredImageGPUSkia, and flutter::DlImageGPU.

◆ width()

int flutter::DlImage::width ( ) const
Returns
The width of the pixel grid. A convenience method that calls |DlImage::dimensions|.

Definition at line 23 of file dl_image.cc.

23 {
24 return dimensions().fWidth;
25};
int32_t fWidth
Definition: SkSize.h:17

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