free resources on app destruction

This commit is contained in:
2019-02-24 12:31:53 +01:00
parent 420e0a8c2a
commit 3d1412aee2
13 changed files with 66 additions and 6 deletions

View File

@@ -1079,6 +1079,22 @@ void Canvas::resize(int width, int height)
m_smask.create(width, height, "mask");
m_unsaved = true;
}
void Canvas::destroy()
{
for (int i = 0; i < 6; i++)
{
m_tmp[i].destroy();
m_tmp_dual[i].destroy();
m_tex[i].destroy();
m_tex2[i].destroy();
}
for (auto& l : m_layers)
l.destroy();
m_smask.destroy();
m_mixer.destroy();
}
bool Canvas::create(int width, int height)
{
m_width = width;
@@ -1097,7 +1113,7 @@ bool Canvas::create(int width, int height)
m_tex[i].create(width, height, GL_RGBA32F);
m_sampler_brush.create(GL_LINEAR, GL_CLAMP_TO_BORDER);
#endif
m_tex2[i].create(width, height, GL_RGBA8); // TODO: destroy before recreating
m_tex2[i].create(width, height, GL_RGBA8);
}
m_sampler.create(GL_NEAREST);
m_sampler.create(GL_LINEAR);