Skip rendering when we're minimized.

This commit is contained in:
Geenz 2014-03-13 11:41:15 -04:00
parent d580f177a3
commit 2e119fa0fe

View file

@ -11,6 +11,7 @@
#include "GLCanvas.h" #include "GLCanvas.h"
#include <QMimeData> #include <QMimeData>
#include <QUrl> #include <QUrl>
#include <QMainWindow>
GLCanvas::GLCanvas() : QGLWidget(QGLFormat(QGL::NoDepthBuffer, QGL::NoStencilBuffer)), _throttleRendering(false), _idleRenderInterval(100) { GLCanvas::GLCanvas() : QGLWidget(QGLFormat(QGL::NoDepthBuffer, QGL::NoStencilBuffer)), _throttleRendering(false), _idleRenderInterval(100) {
} }
@ -24,7 +25,7 @@ void GLCanvas::initializeGL() {
} }
void GLCanvas::paintGL() { void GLCanvas::paintGL() {
if (!_throttleRendering) { if (!_throttleRendering && !Application::getInstance()->getWindow()->isMinimized()) {
Application::getInstance()->paintGL(); Application::getInstance()->paintGL();
} }
} }
@ -78,10 +79,11 @@ void GLCanvas::activeChanged() {
} }
} }
void GLCanvas::throttleRender() void GLCanvas::throttleRender() {
{
_frameTimer.start(_idleRenderInterval); _frameTimer.start(_idleRenderInterval);
Application::getInstance()->paintGL(); if (!Application::getInstance()->getWindow()->isMinimized()) {
Application::getInstance()->paintGL();
}
} }
int updateTime = 0; int updateTime = 0;