Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
flutter::Vertices Class Reference

#include <vertices.h>

Inheritance diagram for flutter::Vertices:
flutter::RefCountedDartWrappable< Vertices > fml::RefCountedThreadSafe< Vertices > tonic::DartWrappable fml::internal::RefCountedThreadSafeBase

Public Member Functions

 ~Vertices () override
 
const DlVerticesvertices () const
 
void dispose ()
 
- Public Member Functions inherited from flutter::RefCountedDartWrappable< Vertices >
virtual void RetainDartWrappableReference () const override
 
virtual void ReleaseDartWrappableReference () const override
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< Vertices >
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
 
virtual void RetainDartWrappableReference () const =0
 
virtual void ReleaseDartWrappableReference () const =0
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Static Public Member Functions

static bool init (Dart_Handle vertices_handle, DlVertexMode vertex_mode, Dart_Handle positions_handle, Dart_Handle texture_coordinates_handle, Dart_Handle colors_handle, Dart_Handle indices_handle)
 

Additional Inherited Members

- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields { kPeerIndex , kNumberOfNativeFields }
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< Vertices >
 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 15 of file vertices.h.

Constructor & Destructor Documentation

◆ ~Vertices()

flutter::Vertices::~Vertices ( )
override

Definition at line 19 of file vertices.cc.

19{}

Member Function Documentation

◆ dispose()

void flutter::Vertices::dispose ( )

Definition at line 83 of file vertices.cc.

83 {
84 vertices_.reset();
86}

◆ init()

bool flutter::Vertices::init ( Dart_Handle  vertices_handle,
DlVertexMode  vertex_mode,
Dart_Handle  positions_handle,
Dart_Handle  texture_coordinates_handle,
Dart_Handle  colors_handle,
Dart_Handle  indices_handle 
)
static

Definition at line 21 of file vertices.cc.

26 {
28
29 tonic::Float32List positions(positions_handle);
30 tonic::Float32List texture_coordinates(texture_coordinates_handle);
31 tonic::Int32List colors(colors_handle);
32 tonic::Uint16List indices(indices_handle);
33
34 if (!positions.data()) {
35 return false;
36 }
37
39 if (texture_coordinates.data()) {
41 }
42 if (colors.data()) {
44 }
45 DlVertices::Builder builder(vertex_mode, positions.num_elements() / 2, flags,
46 indices.num_elements());
47
48 if (!builder.is_valid()) {
49 return false;
50 }
51
52 // positions are required for SkVertices::Builder
53 builder.store_vertices(positions.data());
54
55 if (texture_coordinates.data()) {
56 // SkVertices::Builder assumes equal numbers of elements
57 FML_DCHECK(positions.num_elements() == texture_coordinates.num_elements());
58 builder.store_texture_coordinates(texture_coordinates.data());
59 }
60
61 if (colors.data()) {
62 // SkVertices::Builder assumes equal numbers of elements
63 FML_DCHECK(positions.num_elements() / 2 == colors.num_elements());
64 builder.store_colors(reinterpret_cast<const SkColor*>(colors.data()));
65 }
66
67 if (indices.data() && indices.num_elements() > 0) {
68 builder.store_indices(indices.data());
69 }
70
71 positions.Release();
72 texture_coordinates.Release();
73 colors.Release();
74 indices.Release();
75
76 auto vertices = fml::MakeRefCounted<Vertices>();
77 vertices->vertices_ = builder.build();
78 vertices->AssociateWithDartWrapper(vertices_handle);
79
80 return true;
81}
uint32_t SkColor
Definition: SkColor.h:37
static constexpr Flags kHasColors
Definition: dl_vertices.h:98
static constexpr Flags kHasTextureCoordinates
Definition: dl_vertices.h:97
static void ThrowIfUIOperationsProhibited()
const DlVertices * vertices() const
Definition: vertices.h:29
FlutterSemanticsFlag flags
#define FML_DCHECK(condition)
Definition: logging.h:103
PODArray< SkColor > colors
Definition: SkRecords.h:276
DlVertices::Builder Builder

◆ vertices()

const DlVertices * flutter::Vertices::vertices ( ) const
inline

Definition at line 29 of file vertices.h.

29{ return vertices_.get(); }

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