Fixed tst_QGL::partialGLWidgetUpdates.

Change-Id: Ie37051e28b199b5d159f5be05be41efbd17fdf08
Reviewed-on: http://codereview.qt.nokia.com/4273
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
This commit is contained in:
Samuel Rødal 2011-09-06 16:44:59 +02:00 committed by Gunnar Sletta
parent 3883b4f5b1
commit 6119d12d7d
3 changed files with 34 additions and 13 deletions

View File

@ -125,15 +125,43 @@ QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const
class QEGLXcbPlatformContext : public QEGLPlatformContext
{
public:
QEGLXcbPlatformContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share, EGLDisplay display)
QEGLXcbPlatformContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share,
EGLDisplay display, QXcbConnection *c)
: QEGLPlatformContext(glFormat, share, display)
, m_connection(c)
{
Q_XCB_NOOP(m_connection);
}
void swapBuffers(QPlatformSurface *surface)
{
Q_XCB_NOOP(m_connection);
QEGLPlatformContext::swapBuffers(surface);
Q_XCB_NOOP(m_connection);
}
bool makeCurrent(QPlatformSurface *surface)
{
Q_XCB_NOOP(m_connection);
bool ret = QEGLPlatformContext::makeCurrent(surface);
Q_XCB_NOOP(m_connection);
return ret;
}
void doneCurrent()
{
Q_XCB_NOOP(m_connection);
QEGLPlatformContext::doneCurrent();
Q_XCB_NOOP(m_connection);
}
EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface)
{
return static_cast<QXcbWindow *>(surface)->eglSurface()->surface();
}
private:
QXcbConnection *m_connection;
};
#endif
@ -143,7 +171,8 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont
#if defined(XCB_USE_GLX)
return new QGLXContext(screen, context->format(), context->shareHandle());
#elif defined(XCB_USE_EGL)
return new QEGLXcbPlatformContext(context->format(), context->shareHandle(), screen->connection()->egl_display());
return new QEGLXcbPlatformContext(context->format(), context->shareHandle(),
screen->connection()->egl_display(), screen->connection());
#elif defined(XCB_USE_DRI2)
return new QDri2Context(context->format(), context->shareHandle());
#endif

View File

@ -1353,11 +1353,8 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn)
extra->staticContentsSize = data.crect.size();
}
#ifdef Q_WS_QPA //Dont even call q->p
QPaintEngine *engine = 0;
#else
QPaintEngine *engine = q->paintEngine();
#endif
// QGLWidget does not support partial updates if:
// 1) The context is double buffered
// 2) The context is single buffered and auto-fill background is enabled.

View File

@ -919,9 +919,7 @@ void tst_QGL::partialGLWidgetUpdates()
widget.setFixedSize(150, 150);
widget.setAutoFillBackground(autoFillBackground);
widget.show();
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&widget);
#endif
QTest::qWait(200);
if (widget.format().doubleBuffer() != doubleBufferedContext)
@ -929,10 +927,7 @@ void tst_QGL::partialGLWidgetUpdates()
widget.paintEventRegion = QRegion();
widget.repaint(50, 50, 50, 50);
#ifdef Q_WS_MAC
// repaint() is not immediate on the Mac; it has to go through the event loop.
QTest::qWait(200);
#endif
if (supportsPartialUpdates)
QCOMPARE(widget.paintEventRegion, QRegion(50, 50, 50, 50));
else