viewerglwidget: fix bug that didn't clear the viewport correctly on empty frames

This commit is contained in:
itsmattkc
2020-02-19 11:34:21 +11:00
parent fe1f7626d1
commit 4c4b91afd6
2 changed files with 9 additions and 2 deletions
+7 -2
View File
@@ -38,7 +38,8 @@ bool ViewerGLWidget::nouveau_check_done_ = false;
ViewerGLWidget::ViewerGLWidget(QWidget *parent) :
QOpenGLWidget(parent),
ocio_lut_(0),
color_manager_(nullptr)
color_manager_(nullptr),
has_image_(false)
{
setContextMenuPolicy(Qt::CustomContextMenu);
}
@@ -78,6 +79,8 @@ void ViewerGLWidget::SetImage(const QString &fn)
{
OIIO::ImageBuf* in;
has_image_ = false;
if (fn.isEmpty()) {
// Backend had no filename
goto end;
@@ -109,6 +112,8 @@ void ViewerGLWidget::SetImage(const QString &fn)
doneCurrent();
has_image_ = true;
} else {
qWarning() << "OIIO Error:" << OIIO::geterror().c_str();
}
@@ -201,7 +206,7 @@ void ViewerGLWidget::paintGL()
f->glClear(GL_COLOR_BUFFER_BIT);
// We only draw if we have a pipeline
if (!pipeline_ || !texture_.IsCreated()) {
if (!has_image_ || !pipeline_ || !texture_.IsCreated()) {
return;
}
+2
View File
@@ -195,6 +195,8 @@ private:
static bool nouveau_check_done_;
#endif
bool has_image_;
private slots:
/**
* @brief Slot to connect just before the OpenGL context is destroyed to clean up resources