| Flutter Impeller |

Public Member Functions | Static Public Member Functions | List of all members
impeller::DlImageImpeller Class Referencefinal

`#include <dl_image_impeller.h>`

Inheritance diagram for impeller::DlImageImpeller:

## Public Member Functions
| ~DlImageImpeller () override
sk_sp< SkImage > | skia_image () const override
std::shared_ptr< impeller::Texture > | impeller_texture () const override
bool | isOpaque () const override
bool | isTextureBacked () const override
bool | isUIThreadSafe () const override
flutter::DlISize | GetSize () const override
size_t | GetApproximateByteSize () const override
OwningContext | owning_context () const override

## Static Public Member Functions
static sk_sp< DlImageImpeller > | Make (std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
static sk_sp< DlImageImpeller > | MakeFromYUVTextures (AiksContext *aiks_context, std::shared_ptr< Texture > y_texture, std::shared_ptr< Texture > uv_texture, YUVColorSpace yuv_color_space)

## Detailed Description

Definition at line 15 of file dl_image_impeller.h.

## Constructor & Destructor Documentation

## ◆ ~DlImageImpeller()

impeller::DlImageImpeller::~DlImageImpeller | ( |  | ) |
| override default

## Member Function Documentation

## ◆ GetApproximateByteSize()

size_t impeller::DlImageImpeller::GetApproximateByteSize | ( |  | ) | const
| override

Definition at line 123 of file dl_image_impeller.cc.

123 {
124 auto size = sizeof(*this);
125 if (texture_) {
126 size += texture_->GetTextureDescriptor().GetByteSizeOfBaseMipLevel();
127 }
128 return size;
129 }

## ◆ GetSize()

flutter::DlISize impeller::DlImageImpeller::GetSize | ( |  | ) | const
| override

Definition at line 116 of file dl_image_impeller.cc.

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

## ◆ impeller_texture()

std::shared_ptr< impeller::Texture > impeller::DlImageImpeller::impeller_texture | ( |  | ) | const
| override

Definition at line 93 of file dl_image_impeller.cc.

93 {
94 return texture_;
95 }

## ◆ isOpaque()

bool impeller::DlImageImpeller::isOpaque | ( |  | ) | const
| override

Definition at line 98 of file dl_image_impeller.cc.

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

## ◆ isTextureBacked()

bool impeller::DlImageImpeller::isTextureBacked | ( |  | ) | const
| override

Definition at line 104 of file dl_image_impeller.cc.

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

## ◆ isUIThreadSafe()

bool impeller::DlImageImpeller::isUIThreadSafe | ( |  | ) | const
| override

Definition at line 110 of file dl_image_impeller.cc.

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

## ◆ 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 }
impeller::DlImageImpeller::owning_context
OwningContext owning_context() const override
Definition: dl_image_impeller.h:57

References owning_context().

Referenced by impeller::DlPlayground::CreateDlImageForFixture(), impeller::GoldenPlaygroundTest::CreateDlImageForFixture(), MakeFromYUVTextures(), impeller::interop::Texture::MakeImage(), impeller::interop::ReadSamplersAndUniforms(), and impeller::testing::TEST_P().

## ◆ 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;
44 entity.SetBlendMode(impeller::BlendMode::kSrc);
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, // renderer
56 entity, // entity
57 std::nullopt, // coverage_limit
58 std::nullopt, // sampler_descriptor
59 true, // msaa_enabled
60 /*mip_count=*/1,
61 "MakeYUVToRGBFilter Snapshot"); // label
62 if (!snapshot.has_value()) {
63 return nullptr;
64 }
65 return impeller::DlImageImpeller::Make(snapshot->texture);
66 }
impeller::DlImageImpeller::Make
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
Definition: dl_image_impeller.cc:23
impeller::Entity
Definition: entity.h:26
impeller::Entity::SetBlendMode
void SetBlendMode(BlendMode blend_mode)
Definition: entity.cc:97
impeller::FilterContents::MakeYUVToRGBFilter
static std::shared_ptr< FilterContents > MakeYUVToRGBFilter(std::shared_ptr< Texture > y_texture, std::shared_ptr< Texture > uv_texture, YUVColorSpace yuv_color_space)
Definition: filter_contents.cc:107
impeller::BlendMode::kSrc
@ kSrc

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
| inline override

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
| override

Definition at line 88 of file dl_image_impeller.cc.

88 {
89 return nullptr;
90 };

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

- impeller/display_list/dl_image_impeller.h
- impeller/display_list/dl_image_impeller.cc