8 #ifndef SkVertices_DEFINED
9 #define SkVertices_DEFINED
23 kTriangles_VertexMode,
24 kTriangleStrip_VertexMode,
25 kTriangleFan_VertexMode,
37 const uint16_t indices[]);
43 return MakeCopy(mode, vertexCount, positions, texs, colors, 0,
nullptr);
49 kHasTexCoords_BuilderFlag = 1 << 0,
50 kHasColors_BuilderFlag = 1 << 1,
54 Builder(VertexMode mode,
int vertexCount,
int indexCount, uint32_t flags);
56 bool isValid()
const {
return fVertices !=
nullptr; }
59 int vertexCount()
const;
60 int indexCount()
const;
70 Builder(VertexMode mode,
int vertexCount,
int indexCount,
const Sizes&);
72 void init(VertexMode mode,
int vertexCount,
int indexCount,
const Sizes&);
80 uint32_t uniqueID()
const {
return fUniqueID; }
81 VertexMode mode()
const {
return fMode; }
82 const SkRect& bounds()
const {
return fBounds; }
84 bool hasColors()
const {
return SkToBool(this->colors()); }
85 bool hasTexCoords()
const {
return SkToBool(this->texCoords()); }
86 bool hasIndices()
const {
return SkToBool(this->indices()); }
88 int vertexCount()
const {
return fVertexCnt; }
89 const SkPoint* positions()
const {
return fPositions; }
90 const SkPoint* texCoords()
const {
return fTexs; }
91 const SkColor* colors()
const {
return fColors; }
93 int indexCount()
const {
return fIndexCnt; }
94 const uint16_t* indices()
const {
return fIndices; }
97 size_t approximateSize()
const;
116 void operator delete(
void* p) { ::operator
delete(p); }
sk_sp< SkData > encode() const
Pack the vertices object into a byte buffer.
static sk_sp< SkVertices > MakeCopy(VertexMode mode, int vertexCount, const SkPoint positions[], const SkPoint texs[], const SkColor colors[], int indexCount, const uint16_t indices[])
Create a vertices by copying the specified arrays.
Definition: SkPoint.h:156
#define SkToBool(cond)
Returns 0 or 1 based on the condition.
Definition: SkTypes.h:227
static sk_sp< SkVertices > Decode(const void *buffer, size_t length)
Recreate a vertices from a buffer previously created by calling encode().
An immutable set of vertex data that can be used with SkCanvas::drawVertices.
Definition: SkVertices.h:20
uint32_t SkColor
32 bit ARGB color value, not premultiplied.
Definition: SkColor.h:28
Definition: SkVertices.h:52
Definition: SkRefCnt.h:209
Types and macros for colors.