Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
flutter::DlVertices Class Reference

Holds all of the data (both required and optional) for a DisplayList drawVertices call. More...

#include <dl_vertices.h>

Classes

class  Builder
 A utility class to build up a |DlVertices| object one set of data at a time. More...
 

Public Member Functions

size_t size () const
 Returns the size of the object including all of the inlined data.
 
SkRect bounds () const
 Returns the bounds of the vertices.
 
DlVertexMode mode () const
 
int vertex_count () const
 
const SkPointvertices () const
 Returns a pointer to the vertex information. Should be non-null.
 
const SkPointtexture_coordinates () const
 
const DlColorcolors () const
 
int index_count () const
 
const uint16_t * indices () const
 
bool operator== (DlVertices const &other) const
 
bool operator!= (DlVertices const &other) const
 

Static Public Member Functions

static std::shared_ptr< DlVerticesMake (DlVertexMode mode, int vertex_count, const SkPoint vertices[], const SkPoint texture_coordinates[], const DlColor colors[], int index_count=0, const uint16_t indices[]=nullptr)
 Constructs a DlVector with compact inline storage for all of its required and optional lists of data.
 

Friends

class DisplayListBuilder
 

Detailed Description

Holds all of the data (both required and optional) for a DisplayList drawVertices call.

There are 4 main pices of data:

Note that each vertex is mapped to exactly 1 texture_coordinate and color even if the DlVertexMode or indices specify that it contributes to more than one output triangle.

Definition at line 71 of file dl_vertices.h.

Member Function Documentation

◆ bounds()

SkRect flutter::DlVertices::bounds ( ) const
inline

Returns the bounds of the vertices.

Definition at line 194 of file dl_vertices.h.

194{ return bounds_; }

◆ colors()

const DlColor * flutter::DlVertices::colors ( ) const
inline

Returns a pointer to the vertex colors or null if none were provided.

Definition at line 217 of file dl_vertices.h.

217 {
218 return static_cast<const DlColor*>(pod(colors_offset_));
219 }

◆ index_count()

int flutter::DlVertices::index_count ( ) const
inline

Returns a pointer to the count of vertex indices or 0 if none were provided.

Definition at line 223 of file dl_vertices.h.

223{ return index_count_; }

◆ indices()

const uint16_t * flutter::DlVertices::indices ( ) const
inline

Returns a pointer to the vertex indices or null if none were provided.

Definition at line 227 of file dl_vertices.h.

227 {
228 return static_cast<const uint16_t*>(pod(indices_offset_));
229 }

◆ Make()

std::shared_ptr< DlVertices > flutter::DlVertices::Make ( DlVertexMode  mode,
int  vertex_count,
const SkPoint  vertices[],
const SkPoint  texture_coordinates[],
const DlColor  colors[],
int  index_count = 0,
const uint16_t  indices[] = nullptr 
)
static

Constructs a DlVector with compact inline storage for all of its required and optional lists of data.

Vertices are always required. Optional texture coordinates and optional colors are stored if the arguments are non-null. Optional indices will be stored iff the array argument is non-null and the index_count is positive (>0).

Definition at line 39 of file dl_vertices.cc.

46 {
47 if (!vertices || vertex_count <= 0) {
48 vertex_count = 0;
49 texture_coordinates = nullptr;
50 colors = nullptr;
51 }
52 if (!indices || index_count <= 0) {
53 index_count = 0;
54 indices = nullptr;
55 }
56
58 FML_DCHECK(!flags.has_texture_coordinates);
59 FML_DCHECK(!flags.has_colors);
62 }
63 if (colors) {
65 }
67
68 builder.store_vertices(vertices);
70 builder.store_texture_coordinates(texture_coordinates);
71 }
72 if (colors) {
73 builder.store_colors(colors);
74 }
75 if (indices) {
76 builder.store_indices(indices);
77 }
78
79 return builder.build();
80}
static constexpr Flags kHasColors
Definition dl_vertices.h:98
static constexpr Flags kHasTextureCoordinates
Definition dl_vertices.h:97
const DlColor * colors() const
int vertex_count() const
DlVertexMode mode() const
int index_count() const
const SkPoint * vertices() const
Returns a pointer to the vertex information. Should be non-null.
const uint16_t * indices() const
const SkPoint * texture_coordinates() const
FlutterSemanticsFlag flags
#define FML_DCHECK(condition)
Definition logging.h:103
DlVertices::Builder Builder

◆ mode()

DlVertexMode flutter::DlVertices::mode ( ) const
inline

Returns the vertex mode that defines how the vertices (or the indices) are turned into triangles.

Definition at line 198 of file dl_vertices.h.

198{ return mode_; }

◆ operator!=()

bool flutter::DlVertices::operator!= ( DlVertices const &  other) const
inline

Definition at line 233 of file dl_vertices.h.

233{ return !(*this == other); }

◆ operator==()

bool flutter::DlVertices::operator== ( DlVertices const &  other) const

Definition at line 179 of file dl_vertices.cc.

179 {
180 auto lists_equal = [](auto* a, auto* b, int count) {
181 if (a == nullptr || b == nullptr) {
182 return a == b;
183 }
184 for (int i = 0; i < count; i++) {
185 if (a[i] != b[i]) {
186 return false;
187 }
188 }
189 return true;
190 };
191 return //
192 mode_ == other.mode_ && //
193 vertex_count_ == other.vertex_count_ && //
194 lists_equal(vertices(), other.vertices(), vertex_count_) && //
195 lists_equal(texture_coordinates(), other.texture_coordinates(), //
196 vertex_count_) && //
197 lists_equal(colors(), other.colors(), vertex_count_) && //
198 index_count_ == other.index_count_ && //
199 lists_equal(indices(), other.indices(), index_count_);
200}
int count
static bool b
struct MyStruct a[10]

◆ size()

size_t flutter::DlVertices::size ( ) const

Returns the size of the object including all of the inlined data.

Definition at line 82 of file dl_vertices.cc.

82 {
83 return bytes_needed(vertex_count_,
84 {{texture_coordinates_offset_ > 0, colors_offset_ > 0}},
85 index_count_);
86}
static size_t bytes_needed(int vertex_count, Flags flags, int index_count)

◆ texture_coordinates()

const SkPoint * flutter::DlVertices::texture_coordinates ( ) const
inline

Returns a pointer to the vertex texture coordinate or null if none were provided.

Definition at line 211 of file dl_vertices.h.

211 {
212 return static_cast<const SkPoint*>(pod(texture_coordinates_offset_));
213 }

◆ vertex_count()

int flutter::DlVertices::vertex_count ( ) const
inline

Returns the number of vertices, which also applies to the number of texture coordinate and colors if they are provided.

Definition at line 202 of file dl_vertices.h.

202{ return vertex_count_; }

◆ vertices()

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

Returns a pointer to the vertex information. Should be non-null.

Definition at line 205 of file dl_vertices.h.

205 {
206 return static_cast<const SkPoint*>(pod(vertices_offset_));
207 }

Friends And Related Symbol Documentation

◆ DisplayListBuilder

friend class DisplayListBuilder
friend

Definition at line 282 of file dl_vertices.h.


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