mirror of https://github.com/odrling/Aegisub
Fix opengl errors when the file is modified with a minimized detached video window open
Originally committed to SVN as r6257.
This commit is contained in:
parent
93c96d1f82
commit
cd48b711b4
|
@ -140,10 +140,17 @@ VideoDisplay::~VideoDisplay () {
|
|||
}
|
||||
|
||||
bool VideoDisplay::InitContext() {
|
||||
if (!IsShownOnScreen()) return false;
|
||||
if (!glContext.get()) {
|
||||
if (!IsShownOnScreen())
|
||||
return false;
|
||||
|
||||
// If this display is in a minimized detached dialog IsShownOnScreen will
|
||||
// return true, but the client size is guaranteed to be 0
|
||||
if (GetClientSize() == wxSize(0, 0))
|
||||
return false;
|
||||
|
||||
if (!glContext)
|
||||
glContext.reset(new wxGLContext(this));
|
||||
}
|
||||
|
||||
SetCurrent(*glContext.get());
|
||||
return true;
|
||||
}
|
||||
|
@ -183,7 +190,8 @@ void VideoDisplay::OnVideoOpen() {
|
|||
}
|
||||
|
||||
void VideoDisplay::Render() try {
|
||||
if (!InitContext() || !con->videoController->IsLoaded() || !videoOut) return;
|
||||
if (!InitContext() || !con->videoController->IsLoaded() || !videoOut)
|
||||
return;
|
||||
|
||||
if (!viewport_height || !viewport_width)
|
||||
UpdateSize();
|
||||
|
|
Loading…
Reference in New Issue