mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[c] Additional #2325 work, precalculate the space needed for property IDs in animations
This commit is contained in:
parent
066a152756
commit
fed76c80c6
@ -37,18 +37,22 @@ _SP_ARRAY_IMPLEMENT_TYPE(spPropertyIdArray, spPropertyId)
|
||||
_SP_ARRAY_IMPLEMENT_TYPE(spTimelineArray, spTimeline *)
|
||||
|
||||
spAnimation *spAnimation_create(const char *name, spTimelineArray *timelines, float duration) {
|
||||
int i, n;
|
||||
spAnimation *self = NEW(spAnimation);
|
||||
MALLOC_STR(self->name, name);
|
||||
self->timelines = timelines != NULL ? timelines : spTimelineArray_create(1);
|
||||
timelines = self->timelines;
|
||||
self->timelineIds = spPropertyIdArray_create(16);
|
||||
for (i = 0, n = timelines->size; i < n; i++) {
|
||||
spPropertyIdArray_addAllValues(self->timelineIds, timelines->items[i]->propertyIds, 0,
|
||||
timelines->items[i]->propertyIdsCount);
|
||||
}
|
||||
self->duration = duration;
|
||||
return self;
|
||||
int i, n, totalCount = 0;
|
||||
spAnimation *self = NEW(spAnimation);
|
||||
MALLOC_STR(self->name, name);
|
||||
self->timelines = timelines != NULL ? timelines : spTimelineArray_create(1);
|
||||
timelines = self->timelines;
|
||||
|
||||
for (i = 0, n = timelines->size; i < n; i++)
|
||||
totalCount += timelines->items[i]->propertyIdsCount;
|
||||
self->timelineIds = spPropertyIdArray_create(totalCount);
|
||||
|
||||
for (i = 0, n = timelines->size; i < n; i++) {
|
||||
spPropertyIdArray_addAllValues(self->timelineIds, timelines->items[i]->propertyIds, 0,
|
||||
timelines->items[i]->propertyIdsCount);
|
||||
}
|
||||
self->duration = duration;
|
||||
return self;
|
||||
}
|
||||
|
||||
void spAnimation_dispose(spAnimation *self) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user