diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2014-12-12 12:59:43 +0100 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2014-12-18 09:46:23 +0100 |
commit | 6c2da36c22e25e626a9812419332ad379e854133 (patch) | |
tree | 63b70bc1fce47768f262b3793d93338f42bfd79f /src/platformsupport | |
parent | b8e71aa8477765008798d4bd7887244cb4cc2db7 (diff) |
Prevent continuous painting with viewport QOpenGLWidget
Add the source widget to the texture list (may be null for custom
compositor implementations that add textures not belonging to actual
widgets). This allows us to do proper checks with the
dirtyRenderToTextureWidgets list.
As a result paint events are only sent to a QOpenGLWidget if (1) there
was an update() for it or (2) it was actually marked dirty. (2) was
previously behaving differently: the widget got a paint event when
anything in the window has changed. This is fine for naive animating
OpenGL code but less ideal for QGraphicsView.
Bool properties like stacksOnTop are now stored in a flags value to
prevent future explosion of texture list fields and parameters.
Task-number: QTBUG-43178
Change-Id: I48cbcf93df72ac682c9b5d64982a8b648fe21ef3
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r-- | src/platformsupport/eglconvenience/qeglcompositor.cpp | 4 | ||||
-rw-r--r-- | src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/platformsupport/eglconvenience/qeglcompositor.cpp b/src/platformsupport/eglconvenience/qeglcompositor.cpp index 5866edc48d..a46e5698de 100644 --- a/src/platformsupport/eglconvenience/qeglcompositor.cpp +++ b/src/platformsupport/eglconvenience/qeglcompositor.cpp @@ -151,7 +151,7 @@ void QEGLCompositor::render(QEGLPlatformWindow *window) const bool translucent = window->window()->requestedFormat().alphaBufferSize() > 0; blend.set(translucent); m_blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft); - } else if (!textures->stacksOnTop(i)) { + } else if (!textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) { // Texture from an FBO belonging to a QOpenGLWidget blend.set(false); m_blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginBottomLeft); @@ -159,7 +159,7 @@ void QEGLCompositor::render(QEGLPlatformWindow *window) } for (int i = 0; i < textures->count(); ++i) { - if (textures->stacksOnTop(i)) { + if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) { QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), targetWindowRect); blend.set(true); m_blitter->blit(textures->textureId(i), target, QOpenGLTextureBlitter::OriginBottomLeft); diff --git a/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp b/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp index 43c18573f2..d7d95ea97d 100644 --- a/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformbackingstore.cpp @@ -152,7 +152,7 @@ void QEGLPlatformBackingStore::flush(QWindow *window, const QRegion ®ion, con screen->compositingContext()->makeCurrent(dstWin->window()); updateTexture(); m_textures->clear(); - m_textures->appendTexture(m_bsTexture, window->geometry()); + m_textures->appendTexture(Q_NULLPTR, m_bsTexture, window->geometry()); composite(screen->compositingContext(), dstWin); } @@ -176,10 +176,10 @@ void QEGLPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &r m_textures->clear(); for (int i = 0; i < textures->count(); ++i) - m_textures->appendTexture(textures->textureId(i), textures->geometry(i), textures->stacksOnTop(i)); + m_textures->appendTexture(textures->widget(i), textures->textureId(i), textures->geometry(i), textures->flags(i)); updateTexture(); - m_textures->appendTexture(m_bsTexture, window->geometry()); + m_textures->appendTexture(Q_NULLPTR, m_bsTexture, window->geometry()); textures->lock(true); m_lockedWidgetTextures = textures; |