QWaylandShmBackingStore: replace a QLinkedList with std::list
...and mark the module QLinkedList-free. QLinkedList is going to be deprecated. Change-Id: Ieb9efef24cd8677edc1262f22b7c6d41b6376347 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
This commit is contained in:
parent
a582ec32d1
commit
afe5668bb6
@ -249,7 +249,7 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size)
|
|||||||
if (b->size() == size) {
|
if (b->size() == size) {
|
||||||
return b;
|
return b;
|
||||||
} else {
|
} else {
|
||||||
mBuffers.removeOne(b);
|
mBuffers.remove(b);
|
||||||
if (mBackBuffer == b)
|
if (mBackBuffer == b)
|
||||||
mBackBuffer = nullptr;
|
mBackBuffer = nullptr;
|
||||||
delete b;
|
delete b;
|
||||||
@ -257,11 +257,11 @@ QWaylandShmBuffer *QWaylandShmBackingStore::getBuffer(const QSize &size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int MAX_BUFFERS = 5;
|
static const size_t MAX_BUFFERS = 5;
|
||||||
if (mBuffers.count() < MAX_BUFFERS) {
|
if (mBuffers.size() < MAX_BUFFERS) {
|
||||||
QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format();
|
QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format();
|
||||||
QWaylandShmBuffer *b = new QWaylandShmBuffer(mDisplay, size, format, waylandWindow()->scale());
|
QWaylandShmBuffer *b = new QWaylandShmBuffer(mDisplay, size, format, waylandWindow()->scale());
|
||||||
mBuffers.prepend(b);
|
mBuffers.push_front(b);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -300,9 +300,9 @@ void QWaylandShmBackingStore::resize(const QSize &size)
|
|||||||
|
|
||||||
// ensure the new buffer is at the beginning of the list so next time getBuffer() will pick
|
// ensure the new buffer is at the beginning of the list so next time getBuffer() will pick
|
||||||
// it if possible
|
// it if possible
|
||||||
if (mBuffers.first() != buffer) {
|
if (mBuffers.front() != buffer) {
|
||||||
mBuffers.removeOne(buffer);
|
mBuffers.remove(buffer);
|
||||||
mBuffers.prepend(buffer);
|
mBuffers.push_front(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (windowDecoration() && window()->isVisible() && oldSizeInBytes != newSizeInBytes)
|
if (windowDecoration() && window()->isVisible() && oldSizeInBytes != newSizeInBytes)
|
||||||
|
@ -57,7 +57,8 @@
|
|||||||
#include <QtGui/QImage>
|
#include <QtGui/QImage>
|
||||||
#include <qpa/qplatformwindow.h>
|
#include <qpa/qplatformwindow.h>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QLinkedList>
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ private:
|
|||||||
QWaylandShmBuffer *getBuffer(const QSize &size);
|
QWaylandShmBuffer *getBuffer(const QSize &size);
|
||||||
|
|
||||||
QWaylandDisplay *mDisplay = nullptr;
|
QWaylandDisplay *mDisplay = nullptr;
|
||||||
QLinkedList<QWaylandShmBuffer *> mBuffers;
|
std::list<QWaylandShmBuffer *> mBuffers;
|
||||||
QWaylandShmBuffer *mFrontBuffer = nullptr;
|
QWaylandShmBuffer *mFrontBuffer = nullptr;
|
||||||
QWaylandShmBuffer *mBackBuffer = nullptr;
|
QWaylandShmBuffer *mBackBuffer = nullptr;
|
||||||
bool mPainting = false;
|
bool mPainting = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user