Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
flutter::gpu::Texture Class Reference

#include <texture.h>

Inheritance diagram for flutter::gpu::Texture:
flutter::RefCountedDartWrappable< Texture > fml::RefCountedThreadSafe< T > tonic::DartWrappable fml::internal::RefCountedThreadSafeBase

Public Member Functions

 Texture (std::shared_ptr< impeller::Texture > texture)
 
 ~Texture () override
 
std::shared_ptr< impeller::TextureGetTexture ()
 
void SetCoordinateSystem (impeller::TextureCoordinateSystem coordinate_system)
 
bool Overwrite (const tonic::DartByteData &source_bytes)
 
size_t GetBytesPerTexel ()
 
Dart_Handle AsImage () const
 
- Public Member Functions inherited from flutter::RefCountedDartWrappable< Texture >
virtual void RetainDartWrappableReference () const override
 
virtual void ReleaseDartWrappableReference () const override
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< T >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 
- Public Member Functions inherited from tonic::DartWrappable
 DartWrappable ()
 
virtual const DartWrapperInfoGetDartWrapperInfo () const =0
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Additional Inherited Members

- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields { kPeerIndex , kNumberOfNativeFields }
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< T >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 
- Protected Member Functions inherited from tonic::DartWrappable
virtual ~DartWrappable ()
 
- Static Protected Member Functions inherited from tonic::DartWrappable
static Dart_PersistentHandle GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info)
 

Detailed Description

Definition at line 17 of file texture.h.

Constructor & Destructor Documentation

◆ Texture()

flutter::gpu::Texture::Texture ( std::shared_ptr< impeller::Texture texture)
explicit

Definition at line 21 of file texture.cc.

22 : texture_(std::move(texture)) {}
FlTexture * texture

◆ ~Texture()

flutter::gpu::Texture::~Texture ( )
overridedefault

Member Function Documentation

◆ AsImage()

Dart_Handle flutter::gpu::Texture::AsImage ( ) const

Definition at line 52 of file texture.cc.

52 {
53 // DlImageImpeller isn't compiled in builds with Impeller disabled. If
54 // Impeller is disabled, it's impossible to get here anyhow, so just ifdef it
55 // out.
56#if IMPELLER_SUPPORTS_RENDERING
58 auto dl_image = impeller::DlImageImpeller::Make(texture_);
59 image->set_image(dl_image);
60 auto wrapped = image->CreateOuterWrapping();
61 return wrapped;
62#else
63 return Dart_Null();
64#endif
65}
static sk_sp< GrTextureProxy > wrapped(skiatest::Reporter *reporter, GrRecordingContext *rContext, GrProxyProvider *proxyProvider, SkBackingFit fit)
static fml::RefPtr< CanvasImage > Create()
Definition image.h:28
static sk_sp< DlImageImpeller > Make(std::shared_ptr< Texture > texture, OwningContext owning_context=OwningContext::kIO)
DART_EXPORT Dart_Handle Dart_Null(void)
sk_sp< SkImage > image
Definition examples.cpp:29

◆ GetBytesPerTexel()

size_t flutter::gpu::Texture::GetBytesPerTexel ( )

Definition at line 47 of file texture.cc.

47 {
49 texture_->GetTextureDescriptor().format);
50}
constexpr size_t BytesPerPixelForPixelFormat(PixelFormat format)
Definition formats.h:448

◆ GetTexture()

std::shared_ptr< impeller::Texture > flutter::gpu::Texture::GetTexture ( )

Definition at line 26 of file texture.cc.

26 {
27 return texture_;
28}

◆ Overwrite()

bool flutter::gpu::Texture::Overwrite ( const tonic::DartByteData source_bytes)

Definition at line 35 of file texture.cc.

35 {
36 const uint8_t* data = static_cast<const uint8_t*>(source_bytes.data());
37 auto copy = std::vector<uint8_t>(data, data + source_bytes.length_in_bytes());
38 // Texture::SetContents is a bit funky right now. It takes a shared_ptr of a
39 // mapping and we're forced to copy here.
40 auto mapping = std::make_shared<fml::DataMapping>(copy);
41 if (!texture_->SetContents(mapping)) {
42 return false;
43 }
44 return true;
45}
const void * data() const
size_t length_in_bytes() const
Definition copy.py:1
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41

◆ SetCoordinateSystem()

void flutter::gpu::Texture::SetCoordinateSystem ( impeller::TextureCoordinateSystem  coordinate_system)

Definition at line 30 of file texture.cc.

31 {
32 texture_->SetCoordinateSystem(coordinate_system);
33}

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