Flutter Engine
 
Loading...
Searching...
No Matches
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 texture->SetLabel("UserCreated");
19 backend_ = context.GetContext()->GetBackendType();
20 texture_ = std::move(texture);
21}
FlTexture * texture

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

◆ Texture() [2/3]

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

Definition at line 23 of file texture.cc.

25 : 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 51 of file texture.cc.

51 {
52 return backend_;
53}

◆ GetTexture()

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

Definition at line 55 of file texture.cc.

55 {
56 return texture_;
57}

◆ IsValid()

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

Definition at line 29 of file texture.cc.

29 {
30 return !!texture_;
31}

Referenced by SetContents(), and SetContents().

◆ MakeImage()

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

Definition at line 47 of file texture.cc.

47 {
48 return DlImageImpeller::Make(texture_);
49}
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)

References impeller::DlImageImpeller::Make().

◆ 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 33 of file texture.cc.

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

References IsValid(), and length.

◆ SetContents() [2/2]

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

Definition at line 40 of file texture.cc.

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

References IsValid().


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