free resources on app destruction
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user