fix save multiple frames

This commit is contained in:
2019-11-09 15:58:26 +01:00
parent 7b544522cf
commit 7ebc05327d
2 changed files with 4 additions and 2 deletions

View File

@@ -2207,7 +2207,7 @@ bool Canvas::project_save_thread(std::string file_path, bool show_progress)
int duration = m_layers[i]->frame_duration(fi); int duration = m_layers[i]->frame_duration(fi);
fwrite(&duration, sizeof(int), 1, fp); fwrite(&duration, sizeof(int), 1, fp);
} }
bool gpu = m_layers[i]->frame(fi).gpu_load();
m_layers[i]->optimize(fi); m_layers[i]->optimize(fi);
auto snap = m_layers[i]->snapshot(fi); auto snap = m_layers[i]->snapshot(fi);
for (int plane_index = 0; plane_index < 6; plane_index++) for (int plane_index = 0; plane_index < 6; plane_index++)
@@ -2240,6 +2240,8 @@ bool Canvas::project_save_thread(std::string file_path, bool show_progress)
pb->m_progress->SetWidthP(p); pb->m_progress->SetWidthP(p);
LOG("progress: %f", p); LOG("progress: %f", p);
} }
if (!gpu)
m_layers[i]->frame(fi).gpu_unload();
} }
} }

View File

@@ -31,7 +31,7 @@ LayerFrame& Layer::frame(int frame /*= -1*/)
{ {
if (frame == -1) if (frame == -1)
frame = m_frame_index; frame = m_frame_index;
return m_frames[m_frame_index]; return m_frames[frame];
} }
TextureCube Layer::gen_cube() TextureCube Layer::gen_cube()