mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[c] Sanity for vertexCount.
This commit is contained in:
parent
11941cfe0b
commit
942cf272fa
@ -494,7 +494,7 @@ static spAnimation* _spSkeletonJson_readAnimation (spSkeletonJson* self, Json* r
|
||||
return animation;
|
||||
}
|
||||
|
||||
static void _readVertices(spSkeletonJson* self, Json* attachmentMap, spVertexAttachment* attachment, int verticesLength) {
|
||||
static void _readVertices (spSkeletonJson* self, Json* attachmentMap, spVertexAttachment* attachment, int verticesLength) {
|
||||
Json* entry;
|
||||
float* vertices;
|
||||
int i, b, w, nn, entrySize;
|
||||
@ -511,7 +511,7 @@ static void _readVertices(spSkeletonJson* self, Json* attachmentMap, spVertexAtt
|
||||
if (self->scale != 1)
|
||||
for (i = 0; i < entrySize; ++i)
|
||||
vertices[i] *= self->scale;
|
||||
attachment->verticesCount = verticesLength;
|
||||
attachment->verticesCount = verticesLength >> 1;
|
||||
attachment->vertices = vertices;
|
||||
|
||||
attachment->bonesCount = 0;
|
||||
@ -944,20 +944,17 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
|
||||
}
|
||||
case SP_ATTACHMENT_BOUNDING_BOX: {
|
||||
spBoundingBoxAttachment* box = SUB_CAST(spBoundingBoxAttachment, attachment);
|
||||
int vertexCount = Json_getInt(attachmentMap, "vertexCount", 0) << 1;
|
||||
_readVertices(self, attachmentMap, SUPER(box), vertexCount);
|
||||
box->super.verticesCount = vertexCount;
|
||||
int vertexCount = Json_getInt(attachmentMap, "vertexCount", 0);
|
||||
_readVertices(self, attachmentMap, SUPER(box), vertexCount << 1);
|
||||
spAttachmentLoader_configureAttachment(self->attachmentLoader, attachment);
|
||||
break;
|
||||
}
|
||||
case SP_ATTACHMENT_PATH: {
|
||||
spPathAttachment* path = SUB_CAST(spPathAttachment, attachment);
|
||||
int vertexCount = 0;
|
||||
int vertexCount = Json_getInt(attachmentMap, "vertexCount", 0);
|
||||
path->closed = Json_getInt(attachmentMap, "closed", 0);
|
||||
path->constantSpeed = Json_getInt(attachmentMap, "constantSpeed", 1);
|
||||
vertexCount = Json_getInt(attachmentMap, "vertexCount", 0);
|
||||
_readVertices(self, attachmentMap, SUPER(path), vertexCount << 1);
|
||||
path->super.verticesCount = vertexCount;
|
||||
|
||||
path->lengthsLength = vertexCount / 3;
|
||||
path->lengths = MALLOC(float, path->lengthsLength);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user