diff options
Diffstat (limited to 'src/gui/painting/qdrawhelper_p.h')
-rw-r--r-- | src/gui/painting/qdrawhelper_p.h | 76 |
1 files changed, 14 insertions, 62 deletions
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 2881d8a4f4..833ddd7b16 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -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 #ifndef QDRAWHELPER_P_H #define QDRAWHELPER_P_H @@ -65,13 +29,13 @@ #include "private/qrasterdefs_p.h" #include <private/qsimd_p.h> -#include <QtCore/qsharedpointer.h> +#include <memory> QT_BEGIN_NAMESPACE #if defined(Q_CC_GNU) # define Q_DECL_RESTRICT __restrict__ -# if defined(Q_PROCESSOR_X86_32) && defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) +# if defined(Q_PROCESSOR_X86_32) && defined(Q_CC_GNU) && !defined(Q_CC_CLANG) # define Q_DECL_VECTORCALL __attribute__((sseregparm,regparm(3))) # else # define Q_DECL_VECTORCALL @@ -89,13 +53,6 @@ static const uint RMASK = 0x00ff0000; static const uint GMASK = 0x0000ff00; static const uint BMASK = 0x000000ff; -/******************************************************************************* - * QSpan - * - * duplicate definition of FT_Span - */ -typedef QT_FT_Span QSpan; - struct QSolidData; struct QTextureData; struct QGradientData; @@ -183,9 +140,9 @@ struct quint24 { uchar data[3]; }; -void qBlendGradient(int count, const QSpan *spans, void *userData); -void qBlendTexture(int count, const QSpan *spans, void *userData); -#ifdef __SSE2__ +void qBlendGradient(int count, const QT_FT_Span *spans, void *userData); +void qBlendTexture(int count, const QT_FT_Span *spans, void *userData); +#ifdef Q_PROCESSOR_X86 extern void (*qt_memfill64)(quint64 *dest, quint64 value, qsizetype count); extern void (*qt_memfill32)(quint32 *dest, quint32 value, qsizetype count); #else @@ -217,7 +174,6 @@ struct RadialGradientValues qreal dr; qreal sqrfr; qreal a; - qreal inv2a; bool extended; }; @@ -368,20 +324,16 @@ struct QSpanData uint fast_matrix : 1; bool bilinear; QImage *tempImage; - QRgba64 solidColor; + QColor solidColor; union { QGradientData gradient; QTextureData texture; }; - class Pinnable { - protected: - ~Pinnable() {} - }; // QSharedPointer<const void> is not supported - QSharedPointer<const Pinnable> cachedGradient; + std::shared_ptr<const void> cachedGradient; void init(QRasterBuffer *rb, const QRasterPaintEngine *pe); - void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode); + void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode, bool isCosmetic); void setupMatrix(const QTransform &matrix, int bilinear); void initTexture(const QImage *image, int alpha, QTextureData::Type = QTextureData::Plain, const QRect &sourceRect = QRect()); void adjustSpanMethods(); @@ -449,12 +401,12 @@ const BlendType * QT_FASTCALL qt_fetch_radial_gradient_template(BlendType *buffe bool affine = !data->m13 && !data->m23; BlendType *end = buffer + length; + qreal inv_a = 1 / qreal(2 * op->radial.a); + if (affine) { rx -= data->gradient.radial.focal.x; ry -= data->gradient.radial.focal.y; - qreal inv_a = 1 / qreal(2 * op->radial.a); - const qreal delta_rx = data->m11; const qreal delta_ry = data->m12; @@ -499,8 +451,8 @@ const BlendType * QT_FASTCALL qt_fetch_radial_gradient_template(BlendType *buffe if (det >= 0) { qreal detSqrt = qSqrt(det); - qreal s0 = (-b - detSqrt) * op->radial.inv2a; - qreal s1 = (-b + detSqrt) * op->radial.inv2a; + qreal s0 = (-b - detSqrt) * inv_a; + qreal s1 = (-b + detSqrt) * inv_a; qreal s = qMax(s0, s1); |