diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-10-09 17:56:51 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-10-09 17:56:52 +0200 |
commit | 881ceeff428c377d02ae3881beccdbb028385075 (patch) | |
tree | 65bd4335d7f67b81b04e33f2cbb17a41cf966dd8 /src/gui/painting | |
parent | b3d2c867ed14cd6337d5e32b8750f198b5b7d331 (diff) | |
parent | 106487387d493dab934e19b33bfed55b8df62d67 (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: I05fcd8dc66d9ad0dc76bb7f5bae05c9876bfba14
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qbrush.cpp | 12 | ||||
-rw-r--r-- | src/gui/painting/qpagelayout.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpagesize.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 15 | ||||
-rw-r--r-- | src/gui/painting/qregion.cpp | 33 | ||||
-rw-r--r-- | src/gui/painting/qregion.h | 4 | ||||
-rw-r--r-- | src/gui/painting/qtransform.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qtransform.h | 10 |
8 files changed, 45 insertions, 41 deletions
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index eca2860ab9..d120175108 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -596,8 +596,16 @@ void QBrush::detach(Qt::BrushStyle newStyle) case Qt::RadialGradientPattern: case Qt::ConicalGradientPattern: x.reset(new QGradientBrushData); - static_cast<QGradientBrushData *>(x.data())->gradient = - static_cast<QGradientBrushData *>(d.data())->gradient; + switch (d->style) { + case Qt::LinearGradientPattern: + case Qt::RadialGradientPattern: + case Qt::ConicalGradientPattern: + static_cast<QGradientBrushData *>(x.data())->gradient = + static_cast<QGradientBrushData *>(d.data())->gradient; + break; + default: + break; + } break; default: x.reset(new QBrushData); diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp index c0f63795e4..4531a0558d 100644 --- a/src/gui/painting/qpagelayout.cpp +++ b/src/gui/painting/qpagelayout.cpp @@ -974,7 +974,7 @@ QDebug operator<<(QDebug dbg, const QPageLayout &layout) .arg(units); dbg.nospace() << output; } else { - dbg.nospace() << QStringLiteral("QPageLayout()"); + dbg.nospace() << "QPageLayout()"; } return dbg.space(); } diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp index faf3e3941e..92a14119c8 100644 --- a/src/gui/painting/qpagesize.cpp +++ b/src/gui/painting/qpagesize.cpp @@ -396,9 +396,9 @@ static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match return QPageSize::Custom; QString key = ppdKey; // Remove any Rotated or Tranverse modifiers - if (key.endsWith(QStringLiteral("Rotated"))) + if (key.endsWith(QLatin1String("Rotated"))) key.chop(7); - else if (key.endsWith(QStringLiteral(".Transverse"))) + else if (key.endsWith(QLatin1String(".Transverse"))) key.chop(11); for (int i = 0; i <= int(QPageSize::LastPageSize); ++i) { if (QLatin1String(qt_pageSizes[i].mediaOption) == key) { @@ -1863,7 +1863,7 @@ QDebug operator<<(QDebug dbg, const QPageSize &pageSize) .arg(pageSize.id()); dbg.nospace() << output; } else { - dbg.nospace() << QStringLiteral("QPageSize()"); + dbg.nospace() << "QPageSize()"; } return dbg.space(); } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index ef21cacdf2..12c7929047 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1347,14 +1347,7 @@ void QPainterPrivate::updateState(QPainterState *newState) and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0 specification. This includes most graphics chips produced in the last couple of years. The engine can be enabled by using QPainter - onto a QOpenGLWidget or by passing \c {-graphicssystem opengl} on the - command line when the underlying system supports it. - - \li OpenVG - This backend implements the Khronos standard for 2D - and Vector Graphics. It is primarily for embedded devices with - hardware support for OpenVG. The engine can be enabled by - passing \c {-graphicssystem openvg} on the command line when - the underlying system supports it. + onto a QOpenGLWidget. \endlist @@ -7439,10 +7432,6 @@ start_lengthVariant: } } - // no need to do extra work for underlines if we don't paint - if (tf & Qt::TextDontPrint) - maxUnderlines = 0; - QList<QTextLayout::FormatRange> underlineFormats; int length = offset - old_offset; if ((hidemnmemonic || showmnemonic) && maxUnderlines > 0) { @@ -7457,7 +7446,7 @@ start_lengthVariant: --l; if (!l) break; - if (*cin != QLatin1Char('&') && !hidemnmemonic) { + if (*cin != QLatin1Char('&') && !hidemnmemonic && !(tf & Qt::TextDontPrint)) { QTextLayout::FormatRange range; range.start = cout - cout0; range.length = 1; diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 1191f27ad7..c556edd4c0 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -240,7 +240,7 @@ QRegion::QRegion(int x, int y, int w, int h, RegionType t) void QRegion::detach() { - if (d->ref.load() != 1) + if (d->ref.isShared()) *this = copy(); } @@ -1588,7 +1588,7 @@ void QRegionPrivate::selfTest() const #endif // QT_REGION_DEBUG static QRegionPrivate qrp; -QRegion::QRegionData QRegion::shared_empty = {Q_BASIC_ATOMIC_INITIALIZER(1), &qrp}; +const QRegion::QRegionData QRegion::shared_empty = {Q_REFCOUNT_INITIALIZE_STATIC, &qrp}; typedef void (*OverlapFunc)(QRegionPrivate &dest, const QRect *r1, const QRect *r1End, const QRect *r2, const QRect *r2End, int y1, int y2); @@ -3472,7 +3472,7 @@ static void PtsToRegion(int numFullPtBlocks, int iCurPtBlock, } if (rowSize) { - QPoint *next = i ? &pts[2] : (numFullPtBlocks ? CurPtBlock->next->pts : 0); + QPoint *next = i ? &pts[2] : (numFullPtBlocks && iCurPtBlock ? CurPtBlock->next->pts : Q_NULLPTR); if (!next || next->y() != pts[0].y()) { flushRow(row.data(), pts[0].y(), rowSize, reg, &lastRow, &extendTo, &needsExtend); @@ -3558,8 +3558,10 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) return region; } - if (!(pETEs = static_cast<EdgeTableEntry *>(malloc(sizeof(EdgeTableEntry) * Count)))) + if (!(pETEs = static_cast<EdgeTableEntry *>(malloc(sizeof(EdgeTableEntry) * Count)))) { + delete region; return 0; + } region->vectorize(); @@ -3786,19 +3788,17 @@ QRegionPrivate *qt_bitmapToRegion(const QBitmap& bitmap) } QRegion::QRegion() - : d(&shared_empty) + : d(const_cast<QRegionData*>(&shared_empty)) { - d->ref.ref(); } QRegion::QRegion(const QRect &r, RegionType t) { if (r.isEmpty()) { - d = &shared_empty; - d->ref.ref(); + d = const_cast<QRegionData*>(&shared_empty); } else { d = new QRegionData; - d->ref.store(1); + d->ref.initializeOwned(); if (t == Rectangle) { d->qt_rgn = new QRegionPrivate(r); } else if (t == Ellipse) { @@ -3817,15 +3817,13 @@ QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule) fillRule == Qt::WindingFill ? WindingRule : EvenOddRule); if (qt_rgn) { d = new QRegionData; - d->ref.store(1); + d->ref.initializeOwned(); d->qt_rgn = qt_rgn; } else { - d = &shared_empty; - d->ref.ref(); + d = const_cast<QRegionData*>(&shared_empty); } } else { - d = &shared_empty; - d->ref.ref(); + d = const_cast<QRegionData*>(&shared_empty); } } @@ -3839,11 +3837,10 @@ QRegion::QRegion(const QRegion &r) QRegion::QRegion(const QBitmap &bm) { if (bm.isNull()) { - d = &shared_empty; - d->ref.ref(); + d = const_cast<QRegionData*>(&shared_empty); } else { d = new QRegionData; - d->ref.store(1); + d->ref.initializeOwned(); d->qt_rgn = qt_bitmapToRegion(bm); } } @@ -3878,7 +3875,7 @@ QRegion QRegion::copy() const { QRegion r; QScopedPointer<QRegionData> x(new QRegionData); - x->ref.store(1); + x->ref.initializeOwned(); if (d->qt_rgn) x->qt_rgn = new QRegionPrivate(*d->qt_rgn); else diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index d34eebf29d..79a715d9e9 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -150,11 +150,11 @@ Q_GUI_EXPORT void exec(const QByteArray &ba, int ver = 0, QDataStream::ByteOrder byteOrder = QDataStream::BigEndian); #endif struct QRegionData { - QBasicAtomicInt ref; + QtPrivate::RefCount ref; QRegionPrivate *qt_rgn; }; struct QRegionData *d; - static struct QRegionData shared_empty; + static const struct QRegionData shared_empty; static void cleanUp(QRegionData *x); }; diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index f597ea0e9e..04a97aabcb 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -250,6 +250,7 @@ QTransform::QTransform() , m_13(0), m_23(0), m_33(1) , m_type(TxNone) , m_dirty(TxNone) + , d(Q_NULLPTR) { } @@ -268,6 +269,7 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h13, , m_13(h13), m_23(h23), m_33(h33) , m_type(TxNone) , m_dirty(TxProject) + , d(Q_NULLPTR) { } @@ -284,6 +286,7 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h21, , m_13(0), m_23(0), m_33(1) , m_type(TxNone) , m_dirty(TxShear) + , d(Q_NULLPTR) { } @@ -299,6 +302,7 @@ QTransform::QTransform(const QMatrix &mtx) m_13(0), m_23(0), m_33(1) , m_type(TxNone) , m_dirty(TxShear) + , d(Q_NULLPTR) { } diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index e32e29c5da..68c4548644 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -154,12 +154,18 @@ private: : affine(h11, h12, h21, h22, h31, h32, true) , m_13(h13), m_23(h23), m_33(h33) , m_type(TxNone) - , m_dirty(TxProject) {} + , m_dirty(TxProject) + , d(Q_NULLPTR) + { + } inline QTransform(bool) : affine(true) , m_13(0), m_23(0), m_33(1) , m_type(TxNone) - , m_dirty(TxNone) {} + , m_dirty(TxNone) + , d(Q_NULLPTR) + { + } inline TransformationType inline_type() const; QMatrix affine; qreal m_13; |