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()));
|
||||
|
||||
old_display->Unload();
|
||||
|
||||
// Video area;
|
||||
VideoBox *videoBox = new VideoBox(this, true, context);
|
||||
context->videoDisplay->SetMinClientSize(old_display->GetClientSize());
|
||||
|
@ -103,17 +105,16 @@ DialogDetachedVideo::DialogDetachedVideo(agi::Context *context)
|
|||
DialogDetachedVideo::~DialogDetachedVideo() { }
|
||||
|
||||
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();
|
||||
old_display->Reload();
|
||||
|
||||
context->videoDisplay = old_display;
|
||||
context->videoSlider = old_slider;
|
||||
|
||||
OPT_SET("Video/Detached/Enabled")->SetBool(false);
|
||||
|
||||
if (context->videoController->IsLoaded())
|
||||
context->videoController->JumpToFrame(context->videoController->GetFrameN());
|
||||
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
|
|
|
@ -420,11 +420,8 @@ Vector2D VideoDisplay::GetMousePosition() const {
|
|||
return mouse_pos ? tool->ToScriptCoords(mouse_pos) : mouse_pos;
|
||||
}
|
||||
|
||||
void VideoDisplay::Reload() {
|
||||
void VideoDisplay::Unload() {
|
||||
glContext.reset();
|
||||
videoOut.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;
|
||||
|
||||
/// Discard all OpenGL state
|
||||
void Reload();
|
||||
void Unload();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue