From 6476ac738ca029af95932f53b53f0705808eb80e Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 29 Sep 2011 11:50:08 +0200 Subject: Replace implicit QAtomic* casts with explicit load()/store() Change-Id: Ia7ef1a8e01001f203e409c710c977d6f4686342e Reviewed-by: Thiago Macieira --- src/gui/painting/qbrush.cpp | 8 ++++---- src/gui/painting/qbrush.h | 2 +- src/gui/painting/qpainterpath.h | 2 +- src/gui/painting/qpainterpath_p.h | 2 +- src/gui/painting/qpen.cpp | 7 +++---- 5 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index d1130a8812..b4aa27db2f 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -343,7 +343,7 @@ public: QBrushData *brush; QNullBrushData() : brush(new QBrushData) { - brush->ref = 1; + brush->ref.store(1); brush->style = Qt::BrushStyle(0); brush->color = Qt::black; } @@ -402,7 +402,7 @@ void QBrush::init(const QColor &color, Qt::BrushStyle style) d.reset(new QBrushData); break; } - d->ref = 1; + d->ref.store(1); d->style = style; d->color = color; } @@ -577,7 +577,7 @@ void QBrush::cleanUp(QBrushData *x) void QBrush::detach(Qt::BrushStyle newStyle) { - if (newStyle == d->style && d->ref == 1) + if (newStyle == d->style && d->ref.load() == 1) return; QScopedPointer x; @@ -605,7 +605,7 @@ void QBrush::detach(Qt::BrushStyle newStyle) x.reset(new QBrushData); break; } - x->ref = 1; + x->ref.store(1); 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 80d9b43f1f..daad47cb19 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -174,7 +174,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 == 1; } +inline bool QBrush::isDetached() const { return d->ref.load() == 1; } /******************************************************************************* diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index a2dfed63c8..9dc435f630 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -419,7 +419,7 @@ inline void QPainterPath::setElementPositionAt(int i, qreal x, qreal y) inline void QPainterPath::detach() { - if (d_ptr->ref != 1) + if (d_ptr->ref.load() != 1) detach_helper(); setDirty(true); } diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 1b5da7ee17..93cc11c8ee 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -245,7 +245,7 @@ inline bool QPainterPathData::isClosed() const inline void QPainterPathData::close() { - Q_ASSERT(ref == 1); + Q_ASSERT(ref.load() == 1); require_moveTo = true; const QPainterPath::Element &first = elements.at(cStart); QPainterPath::Element &last = elements.last(); diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index a79e3a0cd2..5a4582e31e 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -230,10 +230,9 @@ typedef QPenPrivate QPenData; */ inline QPenPrivate::QPenPrivate(const QBrush &_brush, qreal _width, Qt::PenStyle penStyle, Qt::PenCapStyle _capStyle, Qt::PenJoinStyle _joinStyle) - : dashOffset(0), miterLimit(2), + : ref(1), dashOffset(0), miterLimit(2), cosmetic(false) { - ref = 1; width = _width; brush = _brush; style = penStyle; @@ -353,7 +352,7 @@ QPen::~QPen() void QPen::detach() { - if (d->ref == 1) + if (d->ref.load() == 1) return; QPenData *x = new QPenData(*static_cast(d)); @@ -860,7 +859,7 @@ bool QPen::operator==(const QPen &p) const bool QPen::isDetached() { - return d->ref == 1; + return d->ref.load() == 1; } -- cgit v1.2.3