The bins vector is not a class member anymore, it's really unsafe to store it like that without proper updates. Also unnecessary.

This commit is contained in:
Relintai 2019-10-21 23:22:12 +02:00
parent 37043e7b2d
commit 87a80781a0
2 changed files with 5 additions and 9 deletions

View File

@ -181,8 +181,6 @@ int TexturePacker::get_texture_count() {
}
void TexturePacker::clear() {
_bins.clear();
for (int i = 0; i < _rects.size(); ++i) {
rect_xywhf *r = _rects.get(i);
@ -211,15 +209,15 @@ int TexturePacker::get_generated_texture_count() {
}
void TexturePacker::merge() {
_bins.clear();
std::vector<bin> bins;
if (pack(_rects.ptr(), _rects.size(), _max_atlas_size, false, _bins)) {
if (pack(_rects.ptr(), _rects.size(), _max_atlas_size, false, bins)) {
_generated_textures.clear();
_generated_textures.resize(_bins.size());
_generated_textures.resize(bins.size());
for (int i = 0; i < _bins.size(); ++i) {
bin b = _bins[i];
for (int i = 0; i < bins.size(); ++i) {
bin b = bins[i];
PoolByteArray data;
data.resize(b.size.w * b.size.h * 4);

View File

@ -51,8 +51,6 @@ private:
int _max_atlas_size;
bool _keep_original_atlases;
std::vector<bin> _bins;
Vector<rect_xywhf *> _rects;
Vector<Ref<ImageTexture> > _generated_textures;
};