improve layer history, fix doc open

This commit is contained in:
2019-06-19 23:05:14 +02:00
parent 9ad3c351ce
commit dabfedb089
3 changed files with 75 additions and 7 deletions

View File

@@ -2500,15 +2500,15 @@ bool Canvas::project_open_thread(std::string file_path)
resize(m_width, m_height);
App::I.async_end();
std::vector<std::shared_ptr<Layer>> tmp_layers;
std::vector<std::shared_ptr<Layer>> tmp_layers(n_layers);
for (int i = 0; i < n_layers; i++)
{
int n_order;
fread(&n_order, sizeof(int), 1, fp);
tmp_layers.push_back(std::make_unique<Layer>());
auto& layer = tmp_layers.back();
tmp_layers[n_order] = std::make_unique<Layer>();
auto& layer = tmp_layers[n_order];
fread(&layer->m_opacity, sizeof(float), 1, fp);
@@ -2567,9 +2567,9 @@ bool Canvas::project_open_thread(std::string file_path)
}
App::I.async_start();
tmp_layers.back()->create(m_width, m_height, name.c_str());
tmp_layers.back()->clear({ 0, 0, 0, 0 });
tmp_layers.back()->restore(snap);
layer->create(m_width, m_height, name.c_str());
layer->clear({ 0, 0, 0, 0 });
layer->restore(snap);
App::I.async_end();
}