aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkVertices.h
diff options
context:
space:
mode:
authorGravatar Ruiqi Mao <ruiqimao@google.com>2018-07-03 11:38:15 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-03 16:07:44 +0000
commitb6307340e8a6a9d3a7517def7f5eaaadffd07d14 (patch)
tree7337790911d8e791d495f37f637382f3fb5acad3 /include/core/SkVertices.h
parentb7b73f5bbec55020c873cab6f4e11444b4011c34 (diff)
added skeletal animation support to GPU backend
added caching of SkVertices Docs-Preview: https://skia.org/?cl=138596 Bug: skia: Change-Id: Ia750f55f5f6d0de250d9e9c5619f4d1ac856f9f5 Reviewed-on: https://skia-review.googlesource.com/138596 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Ruiqi Mao <ruiqimao@google.com>
Diffstat (limited to 'include/core/SkVertices.h')
-rw-r--r--include/core/SkVertices.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/include/core/SkVertices.h b/include/core/SkVertices.h
index 6c4fb390d0..5208bfb442 100644
--- a/include/core/SkVertices.h
+++ b/include/core/SkVertices.h
@@ -55,14 +55,16 @@ public:
const BoneIndices boneIndices[],
const BoneWeights boneWeights[],
int indexCount,
- const uint16_t indices[]);
+ const uint16_t indices[],
+ bool isVolatile = true);
static sk_sp<SkVertices> MakeCopy(VertexMode mode, int vertexCount,
const SkPoint positions[],
const SkPoint texs[],
const SkColor colors[],
const BoneIndices boneIndices[],
- const BoneWeights boneWeights[]) {
+ const BoneWeights boneWeights[],
+ bool isVolatile = true) {
return MakeCopy(mode,
vertexCount,
positions,
@@ -71,7 +73,8 @@ public:
boneIndices,
boneWeights,
0,
- nullptr);
+ nullptr,
+ isVolatile);
}
static sk_sp<SkVertices> MakeCopy(VertexMode mode, int vertexCount,
@@ -79,7 +82,8 @@ public:
const SkPoint texs[],
const SkColor colors[],
int indexCount,
- const uint16_t indices[]) {
+ const uint16_t indices[],
+ bool isVolatile = true) {
return MakeCopy(mode,
vertexCount,
positions,
@@ -88,14 +92,16 @@ public:
nullptr,
nullptr,
indexCount,
- indices);
+ indices,
+ isVolatile);
}
static sk_sp<SkVertices> MakeCopy(VertexMode mode, int vertexCount,
const SkPoint positions[],
const SkPoint texs[],
- const SkColor colors[]) {
- return MakeCopy(mode, vertexCount, positions, texs, colors, nullptr, nullptr);
+ const SkColor colors[],
+ bool isVolatile = true) {
+ return MakeCopy(mode, vertexCount, positions, texs, colors, nullptr, nullptr, isVolatile);
}
struct Sizes;
@@ -104,6 +110,7 @@ public:
kHasTexCoords_BuilderFlag = 1 << 0,
kHasColors_BuilderFlag = 1 << 1,
kHasBones_BuilderFlag = 1 << 2,
+ kIsVolatile_BuilderFlag = 1 << 3,
};
class Builder {
public:
@@ -114,6 +121,7 @@ public:
// if the builder is invalid, these will return 0
int vertexCount() const;
int indexCount() const;
+ bool isVolatile() const;
SkPoint* positions();
SkPoint* texCoords(); // returns null if there are no texCoords
SkColor* colors(); // returns null if there are no colors
@@ -125,9 +133,9 @@ public:
sk_sp<SkVertices> detach();
private:
- Builder(VertexMode mode, int vertexCount, int indexCount, const Sizes&);
+ Builder(VertexMode mode, int vertexCount, int indexCount, bool isVolatile, const Sizes&);
- void init(VertexMode mode, int vertexCount, int indexCount, const Sizes&);
+ void init(VertexMode mode, int vertexCount, int indexCount, bool isVolatile, const Sizes&);
// holds a partially complete object. only completed in detach()
sk_sp<SkVertices> fVertices;
@@ -158,6 +166,8 @@ public:
int indexCount() const { return fIndexCnt; }
const uint16_t* indices() const { return fIndices; }
+ bool isVolatile() const { return fIsVolatile; }
+
// returns approximate byte size of the vertices object
size_t approximateSize() const;
@@ -199,6 +209,8 @@ private:
int fVertexCnt;
int fIndexCnt;
+ bool fIsVolatile;
+
VertexMode fMode;
// below here is where the actual array data is stored.
};