5#ifndef FLUTTER_DISPLAY_LIST_DL_VERTICES_H_
6#define FLUTTER_DISPLAY_LIST_DL_VERTICES_H_
113 bool is_valid()
const {
return vertices_ !=
nullptr; }
163 std::shared_ptr<DlVertices>
build();
166 std::shared_ptr<DlVertices> vertices_;
167 bool needs_vertices_ =
true;
168 bool needs_texture_coords_;
171 bool needs_bounds_ =
true;
185 const DlPoint texture_coordinates[],
188 const uint16_t
indices[] =
nullptr,
189 const DlRect* bounds =
nullptr);
207 return static_cast<const DlPoint*
>(pod(vertices_offset_));
213 return static_cast<const DlPoint*
>(pod(texture_coordinates_offset_));
219 return static_cast<const DlColor*
>(pod(colors_offset_));
229 return static_cast<const uint16_t*
>(pod(indices_offset_));
242 const DlPoint texture_coordinates[],
246 const DlRect* bounds =
nullptr);
252 Builder::Flags flags,
264 size_t vertices_offset_;
265 size_t texture_coordinates_offset_;
266 size_t colors_offset_;
269 size_t indices_offset_;
273 const void* pod(
int offset)
const {
277 const void*
base =
static_cast<const void*
>(
this);
278 return static_cast<const char*
>(
base) + offset;
A utility class to build up a |DlVertices| object one set of data at a time.
void store_vertices(const DlPoint vertices[])
Copies the indicated list of points as vertices.
void store_indices(const uint16_t indices[])
Copies the indicated list of 16-bit indices as vertex indices.
static constexpr Flags kNone
bool is_valid() const
Returns true iff the underlying object was successfully allocated.
void store_texture_coordinates(const DlPoint points[])
Copies the indicated list of points as texture coordinates.
void store_bounds(DlRect bounds)
Overwrite the internal bounds with a precomputed bounding rect.
std::shared_ptr< DlVertices > build()
Finalizes and the constructed DlVertices object.
static constexpr Flags kHasColors
void store_colors(const DlColor colors[])
Copies the indicated list of colors as vertex colors.
static constexpr Flags kHasTextureCoordinates
Holds all of the data (both required and optional) for a DisplayList drawVertices call.
static std::shared_ptr< DlVertices > Make(DlVertexMode mode, int vertex_count, const DlPoint vertices[], const DlPoint texture_coordinates[], const DlColor colors[], int index_count=0, const uint16_t indices[]=nullptr, const DlRect *bounds=nullptr)
Constructs a DlVector with compact inline storage for all of its required and optional lists of data.
DlRect GetBounds() const
Returns the bounds of the vertices.
const DlPoint * texture_coordinate_data() const
const DlPoint * vertex_data() const
Returns a pointer to the vertex information. Should be non-null.
const DlColor * colors() const
DlVertexMode mode() const
bool operator==(DlVertices const &other) const
size_t size() const
Returns the size of the object including all of the inlined data.
const uint16_t * indices() const
DlVertexMode
Defines the way in which the vertices of a DlVertices object are separated into triangles into which ...
@ kTriangles
The vertices are taken 3 at a time to form a triangle.
std::vector< Point > points
flags to indicate/promise which of the optional texture coordinates or colors will be supplied during...
Flags operator|(const Flags &rhs) const
unsigned has_texture_coordinates
Flags & operator|=(const Flags &rhs)