summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2019-06-10 11:08:29 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-06-20 20:48:59 +0200
commit34fe9232dbf6a9fe58ebc4c7680bb67d2f642c40 (patch)
treed85afa295e882b84aa11c8861d6b85799c2f7e71 /src/gui/painting
parent84e89c1e9e00d4fab576b876cfa80e92b5602982 (diff)
Port from QAtomic::load() to loadRelaxed()
Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qbrush.cpp8
-rw-r--r--src/gui/painting/qbrush.h2
-rw-r--r--src/gui/painting/qcolorspace_p.h2
-rw-r--r--src/gui/painting/qcolortransform.cpp4
-rw-r--r--src/gui/painting/qpainterpath.cpp2
-rw-r--r--src/gui/painting/qpainterpath_p.h4
-rw-r--r--src/gui/painting/qpen.cpp6
7 files changed, 14 insertions, 14 deletions
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 21e41979af..abb3268dfa 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -352,7 +352,7 @@ public:
QBrushData *brush;
QNullBrushData() : brush(new QBrushData)
{
- brush->ref.store(1);
+ brush->ref.storeRelaxed(1);
brush->style = Qt::BrushStyle(0);
brush->color = Qt::black;
}
@@ -411,7 +411,7 @@ void QBrush::init(const QColor &color, Qt::BrushStyle style)
d.reset(new QBrushData);
break;
}
- d->ref.store(1);
+ d->ref.storeRelaxed(1);
d->style = style;
d->color = color;
}
@@ -585,7 +585,7 @@ static Q_DECL_CONSTEXPR inline bool use_same_brushdata(Qt::BrushStyle lhs, Qt::B
void QBrush::detach(Qt::BrushStyle newStyle)
{
- if (use_same_brushdata(newStyle, d->style) && d->ref.load() == 1) {
+ if (use_same_brushdata(newStyle, d->style) && d->ref.loadRelaxed() == 1) {
d->style = newStyle;
return;
}
@@ -625,7 +625,7 @@ void QBrush::detach(Qt::BrushStyle newStyle)
x.reset(new QBrushData);
break;
}
- x->ref.store(1); // must be first lest the QBrushDataPointerDeleter turns into a no-op
+ x->ref.storeRelaxed(1); // must be first lest the QBrushDataPointerDeleter turns into a no-op
x->style = newStyle;
x->color = d->color;
x->transform = d->transform;
diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h
index 43e1eb7472..6a4ffab1c5 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -159,7 +159,7 @@ inline Qt::BrushStyle QBrush::style() const { return d->style; }
inline const QColor &QBrush::color() const { return d->color; }
inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); }
inline QTransform QBrush::transform() const { return d->transform; }
-inline bool QBrush::isDetached() const { return d->ref.load() == 1; }
+inline bool QBrush::isDetached() const { return d->ref.loadRelaxed() == 1; }
/*******************************************************************************
diff --git a/src/gui/painting/qcolorspace_p.h b/src/gui/painting/qcolorspace_p.h
index a49c46f195..95e0655d0c 100644
--- a/src/gui/painting/qcolorspace_p.h
+++ b/src/gui/painting/qcolorspace_p.h
@@ -123,7 +123,7 @@ public:
table[0] = other.table[0];
table[1] = other.table[1];
table[2] = other.table[2];
- generated.store(1);
+ generated.storeRelaxed(1);
}
}
QSharedPointer<QColorTrcLut> &operator[](int i) { return table[i]; }
diff --git a/src/gui/painting/qcolortransform.cpp b/src/gui/painting/qcolortransform.cpp
index 2f81449693..de08bf4221 100644
--- a/src/gui/painting/qcolortransform.cpp
+++ b/src/gui/painting/qcolortransform.cpp
@@ -71,7 +71,7 @@ void QColorTransformPrivate::updateLutsIn() const
if (colorSpaceIn->lut.generated.loadAcquire())
return;
QMutexLocker lock(&QColorSpacePrivate::s_lutWriteLock);
- if (colorSpaceIn->lut.generated.load())
+ if (colorSpaceIn->lut.generated.loadRelaxed())
return;
for (int i = 0; i < 3; ++i) {
@@ -96,7 +96,7 @@ void QColorTransformPrivate::updateLutsOut() const
if (colorSpaceOut->lut.generated.loadAcquire())
return;
QMutexLocker lock(&QColorSpacePrivate::s_lutWriteLock);
- if (colorSpaceOut->lut.generated.load())
+ if (colorSpaceOut->lut.generated.loadRelaxed())
return;
for (int i = 0; i < 3; ++i) {
if (!colorSpaceOut->trc[i].isValid())
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index a0db35ebd3..70ad6bdc97 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -578,7 +578,7 @@ QPainterPath::QPainterPath(const QPointF &startPoint)
void QPainterPath::detach()
{
- if (d_ptr->ref.load() != 1)
+ if (d_ptr->ref.loadRelaxed() != 1)
detach_helper();
setDirty(true);
}
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index 4eb541ec65..22bdbde2a9 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -281,7 +281,7 @@ inline bool QPainterPathData::isClosed() const
inline void QPainterPathData::close()
{
- Q_ASSERT(ref.load() == 1);
+ Q_ASSERT(ref.loadRelaxed() == 1);
require_moveTo = true;
const QPainterPath::Element &first = elements.at(cStart);
QPainterPath::Element &last = elements.last();
@@ -308,7 +308,7 @@ inline void QPainterPathData::maybeMoveTo()
inline void QPainterPathData::clear()
{
- Q_ASSERT(ref.load() == 1);
+ Q_ASSERT(ref.loadRelaxed() == 1);
elements.clear();
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index 58a1716037..dc6e3e04d0 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -363,13 +363,13 @@ QPen::~QPen()
void QPen::detach()
{
- if (d->ref.load() == 1)
+ if (d->ref.loadRelaxed() == 1)
return;
QPenData *x = new QPenData(*static_cast<QPenData *>(d));
if (!d->ref.deref())
delete d;
- x->ref.store(1);
+ x->ref.storeRelaxed(1);
d = x;
}
@@ -885,7 +885,7 @@ bool QPen::operator==(const QPen &p) const
bool QPen::isDetached()
{
- return d->ref.load() == 1;
+ return d->ref.loadRelaxed() == 1;
}