Flutter Engine
 
Loading...
Searching...
No Matches
impeller::DlImageImpeller Class Referencefinal

#include <dl_image_impeller.h>

Inheritance diagram for impeller::DlImageImpeller:
flutter::DlImage

Public Member Functions

 ~DlImageImpeller () override
 
sk_sp< SkImage > skia_image () const override
 If this display list image is meant to be used by the Skia backend, an SkImage instance. Null otherwise.
 
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.
 
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.
 
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.
 
flutter::DlISize GetSize () const override
 
size_t GetApproximateByteSize () const override
 
OwningContext owning_context () const override
 
- Public Member Functions inherited from flutter::DlImage
virtual ~DlImage ()
 
int width () const
 
int height () const
 
DlIRect GetBounds () 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
 

Static Public Member Functions

static sk_sp< DlImageImpellerMake (std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
 
static sk_sp< DlImageImpellerMakeFromYUVTextures (AiksContext *aiks_context, std::shared_ptr< Texture > y_texture, std::shared_ptr< Texture > uv_texture, YUVColorSpace yuv_color_space)
 
- 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 15 of file dl_image_impeller.h.

Constructor & Destructor Documentation

◆ ~DlImageImpeller()

impeller::DlImageImpeller::~DlImageImpeller ( )
overridedefault

Member Function Documentation

◆ GetApproximateByteSize()

size_t impeller::DlImageImpeller::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 122 of file dl_image_impeller.cc.

122 {
123 auto size = sizeof(*this);
124 if (texture_) {
125 size += texture_->GetTextureDescriptor().GetByteSizeOfBaseMipLevel();
126 }
127 return size;
128}
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all 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

◆ GetSize()

flutter::DlISize impeller::DlImageImpeller::GetSize ( ) const
overridevirtual
Returns
The dimensions of the pixel grid.

Implements flutter::DlImage.

Definition at line 115 of file dl_image_impeller.cc.

115 {
116 // texture |GetSize()| returns a 64-bit size, but we need a 32-bit size,
117 // so we need to convert to DlISize (the 32-bit variant) either way.
118 return texture_ ? flutter::DlISize(texture_->GetSize()) : flutter::DlISize();
119}
impeller::ISize32 DlISize

◆ impeller_texture()

std::shared_ptr< impeller::Texture > impeller::DlImageImpeller::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 92 of file dl_image_impeller.cc.

92 {
93 return texture_;
94}

◆ isOpaque()

bool impeller::DlImageImpeller::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 97 of file dl_image_impeller.cc.

97 {
98 // Impeller doesn't currently implement opaque alpha types.
99 return false;
100}

◆ isTextureBacked()

bool impeller::DlImageImpeller::isTextureBacked ( ) const
overridevirtual

Implements flutter::DlImage.

Definition at line 103 of file dl_image_impeller.cc.

103 {
104 // Impeller textures are always ... textures :/
105 return true;
106}

◆ isUIThreadSafe()

bool impeller::DlImageImpeller::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 109 of file dl_image_impeller.cc.

109 {
110 // Impeller textures are always thread-safe
111 return true;
112}

◆ Make()

sk_sp< DlImageImpeller > impeller::DlImageImpeller::Make ( std::shared_ptr< Texture texture,
OwningContext  owning_context = OwningContext::kIO 
)
static

Definition at line 23 of file dl_image_impeller.cc.

24 {
25 if (!texture) {
26 return nullptr;
27 }
28 return sk_sp<DlImageImpeller>(
29 new DlImageImpeller(std::move(texture), owning_context));
30}
OwningContext owning_context() const override
FlTexture * texture

References owning_context(), and texture.

Referenced by flutter::gpu::Texture::AsImage(), impeller::DlPlayground::CreateDlImageForFixture(), impeller::GoldenPlaygroundTest::CreateDlImageForFixture(), MakeFromYUVTextures(), impeller::interop::Texture::MakeImage(), flutter::testing::DlMetalSurfaceProvider::MakeImpellerImage(), flutter::SnapshotControllerImpeller::MakeRasterSnapshot(), impeller::interop::ReadSamplersAndUniforms(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), and flutter::ImageDecoderImpeller::UploadTextureToStorage().

◆ MakeFromYUVTextures()

sk_sp< DlImageImpeller > impeller::DlImageImpeller::MakeFromYUVTextures ( AiksContext aiks_context,
std::shared_ptr< Texture y_texture,
std::shared_ptr< Texture uv_texture,
YUVColorSpace  yuv_color_space 
)
static

Definition at line 33 of file dl_image_impeller.cc.

37 {
38 if (!aiks_context || !y_texture || !uv_texture) {
39 return nullptr;
40 }
41 auto yuv_to_rgb_filter_contents = FilterContents::MakeYUVToRGBFilter(
42 std::move(y_texture), std::move(uv_texture), yuv_color_space);
43 impeller::Entity entity;
45
46 // Disable the render target cache so that this snapshot's texture will not
47 // be reused later by other operations.
48 const auto& renderer = aiks_context->GetContentContext();
49 renderer.GetRenderTargetCache()->DisableCache();
50 fml::ScopedCleanupClosure restore_cache(
51 [&] { renderer.GetRenderTargetCache()->EnableCache(); });
52
53 std::optional<Snapshot> snapshot =
54 yuv_to_rgb_filter_contents->RenderToSnapshot(
55 renderer, entity,
56 {.coverage_limit = std::nullopt,
57 .sampler_descriptor = std::nullopt,
58 .msaa_enabled = true,
59 .mip_count = 1,
60 .label = "MakeYUVToRGBFilter Snapshot"});
61 if (!snapshot.has_value()) {
62 return nullptr;
63 }
64 return impeller::DlImageImpeller::Make(snapshot->texture);
65}
Wraps a closure that is invoked in the destructor unless released by the caller.
Definition closure.h:32
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
void SetBlendMode(BlendMode blend_mode)
Definition entity.cc:97
static std::shared_ptr< FilterContents > MakeYUVToRGBFilter(std::shared_ptr< Texture > y_texture, std::shared_ptr< Texture > uv_texture, YUVColorSpace yuv_color_space)

References impeller::AiksContext::GetContentContext(), impeller::ContentContext::GetRenderTargetCache(), impeller::kSrc, Make(), impeller::FilterContents::MakeYUVToRGBFilter(), and impeller::Entity::SetBlendMode().

◆ owning_context()

OwningContext impeller::DlImageImpeller::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 57 of file dl_image_impeller.h.

57{ return owning_context_; }

Referenced by Make().

◆ skia_image()

sk_sp< SkImage > impeller::DlImageImpeller::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 87 of file dl_image_impeller.cc.

87 {
88 return nullptr;
89};

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