mirror of https://github.com/odrling/Aegisub
Destroy the old video context when detaching video
It was previously not being destroyed until video was reattached, which wasted VRAM and caused problems on OS X. Originally committed to SVN as r6927.
This commit is contained in:
parent
f90d7a56fa
commit
2fb6b19e45
|
@ -66,6 +66,8 @@ DialogDetachedVideo::DialogDetachedVideo(agi::Context *context)
|
||||||
|
|
||||||
SetTitle(wxString::Format(_("Video: %s"), wxFileName(context->videoController->GetVideoName()).GetFullName()));
|
SetTitle(wxString::Format(_("Video: %s"), wxFileName(context->videoController->GetVideoName()).GetFullName()));
|
||||||
|
|
||||||
|
old_display->Unload();
|
||||||
|
|
||||||
// Video area;
|
// Video area;
|
||||||
VideoBox *videoBox = new VideoBox(this, true, context);
|
VideoBox *videoBox = new VideoBox(this, true, context);
|
||||||
context->videoDisplay->SetMinClientSize(old_display->GetClientSize());
|
context->videoDisplay->SetMinClientSize(old_display->GetClientSize());
|
||||||
|
@ -103,17 +105,16 @@ DialogDetachedVideo::DialogDetachedVideo(agi::Context *context)
|
||||||
DialogDetachedVideo::~DialogDetachedVideo() { }
|
DialogDetachedVideo::~DialogDetachedVideo() { }
|
||||||
|
|
||||||
void DialogDetachedVideo::OnClose(wxCloseEvent &evt) {
|
void DialogDetachedVideo::OnClose(wxCloseEvent &evt) {
|
||||||
// Deleting a GL context seems to invalidate ALL contexts, so we need to
|
|
||||||
// delete both the detached and undetached contexts here, then recreate
|
|
||||||
// the undetached one later
|
|
||||||
context->videoDisplay->Destroy();
|
context->videoDisplay->Destroy();
|
||||||
old_display->Reload();
|
|
||||||
|
|
||||||
context->videoDisplay = old_display;
|
context->videoDisplay = old_display;
|
||||||
context->videoSlider = old_slider;
|
context->videoSlider = old_slider;
|
||||||
|
|
||||||
OPT_SET("Video/Detached/Enabled")->SetBool(false);
|
OPT_SET("Video/Detached/Enabled")->SetBool(false);
|
||||||
|
|
||||||
|
if (context->videoController->IsLoaded())
|
||||||
|
context->videoController->JumpToFrame(context->videoController->GetFrameN());
|
||||||
|
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -420,11 +420,8 @@ Vector2D VideoDisplay::GetMousePosition() const {
|
||||||
return mouse_pos ? tool->ToScriptCoords(mouse_pos) : mouse_pos;
|
return mouse_pos ? tool->ToScriptCoords(mouse_pos) : mouse_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDisplay::Reload() {
|
void VideoDisplay::Unload() {
|
||||||
glContext.reset();
|
glContext.reset();
|
||||||
videoOut.reset();
|
videoOut.reset();
|
||||||
tool.reset();
|
tool.reset();
|
||||||
|
|
||||||
if (con->videoController->IsLoaded())
|
|
||||||
con->videoController->JumpToFrame(con->videoController->GetFrameN());
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,5 +171,5 @@ public:
|
||||||
bool ToolIsType(std::type_info const& type) const;
|
bool ToolIsType(std::type_info const& type) const;
|
||||||
|
|
||||||
/// Discard all OpenGL state
|
/// Discard all OpenGL state
|
||||||
void Reload();
|
void Unload();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue