| Flutter Impeller |

Public Member Functions | List of all members
impeller::interop::Texture Class Referencefinal

`#include <texture.h>`

Inheritance diagram for impeller::interop::Texture:

## Public Member Functions
| Texture (const Context &context, const TextureDescriptor &descriptor)
| Texture (impeller::Context::BackendType backend, std::shared_ptr< impeller::Texture > texture)
| ~Texture () override
| Texture (const Texture &)=delete
Texture & | operator= (const Texture &)=delete
bool | IsValid () const
bool | SetContents (const uint8_t *contents, uint64_t length)
bool | SetContents (std::shared_ptr< const fml::Mapping > contents)
sk_sp< DlImageImpeller > | MakeImage () const
impeller::Context::BackendType | GetBackendType () const
const std::shared_ptr< impeller::Texture > & | GetTexture () const
Public Member Functions inherited from impeller::interop::ObjectBase
| ObjectBase ()=default
virtual | ~ObjectBase ()=default
| ObjectBase (const ObjectBase &)=delete
| ObjectBase (ObjectBase &&)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
ObjectBase & | operator= (ObjectBase &&)=delete
void | Retain ()
void | Release ()
uint64_t | GetRefCountForTests () const

## Additional Inherited Members
Public Types inherited from impeller::interop::Object< Texture, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerTexture)>
using | InteropClass = Texture
using | InteropCSibling = IMPELLER_INTERNAL_HANDLE_NAME(ImpellerTexture)
Static Public Member Functions inherited from impeller::interop::ObjectBase
static void | SafeRetain (void *ptr)
static void | SafeRelease (void *ptr)

## Detailed Description

Definition at line 16 of file texture.h.

## Constructor & Destructor Documentation

## ◆ Texture() [1/3]

impeller::interop::Texture::Texture | ( | const Context & | context,
|  | const TextureDescriptor & | descriptor
| ) |  |
| explicit

Definition at line 9 of file texture.cc.

9 {
10 if (!context.IsValid()) {
11 return;
12 }
13 auto texture =
14 context.GetContext()->GetResourceAllocator()->CreateTexture(descriptor);
15 if (!texture || !texture->IsValid()) {
16 return;
17 }
18 backend_ = context.GetContext()->GetBackendType();
19 texture_ = std::move(texture);
20 }

References impeller::interop::Context::GetContext(), and impeller::interop::Context::IsValid().

## ◆ Texture() [2/3]

impeller::interop::Texture::Texture | ( | impeller::Context::BackendType | backend,
|  | std::shared_ptr< impeller::Texture > | texture
| ) |  |
| explicit

Definition at line 22 of file texture.cc.

24 : backend_(backend), texture_(std::move(texture)) {}

## ◆ ~Texture()

impeller::interop::Texture::~Texture | ( |  | ) |
| override default

## ◆ Texture() [3/3]

impeller::interop::Texture::Texture | ( | const Texture & |  | ) |
| delete

## Member Function Documentation

## ◆ GetBackendType()

impeller::Context::BackendType impeller::interop::Texture::GetBackendType | ( |  | ) | const

Definition at line 50 of file texture.cc.

50 {
51 return backend_;
52 }

## ◆ GetTexture()

const std::shared_ptr< impeller::Texture > & impeller::interop::Texture::GetTexture | ( |  | ) | const

Definition at line 54 of file texture.cc.

54 {
55 return texture_;
56 }

## ◆ IsValid()

bool impeller::interop::Texture::IsValid | ( |  | ) | const

Definition at line 28 of file texture.cc.

28 {
29 return !!texture_;
30 }

Referenced by SetContents().

## ◆ MakeImage()

sk_sp< DlImageImpeller > impeller::interop::Texture::MakeImage | ( |  | ) | const

Definition at line 46 of file texture.cc.

46 {
47 return DlImageImpeller::Make(texture_);
48 }

References impeller::DlImageImpeller::Make().

Referenced by impeller::interop::DisplayListBuilder::DrawTexture(), and impeller::interop::DisplayListBuilder::DrawTextureRect().

## ◆ operator=()

Texture& impeller::interop::Texture::operator= | ( | const Texture & |  | ) |
| delete

## ◆ SetContents() [1/2]

bool impeller::interop::Texture::SetContents | ( | const uint8_t * | contents,
|  | uint64_t | length
| ) |  |

Definition at line 32 of file texture.cc.

32 {
33 if (!IsValid()) {
34 return false;
35 }
36 return texture_->SetContents(contents, length);
37 }

References IsValid().

## ◆ SetContents() [2/2]

bool impeller::interop::Texture::SetContents | ( | std::shared_ptr< const fml::Mapping > | contents | ) |

Definition at line 39 of file texture.cc.

39 {
40 if (!IsValid()) {
41 return false;
42 }
43 return texture_->SetContents(std::move(contents));
44 }

References IsValid().

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

- impeller/toolkit/interop/texture.h
- impeller/toolkit/interop/texture.cc

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::interop::Texture::IsValid
bool IsValid() const
Definition: texture.cc:28