| 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
SkISize | dimensions () 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

## ◆ dimensions()

SkISize impeller::DlImageImpeller::dimensions | ( |  | ) | const
| override

Definition at line 82 of file dl_image_impeller.cc.

82 {
83 const auto size = texture_ ? texture_->GetSize() : ISize{};
84 return SkISize::Make(size.width, size.height);
85 }

## ◆ GetApproximateByteSize()

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

Definition at line 88 of file dl_image_impeller.cc.

88 {
89 auto size = sizeof(*this);
90 if (texture_) {
91 size += texture_->GetTextureDescriptor().GetByteSizeOfBaseMipLevel();
92 }
93 return size;
94 }

## ◆ impeller_texture()

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

Definition at line 59 of file dl_image_impeller.cc.

59 {
60 return texture_;
61 }

## ◆ isOpaque()

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

Definition at line 64 of file dl_image_impeller.cc.

64 {
65 // Impeller doesn't currently implement opaque alpha types.
66 return false;
67 }

## ◆ isTextureBacked()

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

Definition at line 70 of file dl_image_impeller.cc.

70 {
71 // Impeller textures are always ... textures :/
72 return true;
73 }

## ◆ isUIThreadSafe()

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

Definition at line 76 of file dl_image_impeller.cc.

76 {
77 // Impeller textures are always thread-safe
78 return true;
79 }

## ◆ 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_sp<DlImageImpeller>(
18 new DlImageImpeller(std::move(texture), owning_context));
19 }

References owning_context().

Referenced by MakeFromYUVTextures(), 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 21 of file dl_image_impeller.cc.

25 {
26 if (!aiks_context || !y_texture || !uv_texture) {
27 return nullptr;
28 }
29 auto yuv_to_rgb_filter_contents = FilterContents::MakeYUVToRGBFilter(
30 std::move(y_texture), std::move(uv_texture), yuv_color_space);
31 impeller::Entity entity;
32 entity.SetBlendMode(impeller::BlendMode::kSource);
33 auto snapshot = yuv_to_rgb_filter_contents->RenderToSnapshot(
34 aiks_context->GetContentContext(), // renderer
35 entity, // entity
36 std::nullopt, // coverage_limit
37 std::nullopt, // sampler_descriptor
38 true, // msaa_enabled
39 "MakeYUVToRGBFilter Snapshot"); // label
40 if (!snapshot.has_value()) {
41 return nullptr;
42 }
43 return impeller::DlImageImpeller::Make(snapshot->texture);
44 }

References impeller::AiksContext::GetContentContext(), impeller::kSource, Make(), impeller::FilterContents::MakeYUVToRGBFilter(), and impeller::Entity::SetBlendMode().

## ◆ owning_context()

OwningContext impeller::DlImageImpeller::owning_context | ( |  | ) | const
| inline override

Definition at line 52 of file dl_image_impeller.h.

52 { return owning_context_; }

Referenced by Make().

## ◆ skia_image()

sk_sp< SkImage > impeller::DlImageImpeller::skia_image | ( |  | ) | const
| override

Definition at line 54 of file dl_image_impeller.cc.

54 {
55 return nullptr;
56 };

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

impeller::Entity::SetBlendMode
void SetBlendMode(BlendMode blend_mode)
Definition: entity.cc:97
impeller::DlImageImpeller::Make
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
Definition: dl_image_impeller.cc:12
impeller::Entity
Definition: entity.h:21
impeller::DlImageImpeller::owning_context
OwningContext owning_context() const override
Definition: dl_image_impeller.h:52
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:123
impeller::ISize
TSize< int64_t > ISize
Definition: size.h:136
impeller::BlendMode::kSource
@ kSource