mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Fix the inconsistent behavior between Spine vector's setSize and std::vector's resize, which causes the Spine vector to allocate additional space upfront. (#2830)
This commit is contained in:
parent
123426d3e3
commit
7fd1e5340c
@ -77,7 +77,11 @@ namespace spine {
|
||||
size_t oldSize = _size;
|
||||
_size = newSize;
|
||||
if (_capacity < newSize) {
|
||||
_capacity = (int) (_size * 1.75f);
|
||||
if (_capacity == 0) {
|
||||
_capacity = _size;
|
||||
} else {
|
||||
_capacity = (int) (_size * 1.75f);
|
||||
}
|
||||
if (_capacity < 8) _capacity = 8;
|
||||
_buffer = spine::SpineExtension::realloc<T>(_buffer, _capacity, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user