diff options
author | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-09-03 13:55:33 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-09-04 16:12:47 +0200 |
commit | 82d713d89638ebd49ed87bf5f66362a93607efd8 (patch) | |
tree | 226289c668a423d77e94daf886830a9faea05d20 /src/compositor/compositor_api/qwaylandview.cpp | |
parent | 7e9b31ecda04aa3ad5eea737c19cf2f204d208da (diff) |
Make it possible to discard currentBuffer of a view
This will be convenient if there is a view which copies the
currentBuffer to a cache and then wants to release the ref to the buffer
Change-Id: I0b7bbb4bc22c420fdf0d1af4bb1bbf0a4f888bc8
Diffstat (limited to 'src/compositor/compositor_api/qwaylandview.cpp')
-rw-r--r-- | src/compositor/compositor_api/qwaylandview.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp index 90f182c5d..fa1371925 100644 --- a/src/compositor/compositor_api/qwaylandview.cpp +++ b/src/compositor/compositor_api/qwaylandview.cpp @@ -200,18 +200,27 @@ void QWaylandView::attach(const QWaylandBufferRef &ref, const QRegion &damage) bool QWaylandView::advance() { Q_D(QWaylandView); - if (d->currentBuffer == d->nextBuffer) + if (d->currentBuffer == d->nextBuffer && !d->forceAdvanceSucceed) return false; if (d->bufferLock) return false; QMutexLocker locker(&d->bufferMutex); + d->forceAdvanceSucceed = false; d->currentBuffer = d->nextBuffer; d->currentDamage = d->nextDamage; return true; } +void QWaylandView::discardCurrentBuffer() +{ + Q_D(QWaylandView); + QMutexLocker locker(&d->bufferMutex); + d->currentBuffer = QWaylandBufferRef(); + d->forceAdvanceSucceed = true; +} + QWaylandBufferRef QWaylandView::currentBuffer() { Q_D(QWaylandView); |