Flutter Impeller
impeller::interop::Texture Class Referencefinal

#include <texture.h>

Inheritance diagram for impeller::interop::Texture:
impeller::interop::Object< Texture, IMPELLER_INTERNAL_HANDLE_NAME(ImpellerTexture)> impeller::interop::ObjectBase

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
 
Textureoperator= (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< DlImageImpellerMakeImage () 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
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
ObjectBaseoperator= (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 ( )
overridedefault

◆ 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

◆ 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::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