summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qvariant.cpp91
-rw-r--r--src/corelib/thread/qsemaphore.cpp10
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/network/ssl/qsslsocket_winrt.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp104
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.h4
6 files changed, 109 insertions, 104 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 369405c7cd..b41a883e80 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -2386,7 +2386,7 @@ inline T qVariantToHelper(const QVariant::Private &d, const HandlersManager &han
\l QMetaType::QVariantList of a type that can be converted to QString;
otherwise returns an empty list.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QStringList QVariant::toStringList() const
{
@@ -2394,14 +2394,19 @@ QStringList QVariant::toStringList() const
}
/*!
- Returns the variant as a QString if the variant has userType() \l
- QMetaType::QString, \l QMetaType::Bool, \l QMetaType::QByteArray,
+ Returns the variant as a QString if the variant has a userType()
+ including, but not limited to:
+
+ \l QMetaType::QString, \l QMetaType::Bool, \l QMetaType::QByteArray,
\l QMetaType::QChar, \l QMetaType::QDate, \l QMetaType::QDateTime,
\l QMetaType::Double, \l QMetaType::Int, \l QMetaType::LongLong,
\l QMetaType::QStringList, \l QMetaType::QTime, \l QMetaType::UInt, or
- \l QMetaType::ULongLong; otherwise returns an empty string.
+ \l QMetaType::ULongLong.
+
+ Calling QVariant::toString() on an unsupported variant returns an empty
+ string.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QString QVariant::toString() const
{
@@ -2412,7 +2417,7 @@ QString QVariant::toString() const
Returns the variant as a QMap<QString, QVariant> if the variant
has type() \l QMetaType::QVariantMap; otherwise returns an empty map.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QVariantMap QVariant::toMap() const
{
@@ -2423,7 +2428,7 @@ QVariantMap QVariant::toMap() const
Returns the variant as a QHash<QString, QVariant> if the variant
has type() \l QMetaType::QVariantHash; otherwise returns an empty map.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QVariantHash QVariant::toHash() const
{
@@ -2440,7 +2445,7 @@ QVariantHash QVariant::toHash() const
If the type() is \l QMetaType::QString, an invalid date will be returned if
the string cannot be parsed as a Qt::ISODate format date.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QDate QVariant::toDate() const
{
@@ -2457,7 +2462,7 @@ QDate QVariant::toDate() const
If the type() is \l QMetaType::QString, an invalid time will be returned if
the string cannot be parsed as a Qt::ISODate format time.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QTime QVariant::toTime() const
{
@@ -2474,7 +2479,7 @@ QTime QVariant::toTime() const
If the type() is \l QMetaType::QString, an invalid date/time will be
returned if the string cannot be parsed as a Qt::ISODate format date/time.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QDateTime QVariant::toDateTime() const
{
@@ -2488,7 +2493,7 @@ QDateTime QVariant::toDateTime() const
Returns the variant as a QEasingCurve if the variant has userType()
\l QMetaType::QEasingCurve; otherwise returns a default easing curve.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
#ifndef QT_BOOTSTRAPPED
QEasingCurve QVariant::toEasingCurve() const
@@ -2504,7 +2509,7 @@ QEasingCurve QVariant::toEasingCurve() const
\l QMetaType::QByteArray or \l QMetaType::QString (converted using
QString::fromUtf8()); otherwise returns an empty byte array.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QByteArray QVariant::toByteArray() const
{
@@ -2519,7 +2524,7 @@ QByteArray QVariant::toByteArray() const
\l QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null
QPoint.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QPoint QVariant::toPoint() const
{
@@ -2532,7 +2537,7 @@ QPoint QVariant::toPoint() const
Returns the variant as a QRect if the variant has userType()
\l QMetaType::QRect; otherwise returns an invalid QRect.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QRect QVariant::toRect() const
{
@@ -2545,7 +2550,7 @@ QRect QVariant::toRect() const
Returns the variant as a QSize if the variant has userType()
\l QMetaType::QSize; otherwise returns an invalid QSize.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QSize QVariant::toSize() const
{
@@ -2558,7 +2563,7 @@ QSize QVariant::toSize() const
Returns the variant as a QSizeF if the variant has userType() \l
QMetaType::QSizeF; otherwise returns an invalid QSizeF.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QSizeF QVariant::toSizeF() const
{
@@ -2572,7 +2577,7 @@ QSizeF QVariant::toSizeF() const
\l QMetaType::QRect or \l QMetaType::QRectF; otherwise returns an invalid
QRectF.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QRectF QVariant::toRectF() const
{
@@ -2585,7 +2590,7 @@ QRectF QVariant::toRectF() const
Returns the variant as a QLineF if the variant has userType()
\l QMetaType::QLineF; otherwise returns an invalid QLineF.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QLineF QVariant::toLineF() const
{
@@ -2598,7 +2603,7 @@ QLineF QVariant::toLineF() const
Returns the variant as a QLine if the variant has userType()
\l QMetaType::QLine; otherwise returns an invalid QLine.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QLine QVariant::toLine() const
{
@@ -2612,7 +2617,7 @@ QLine QVariant::toLine() const
QMetaType::QPoint or \l QMetaType::QPointF; otherwise returns a null
QPointF.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QPointF QVariant::toPointF() const
{
@@ -2628,7 +2633,7 @@ QPointF QVariant::toPointF() const
Returns the variant as a QUrl if the variant has userType()
\l QMetaType::QUrl; otherwise returns an invalid QUrl.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QUrl QVariant::toUrl() const
{
@@ -2642,7 +2647,7 @@ QUrl QVariant::toUrl() const
Returns the variant as a QLocale if the variant has userType()
\l QMetaType::QLocale; otherwise returns an invalid QLocale.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QLocale QVariant::toLocale() const
{
@@ -2656,7 +2661,7 @@ QLocale QVariant::toLocale() const
Returns the variant as a QRegExp if the variant has userType()
\l QMetaType::QRegExp; otherwise returns an empty QRegExp.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
#ifndef QT_NO_REGEXP
QRegExp QVariant::toRegExp() const
@@ -2673,7 +2678,7 @@ QRegExp QVariant::toRegExp() const
Returns the variant as a QRegularExpression if the variant has userType() \l
QRegularExpression; otherwise returns an empty QRegularExpression.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QRegularExpression QVariant::toRegularExpression() const
{
@@ -2688,7 +2693,7 @@ QRegularExpression QVariant::toRegularExpression() const
Returns the variant as a QModelIndex if the variant has userType() \l
QModelIndex; otherwise returns a default constructed QModelIndex.
- \sa canConvert(), convert(), toPersistentModelIndex()
+ \sa canConvert(int targetTypeId), convert(), toPersistentModelIndex()
*/
QModelIndex QVariant::toModelIndex() const
{
@@ -2701,7 +2706,7 @@ QModelIndex QVariant::toModelIndex() const
Returns the variant as a QPersistentModelIndex if the variant has userType() \l
QPersistentModelIndex; otherwise returns a default constructed QPersistentModelIndex.
- \sa canConvert(), convert(), toModelIndex()
+ \sa canConvert(int targetTypeId), convert(), toModelIndex()
*/
QPersistentModelIndex QVariant::toPersistentModelIndex() const
{
@@ -2717,7 +2722,7 @@ QPersistentModelIndex QVariant::toPersistentModelIndex() const
\l QMetaType::QUuid, \l QMetaType::QByteArray or \l QMetaType::QString;
otherwise returns a default-constructed QUuid.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QUuid QVariant::toUuid() const
{
@@ -2730,7 +2735,7 @@ QUuid QVariant::toUuid() const
Returns the variant as a QJsonValue if the variant has userType() \l
QJsonValue; otherwise returns a default constructed QJsonValue.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QJsonValue QVariant::toJsonValue() const
{
@@ -2743,7 +2748,7 @@ QJsonValue QVariant::toJsonValue() const
Returns the variant as a QJsonObject if the variant has userType() \l
QJsonObject; otherwise returns a default constructed QJsonObject.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QJsonObject QVariant::toJsonObject() const
{
@@ -2756,7 +2761,7 @@ QJsonObject QVariant::toJsonObject() const
Returns the variant as a QJsonArray if the variant has userType() \l
QJsonArray; otherwise returns a default constructed QJsonArray.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QJsonArray QVariant::toJsonArray() const
{
@@ -2769,7 +2774,7 @@ QJsonArray QVariant::toJsonArray() const
Returns the variant as a QJsonDocument if the variant has userType() \l
QJsonDocument; otherwise returns a default constructed QJsonDocument.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QJsonDocument QVariant::toJsonDocument() const
{
@@ -2784,7 +2789,7 @@ QJsonDocument QVariant::toJsonDocument() const
\l QMetaType::QChar, \l QMetaType::Int, or \l QMetaType::UInt; otherwise
returns an invalid QChar.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QChar QVariant::toChar() const
{
@@ -2795,7 +2800,7 @@ QChar QVariant::toChar() const
Returns the variant as a QBitArray if the variant has userType()
\l QMetaType::QBitArray; otherwise returns an empty bit array.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QBitArray QVariant::toBitArray() const
{
@@ -2838,7 +2843,7 @@ inline T qNumVariantToHelper(const QVariant::Private &d,
will not be reflected in \a ok. A simple workaround is to use
QString::toInt().
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
int QVariant::toInt(bool *ok) const
{
@@ -2860,7 +2865,7 @@ int QVariant::toInt(bool *ok) const
overflow will not be reflected in \a ok. A simple workaround is to use
QString::toUInt().
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
uint QVariant::toUInt(bool *ok) const
{
@@ -2877,7 +2882,7 @@ uint QVariant::toUInt(bool *ok) const
If \a ok is non-null: \c{*}\c{ok} is set to true if the value could be
converted to an int; otherwise \c{*}\c{ok} is set to false.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
qlonglong QVariant::toLongLong(bool *ok) const
{
@@ -2894,7 +2899,7 @@ qlonglong QVariant::toLongLong(bool *ok) const
If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be
converted to an int; otherwise \c{*}\a{ok} is set to false.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
qulonglong QVariant::toULongLong(bool *ok) const
{
@@ -2911,7 +2916,7 @@ qulonglong QVariant::toULongLong(bool *ok) const
\l QMetaType::QByteArray and its lower-case content is not one of the
following: empty, "0" or "false"; otherwise returns \c false.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
bool QVariant::toBool() const
{
@@ -2934,7 +2939,7 @@ bool QVariant::toBool() const
If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be
converted to a double; otherwise \c{*}\a{ok} is set to false.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
double QVariant::toDouble(bool *ok) const
{
@@ -2953,7 +2958,7 @@ double QVariant::toDouble(bool *ok) const
If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be
converted to a double; otherwise \c{*}\a{ok} is set to false.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
float QVariant::toFloat(bool *ok) const
{
@@ -2972,7 +2977,7 @@ float QVariant::toFloat(bool *ok) const
If \a ok is non-null: \c{*}\a{ok} is set to true if the value could be
converted to a double; otherwise \c{*}\a{ok} is set to false.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
qreal QVariant::toReal(bool *ok) const
{
@@ -2984,7 +2989,7 @@ qreal QVariant::toReal(bool *ok) const
\l QMetaType::QVariantList or \l QMetaType::QStringList; otherwise returns
an empty list.
- \sa canConvert(), convert()
+ \sa canConvert(int targetTypeId), convert()
*/
QVariantList QVariant::toList() const
{
@@ -3366,7 +3371,7 @@ bool QVariant::canConvert(int targetTypeId) const
failed a previous conversion will always fail, changing the type, remaining null,
and returning \c false.
- \sa canConvert(), clear()
+ \sa canConvert(int targetTypeId), clear()
*/
bool QVariant::convert(int targetTypeId)
diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp
index 9a5505bd1e..f418ac1205 100644
--- a/src/corelib/thread/qsemaphore.cpp
+++ b/src/corelib/thread/qsemaphore.cpp
@@ -291,10 +291,14 @@ public:
QSemaphore::QSemaphore(int n)
{
Q_ASSERT_X(n >= 0, "QSemaphore", "parameter 'n' must be non-negative");
- if (futexAvailable())
- u.store(n);
- else
+ if (futexAvailable()) {
+ quintptr nn = unsigned(n);
+ if (futexHasWaiterCount)
+ nn |= quint64(nn) << 32; // token count replicated in high word
+ u.store(nn);
+ } else {
d = new QSemaphorePrivate(n);
+ }
}
/*!
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 404a722e29..a4e5130937 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2889,7 +2889,7 @@ Q_GUI_EXPORT QStringList qt_sort_families_by_writing_system(QChar::Script script
uint order = i;
if (testFamily == nullptr
|| (testFamily->writingSystems[writingSystem] & QtFontFamily::Supported) == 0) {
- order |= 1 << 31;
+ order |= 1u << 31;
}
supported.insert(order, family);
diff --git a/src/network/ssl/qsslsocket_winrt.cpp b/src/network/ssl/qsslsocket_winrt.cpp
index ff9dccc734..53a8a8b61b 100644
--- a/src/network/ssl/qsslsocket_winrt.cpp
+++ b/src/network/ssl/qsslsocket_winrt.cpp
@@ -236,9 +236,9 @@ void QSslSocketBackendPrivate::startClientEncryption()
switch (q->protocol()) {
case QSsl::AnyProtocol:
case QSsl::SslV3:
+ case QSsl::TlsV1SslV3:
protectionLevel = SocketProtectionLevel_Ssl; // Only use this value if weak cipher support is required
break;
- case QSsl::TlsV1SslV3:
case QSsl::TlsV1_0:
protectionLevel = SocketProtectionLevel_Tls10;
break;
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 70d1757af4..659d1c53cb 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -70,11 +70,13 @@
QT_BEGIN_NAMESPACE
-class QXcbShmImage : public QXcbObject
+class QXcbBackingStore;
+
+class QXcbBackingStoreImage : public QXcbObject
{
public:
- QXcbShmImage(QXcbScreen *connection, const QSize &size, uint depth, QImage::Format format);
- ~QXcbShmImage() { destroy(true); }
+ QXcbBackingStoreImage(QXcbBackingStore *backingStore, const QSize &size);
+ ~QXcbBackingStoreImage() { destroy(true); }
void resize(const QSize &size);
@@ -105,25 +107,24 @@ private:
void flushPixmap(const QRegion &region, bool fullRegion = false);
void setClip(const QRegion &region);
- xcb_window_t m_screen_root;
-
xcb_shm_segment_info_t m_shm_info;
- size_t m_segmentSize;
+ QXcbBackingStore *m_backingStore = nullptr;
+ size_t m_segmentSize = 0;
- xcb_image_t *m_xcb_image;
+ xcb_image_t *m_xcb_image = nullptr;
QImage m_qimage;
- QPlatformGraphicsBuffer *m_graphics_buffer;
+ QPlatformGraphicsBuffer *m_graphics_buffer = nullptr;
- xcb_gcontext_t m_gc;
- xcb_drawable_t m_gc_drawable;
+ xcb_gcontext_t m_gc = 0;
+ xcb_drawable_t m_gc_drawable = 0;
// When using shared memory these variables are used only for server-side scrolling.
// When not using shared memory, we maintain a server-side pixmap with the backing
// store as well as repainted content not yet flushed to the pixmap. We only flush
// the regions we need and only when these are marked dirty. This way we can just
// do a server-side copy on expose instead of sending the pixels every time
- xcb_pixmap_t m_xcb_pixmap;
+ xcb_pixmap_t m_xcb_pixmap = 0;
QRegion m_pendingFlush;
// This is the scrolled region which is stored in server-side pixmap
@@ -136,16 +137,15 @@ private:
// as a pixmap region to server
QByteArray m_flushBuffer;
- bool m_hasAlpha;
- bool m_clientSideScroll;
+ bool m_hasAlpha = false;
+ bool m_clientSideScroll = false;
};
-class QXcbShmGraphicsBuffer : public QPlatformGraphicsBuffer
+class QXcbGraphicsBuffer : public QPlatformGraphicsBuffer
{
public:
- QXcbShmGraphicsBuffer(QImage *image)
+ QXcbGraphicsBuffer(QImage *image)
: QPlatformGraphicsBuffer(image->size(), QImage::toPixelFormat(image->format()))
- , m_access_lock(QPlatformGraphicsBuffer::None)
, m_image(image)
{ }
@@ -165,9 +165,10 @@ public:
int bytesPerLine() const override { return m_image->bytesPerLine(); }
Origin origin() const override { return QPlatformGraphicsBuffer::OriginTopLeft; }
+
private:
- AccessTypes m_access_lock;
- QImage *m_image;
+ AccessTypes m_access_lock = QPlatformGraphicsBuffer::None;
+ QImage *m_image = nullptr;
};
static inline size_t imageDataSize(const xcb_image_t *image)
@@ -175,28 +176,25 @@ static inline size_t imageDataSize(const xcb_image_t *image)
return static_cast<size_t>(image->stride) * image->height;
}
-QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QImage::Format format)
- : QXcbObject(screen->connection())
- , m_screen_root(screen->screen()->root)
- , m_segmentSize(0)
- , m_graphics_buffer(nullptr)
- , m_gc(0)
- , m_gc_drawable(0)
- , m_xcb_pixmap(0)
- , m_clientSideScroll(false)
-{
- const xcb_format_t *fmt = connection()->formatForDepth(depth);
+QXcbBackingStoreImage::QXcbBackingStoreImage(QXcbBackingStore *backingStore, const QSize &size)
+ : QXcbObject(backingStore->connection())
+ , m_backingStore(backingStore)
+{
+ QXcbWindow *window = static_cast<QXcbWindow *>(backingStore->window()->handle());
+ const xcb_format_t *fmt = connection()->formatForDepth(window->depth());
Q_ASSERT(fmt);
+ memset(&m_shm_info, 0, sizeof m_shm_info);
+
+ QImage::Format format = window->imageFormat();
m_hasAlpha = QImage::toPixelFormat(format).alphaUsage() == QPixelFormat::UsesAlpha;
if (!m_hasAlpha)
- format = qt_maybeAlphaVersionWithSameDepth(format);
-
- memset(&m_shm_info, 0, sizeof m_shm_info);
- create(size, fmt, format);
+ create(size, fmt, qt_maybeAlphaVersionWithSameDepth(format));
+ else
+ create(size, fmt, format);
}
-void QXcbShmImage::resize(const QSize &size)
+void QXcbBackingStoreImage::resize(const QSize &size)
{
xcb_format_t fmt;
fmt.depth = m_xcb_image->depth;
@@ -207,7 +205,7 @@ void QXcbShmImage::resize(const QSize &size)
create(size, &fmt, m_qimage.format());
}
-void QXcbShmImage::create(const QSize &size, const xcb_format_t *fmt, QImage::Format format)
+void QXcbBackingStoreImage::create(const QSize &size, const xcb_format_t *fmt, QImage::Format format)
{
m_xcb_image = xcb_image_create(size.width(), size.height(),
XCB_IMAGE_FORMAT_Z_PIXMAP,
@@ -232,17 +230,18 @@ void QXcbShmImage::create(const QSize &size, const xcb_format_t *fmt, QImage::Fo
m_xcb_image->data = m_shm_info.shmaddr ? m_shm_info.shmaddr : (uint8_t *)malloc(segmentSize);
m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, format);
- m_graphics_buffer = new QXcbShmGraphicsBuffer(&m_qimage);
+ m_graphics_buffer = new QXcbGraphicsBuffer(&m_qimage);
m_xcb_pixmap = xcb_generate_id(xcb_connection());
+ auto xcbScreen = static_cast<QXcbScreen *>(m_backingStore->window()->screen()->handle());
xcb_create_pixmap(xcb_connection(),
m_xcb_image->depth,
m_xcb_pixmap,
- m_screen_root,
+ xcbScreen->root(),
m_xcb_image->width, m_xcb_image->height);
}
-void QXcbShmImage::destroy(bool destroyShm)
+void QXcbBackingStoreImage::destroy(bool destroyShm)
{
if (m_xcb_image->data) {
if (m_shm_info.shmaddr) {
@@ -268,7 +267,7 @@ void QXcbShmImage::destroy(bool destroyShm)
m_xcb_pixmap = 0;
}
-void QXcbShmImage::flushScrolledRegion(bool clientSideScroll)
+void QXcbBackingStoreImage::flushScrolledRegion(bool clientSideScroll)
{
if (m_clientSideScroll == clientSideScroll)
return;
@@ -316,7 +315,7 @@ void QXcbShmImage::flushScrolledRegion(bool clientSideScroll)
}
}
-void QXcbShmImage::createShmSegment(size_t segmentSize)
+void QXcbBackingStoreImage::createShmSegment(size_t segmentSize)
{
Q_ASSERT(connection()->hasShm());
Q_ASSERT(m_segmentSize == 0);
@@ -400,7 +399,7 @@ void QXcbShmImage::createShmSegment(size_t segmentSize)
}
}
-void QXcbShmImage::destroyShmSegment(size_t segmentSize)
+void QXcbBackingStoreImage::destroyShmSegment(size_t segmentSize)
{
#ifndef XCB_USE_SHM_FD
Q_UNUSED(segmentSize)
@@ -433,7 +432,7 @@ void QXcbShmImage::destroyShmSegment(size_t segmentSize)
extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
-bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy)
+bool QXcbBackingStoreImage::scroll(const QRegion &area, int dx, int dy)
{
const QRect bounds(QPoint(), size());
const QRegion scrollArea(area & bounds);
@@ -477,7 +476,7 @@ bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy)
return true;
}
-void QXcbShmImage::ensureGC(xcb_drawable_t dst)
+void QXcbBackingStoreImage::ensureGC(xcb_drawable_t dst)
{
if (m_gc_drawable != dst) {
if (m_gc)
@@ -557,7 +556,7 @@ static inline quint32 round_up_scanline(quint32 base, quint32 pad)
return (base + pad - 1) & -pad;
}
-void QXcbShmImage::shmPutImage(xcb_drawable_t drawable, const QRegion &region, const QPoint &offset)
+void QXcbBackingStoreImage::shmPutImage(xcb_drawable_t drawable, const QRegion &region, const QPoint &offset)
{
for (const QRect &rect : region) {
const QPoint source = rect.translated(offset).topLeft();
@@ -578,7 +577,7 @@ void QXcbShmImage::shmPutImage(xcb_drawable_t drawable, const QRegion &region, c
m_dirtyShm |= region.translated(offset);
}
-void QXcbShmImage::flushPixmap(const QRegion &region, bool fullRegion)
+void QXcbBackingStoreImage::flushPixmap(const QRegion &region, bool fullRegion)
{
if (!fullRegion) {
auto actualRegion = m_pendingFlush.intersected(region);
@@ -647,7 +646,7 @@ void QXcbShmImage::flushPixmap(const QRegion &region, bool fullRegion)
}
}
-void QXcbShmImage::setClip(const QRegion &region)
+void QXcbBackingStoreImage::setClip(const QRegion &region)
{
if (region.isEmpty()) {
static const uint32_t mask = XCB_GC_CLIP_MASK;
@@ -663,7 +662,7 @@ void QXcbShmImage::setClip(const QRegion &region)
}
}
-void QXcbShmImage::put(xcb_drawable_t dst, const QRegion &region, const QPoint &offset)
+void QXcbBackingStoreImage::put(xcb_drawable_t dst, const QRegion &region, const QPoint &offset)
{
Q_ASSERT(!m_clientSideScroll);
@@ -704,7 +703,7 @@ void QXcbShmImage::put(xcb_drawable_t dst, const QRegion &region, const QPoint &
setClip(QRegion());
}
-void QXcbShmImage::preparePaint(const QRegion &region)
+void QXcbBackingStoreImage::preparePaint(const QRegion &region)
{
if (hasShm()) {
// to prevent X from reading from the image region while we're writing to it
@@ -719,7 +718,6 @@ void QXcbShmImage::preparePaint(const QRegion &region)
QXcbBackingStore::QXcbBackingStore(QWindow *window)
: QPlatformBackingStore(window)
- , m_image(0)
{
QXcbScreen *screen = static_cast<QXcbScreen *>(window->screen()->handle());
setConnection(screen->connection());
@@ -856,12 +854,10 @@ void QXcbBackingStore::resize(const QSize &size, const QRegion &)
}
QXcbWindow* win = static_cast<QXcbWindow *>(pw);
- if (m_image) {
+ if (m_image)
m_image->resize(size);
- } else {
- QXcbScreen *screen = static_cast<QXcbScreen *>(window()->screen()->handle());
- m_image = new QXcbShmImage(screen, size, win->depth(), win->imageFormat());
- }
+ else
+ m_image = new QXcbBackingStoreImage(this, size);
// Slow path for bgr888 VNC: Create an additional image, paint into that and
// swap R and B while copying to m_image after each paint.
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h
index 2e8fbfb7fa..747626c213 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.h
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.h
@@ -49,7 +49,7 @@
QT_BEGIN_NAMESPACE
-class QXcbShmImage;
+class QXcbBackingStoreImage;
class QXcbBackingStore : public QXcbObject, public QPlatformBackingStore
{
@@ -75,7 +75,7 @@ public:
void endPaint() override;
private:
- QXcbShmImage *m_image;
+ QXcbBackingStoreImage *m_image = nullptr;
QStack<QRegion> m_paintRegions;
QImage m_rgbImage;
};