diff options
Diffstat (limited to 'src/gui/painting/qregion.cpp')
-rw-r--r-- | src/gui/painting/qregion.cpp | 56 |
1 files changed, 10 insertions, 46 deletions
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 6ca87cb416..8b712ee46d 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qregion.h" #include "qpainterpath.h" @@ -48,6 +12,7 @@ #include "qbitmap.h" #include "qtransform.h" +#include <memory> #include <private/qdebug_p.h> #ifdef Q_OS_WIN @@ -86,7 +51,7 @@ QT_BEGIN_NAMESPACE contains() a QPoint or QRect. The bounding rectangle can be found with boundingRect(). - Iteration over the region (with begin(), end(), or C++11 + Iteration over the region (with begin(), end(), or ranged-for loops) gives a decomposition of the region into rectangles. @@ -671,7 +636,7 @@ bool QRegion::intersects(const QRegion ®ion) const */ -#if !defined (Q_OS_UNIX) && !defined (Q_OS_WIN) || defined(Q_CLANG_QDOC) +#if !defined (Q_OS_UNIX) && !defined (Q_OS_WIN) || defined(Q_QDOC) /* \overload \since 4.4 @@ -3226,8 +3191,7 @@ static void CreateETandAET(int count, const QPoint *pts, int iSLLBlock = 0; int dy; - if (count < 2) - return; + Q_ASSERT(count > 1); /* * initialize the Active Edge Table @@ -3573,7 +3537,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) POINTBLOCK *tmpPtBlock; int numFullPtBlocks = 0; - Q_ASSUME(Count > 1); + Q_ASSERT(Count > 1); region = new QRegionPrivate; @@ -3853,7 +3817,7 @@ QRegion::QRegion(const QRect &r, RegionType t) QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule) { - if (a.count() > 2) { + if (a.size() > 2) { QRegionPrivate *qt_rgn = PolygonRegion(a.constData(), a.size(), fillRule == Qt::WindingFill ? WindingRule : EvenOddRule); if (qt_rgn) { @@ -3915,7 +3879,7 @@ QRegion &QRegion::operator=(const QRegion &r) QRegion QRegion::copy() const { QRegion r; - QScopedPointer<QRegionData> x(new QRegionData); + auto x = std::make_unique<QRegionData>(); x->ref.initializeOwned(); if (d->qt_rgn) x->qt_rgn = new QRegionPrivate(*d->qt_rgn); @@ -3923,7 +3887,7 @@ QRegion QRegion::copy() const x->qt_rgn = new QRegionPrivate; if (!r.d->ref.deref()) cleanUp(r.d); - r.d = x.take(); + r.d = x.release(); return r; } |