summaryrefslogtreecommitdiffstats
path: root/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-01-27 18:12:44 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-02-01 08:49:26 +0000
commit920472c85f6a5cd96344c28dbba0f199c34c6c10 (patch)
tree681cfae36f9df7406459f3509a384eb0b5a290ab /tests/manual/qopenglwidget/openglwidget/openglwidget.cpp
parent758b7b0d88742db7db223a69d689e235e6272f85 (diff)
Fix clipRect interpretation in composited backingstores
Empty clipRect means "clip away completely", not "no clipping". Task-number: QTBUG-50719 Change-Id: I6a9dd66130716a921fe9fc245582274e3c9718fe Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'tests/manual/qopenglwidget/openglwidget/openglwidget.cpp')
-rw-r--r--tests/manual/qopenglwidget/openglwidget/openglwidget.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp b/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp
index 4d2463b84d3..95e2b314050 100644
--- a/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp
+++ b/tests/manual/qopenglwidget/openglwidget/openglwidget.cpp
@@ -78,6 +78,8 @@ public:
int m_interval;
QVector3D m_rotAxis;
+
+ float clearColor[3];
};
@@ -85,6 +87,7 @@ OpenGLWidget::OpenGLWidget(int interval, const QVector3D &rotAxis, QWidget *pare
: QOpenGLWidget(parent)
{
d.reset(new OpenGLWidgetPrivate(this));
+ d->clearColor[0] = d->clearColor[1] = d->clearColor[2] = 0.0f;
d->m_interval = interval;
d->m_rotAxis = rotAxis;
if (interval > 0) {
@@ -151,7 +154,7 @@ void OpenGLWidgetPrivate::render()
const qreal retinaScale = q->devicePixelRatio();
glViewport(0, 0, width() * retinaScale, height() * retinaScale);
- glClearColor(0.0, 0.0, 0.0, 1.0);
+ glClearColor(clearColor[0], clearColor[1], clearColor[2], 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
m_program->bind();
@@ -194,3 +197,10 @@ void OpenGLWidgetPrivate::render()
if (m_interval <= 0)
q->update();
}
+
+void OpenGLWidget::setClearColor(const float *c)
+{
+ d->clearColor[0] = c[0];
+ d->clearColor[1] = c[1];
+ d->clearColor[2] = c[2];
+}