Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::DlImageImpeller Class Referenceabstract

#include <dl_image_impeller.h>

Inheritance diagram for impeller::DlImageImpeller:
flutter::DlImage Skwasm::DlWimpImageBase flutter::DlDeferredImageGPUImpeller flutter::PixelDeferredImageGPUImpeller impeller::DlImageImpellerTexture Skwasm::DlWimpImageFromPicture Skwasm::DlWimpImageFromPixels Skwasm::DlWimpImageFromTexture

Public Member Functions

Type GetImageType () const override
 Returns the backend type of this image.
 
const DlImageImpellerasImpellerImage () const override
 Safe downcast to DlImageImpeller.
 
bool isTextureBacked () const override
 Returns true if the image is backed by a GPU texture.
 
virtual std::shared_ptr< TextureGetImpellerTexture (const std::shared_ptr< Context > &context) const =0
 
std::shared_ptr< TextureGetCachedTexture (const ContentContext &renderer) const
 
- Public Member Functions inherited from flutter::DlImage
virtual ~DlImage ()
 
virtual const DlImageSkiaasSkiaImage () const
 Safe downcast to DlImageSkia.
 
virtual DlColorSpace GetColorSpace () const =0
 Gets the color space of the image.
 
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.
 
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.
 
virtual DlISize GetSize () const =0
 
virtual size_t GetApproximateByteSize () const =0
 
int width () const
 
int height () const
 
DlIRect GetBounds () 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
 

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)
 

Additional Inherited Members

- Public Types inherited from flutter::DlImage
enum class  OwningContext {
  kRaster ,
  kIO
}
 
enum class  Type {
  kSkia ,
  kImpeller
}
 The backend type of this image. More...
 
- Protected Member Functions inherited from flutter::DlImage
 DlImage ()
 

Detailed Description

Definition at line 17 of file dl_image_impeller.h.

Member Function Documentation

◆ asImpellerImage()

const DlImageImpeller * impeller::DlImageImpeller::asImpellerImage ( ) const
inlineoverridevirtual

Safe downcast to DlImageImpeller.

Returns
A pointer to DlImageImpeller or null if not an Impeller image.

Reimplemented from flutter::DlImage.

Definition at line 23 of file dl_image_impeller.h.

23{ return this; }

◆ GetCachedTexture()

std::shared_ptr< Texture > impeller::DlImageImpeller::GetCachedTexture ( const ContentContext renderer) const

Definition at line 54 of file dl_image_impeller.cc.

55 {
56 auto texture = renderer.GetCachedTexture(this);
57 if (texture) {
58 return texture;
59 }
60 texture = GetImpellerTexture(renderer.GetContext());
61 renderer.SetCachedTexture(this, texture);
62 return texture;
63}
virtual std::shared_ptr< Texture > GetImpellerTexture(const std::shared_ptr< Context > &context) const =0
FlTexture * texture

References impeller::ContentContext::GetCachedTexture(), impeller::ContentContext::GetContext(), GetImpellerTexture(), impeller::ContentContext::SetCachedTexture(), and texture.

◆ GetImageType()

Type impeller::DlImageImpeller::GetImageType ( ) const
inlineoverridevirtual

Returns the backend type of this image.

Returns
The image type.

Implements flutter::DlImage.

Definition at line 20 of file dl_image_impeller.h.

References flutter::DlImage::kImpeller.

◆ GetImpellerTexture()

virtual std::shared_ptr< Texture > impeller::DlImageImpeller::GetImpellerTexture ( const std::shared_ptr< Context > &  context) const
pure virtual

◆ isTextureBacked()

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

Returns true if the image is backed by a GPU texture.

Implements flutter::DlImage.

Definition at line 26 of file dl_image_impeller.h.

26{ return true; }

◆ Make()

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

Definition at line 12 of file dl_image_impeller.cc.

13 {
14 if (!texture) {
15 return nullptr;
16 }
17 return sk_make_sp<DlImageImpellerTexture>(std::move(texture), owning_context);
18}
virtual OwningContext owning_context() const
Definition dl_image.h:136

References flutter::DlImage::owning_context(), and texture.

Referenced by flutter::gpu::Texture::AsImage(), impeller::DlPlayground::CreateDlImageForFixture(), impeller::GoldenPlaygroundTest::CreateDlImageForFixture(), MakeFromYUVTextures(), impeller::interop::Texture::MakeImage(), impeller::interop::ReadSamplersAndUniforms(), flutter::testing::DlSurfaceInstanceImpeller::SnapshotToImage(), 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(), 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 20 of file dl_image_impeller.cc.

24 {
25 if (!aiks_context || !y_texture || !uv_texture) {
26 return nullptr;
27 }
28 auto yuv_to_rgb_filter_contents = FilterContents::MakeYUVToRGBFilter(
29 std::move(y_texture), std::move(uv_texture), yuv_color_space);
30 impeller::Entity entity;
32
33 // Disable the render target cache so that this snapshot's texture will not
34 // be reused later by other operations.
35 const auto& renderer = aiks_context->GetContentContext();
36 renderer.GetRenderTargetCache()->DisableCache();
37 fml::ScopedCleanupClosure restore_cache(
38 [&] { renderer.GetRenderTargetCache()->EnableCache(); });
39
40 std::optional<Snapshot> snapshot =
41 yuv_to_rgb_filter_contents->RenderToSnapshot(
42 renderer, entity,
43 {.coverage_limit = std::nullopt,
44 .sampler_descriptor = std::nullopt,
45 .msaa_enabled = true,
46 .mip_count = 1,
47 .label = "MakeYUVToRGBFilter Snapshot"});
48 if (!snapshot.has_value()) {
49 return nullptr;
50 }
51 return impeller::DlImageImpeller::Make(snapshot->texture);
52}
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:98
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().


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