Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::DlImageSkia Class Referencefinal

#include <dl_image_skia.h>

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

Public Member Functions

 DlImageSkia (sk_sp< SkImage > image)
 
 ~DlImageSkia () 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
 
size_t GetApproximateByteSize () 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
 

Additional Inherited Members

- Public Types inherited from flutter::DlImage
enum class  OwningContext { kRaster , kIO }
 
- Static Public Member Functions inherited from flutter::DlImage
static sk_sp< DlImageMake (const SkImage *image)
 
static sk_sp< DlImageMake (sk_sp< SkImage > image)
 
- Protected Member Functions inherited from flutter::DlImage
 DlImage ()
 

Detailed Description

Definition at line 13 of file dl_image_skia.h.

Constructor & Destructor Documentation

◆ DlImageSkia()

flutter::DlImageSkia::DlImageSkia ( sk_sp< SkImage image)
explicit

Definition at line 9 of file dl_image_skia.cc.

9: image_(std::move(image)) {}
sk_sp< const SkImage > image
Definition: SkRecords.h:269

◆ ~DlImageSkia()

flutter::DlImageSkia::~DlImageSkia ( )
overridedefault

Member Function Documentation

◆ dimensions()

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

Implements flutter::DlImage.

Definition at line 46 of file dl_image_skia.cc.

46 {
47 return image_ ? image_->dimensions() : SkISize::MakeEmpty();
48}
SkISize dimensions() const
Definition: SkImage.h:297
static constexpr SkISize MakeEmpty()
Definition: SkSize.h:22

◆ GetApproximateByteSize()

size_t flutter::DlImageSkia::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 51 of file dl_image_skia.cc.

51 {
52 auto size = sizeof(*this);
53 if (image_) {
54 const auto& info = image_->imageInfo();
55 const auto kMipmapOverhead = image_->hasMipmaps() ? 4.0 / 3.0 : 1.0;
56 const size_t image_byte_size = info.computeMinByteSize() * kMipmapOverhead;
57 size += image_byte_size;
58 }
59 return size;
60}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
const SkImageInfo & imageInfo() const
Definition: SkImage.h:279
bool hasMipmaps() const
Definition: SkImage.cpp:292
it will be possible to load the file into Perfetto s trace viewer 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
Definition: switches.h:259

◆ impeller_texture()

std::shared_ptr< impeller::Texture > flutter::DlImageSkia::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 20 of file dl_image_skia.cc.

20 {
21 return nullptr;
22}

◆ isOpaque()

bool flutter::DlImageSkia::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 25 of file dl_image_skia.cc.

25 {
26 return image_ ? image_->isOpaque() : false;
27}
bool isOpaque() const
Definition: SkImage.h:375

◆ isTextureBacked()

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

Implements flutter::DlImage.

Definition at line 30 of file dl_image_skia.cc.

30 {
31 return image_ ? image_->isTextureBacked() : false;
32}
virtual bool isTextureBacked() const =0

◆ isUIThreadSafe()

bool flutter::DlImageSkia::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 35 of file dl_image_skia.cc.

35 {
36 // Technically if the image is null then we are thread-safe, and possibly
37 // if the image is constructed from a heap raster as well, but there
38 // should never be a leak of an instance of this class into any data that
39 // is shared with the UI thread, regardless of value.
40 // All images intended to be shared with the UI thread should be constructed
41 // via one of the DlImage subclasses designed for that purpose.
42 return false;
43}

◆ skia_image()

sk_sp< SkImage > flutter::DlImageSkia::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 15 of file dl_image_skia.cc.

15 {
16 return image_;
17};

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