diff options
Diffstat (limited to 'src/gui/painting')
106 files changed, 1592 insertions, 3894 deletions
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 579c0bc2a9..6ee1beaa3c 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -42,11 +42,11 @@ HEADERS += \ painting/qrasterdefs_p.h \ painting/qrasterizer_p.h \ painting/qregion.h \ + painting/qrgb.h \ painting/qstroker_p.h \ painting/qtextureglyphcache_p.h \ painting/qtransform.h \ painting/qplatformbackingstore.h \ - painting/qpaintbuffer_p.h \ painting/qpathsimplifier_p.h @@ -89,7 +89,6 @@ SOURCES += \ painting/qtextureglyphcache.cpp \ painting/qtransform.cpp \ painting/qplatformbackingstore.cpp \ - painting/qpaintbuffer.cpp \ painting/qpathsimplifier.cpp SSE2_SOURCES += painting/qdrawhelper_sse2.cpp diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 4298c0c447..19074e4c47 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qbackingstore.h b/src/gui/painting/qbackingstore.h index 86bd77d124..ee3c05f7a9 100644 --- a/src/gui/painting/qbackingstore.h +++ b/src/gui/painting/qbackingstore.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index a741c94c16..8e0e76f787 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -40,7 +40,6 @@ #include <qmath.h> #include <private/qnumeric_p.h> -#include <private/qmath_p.h> QT_BEGIN_NAMESPACE @@ -363,7 +362,7 @@ static bool addCircle(const QBezier *b, qreal offset, QBezier *o) cos_a = 1.; if (cos_a < -1.) cos_a = -1; - angles[i] = qAcos(cos_a)/Q_PI; + angles[i] = qAcos(cos_a) * qreal(M_1_PI); } if (angles[0] + angles[1] > 1.) { diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h index 3251cdeccb..dd1cd94acf 100644 --- a/src/gui/painting/qbezier_p.h +++ b/src/gui/painting/qbezier_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 2da5dbb356..1564e25016 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -764,7 +764,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGRs30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_Mono 0, // Format_Invalid, @@ -789,7 +791,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_MonoLSB 0, // Format_Invalid, @@ -814,7 +818,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_Indexed8 0, // Format_Invalid, @@ -839,7 +845,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB32 0, // Format_Invalid, @@ -864,7 +872,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB32 0, // Format_Invalid, @@ -889,7 +899,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB32_Premultiplied 0, // Format_Invalid, @@ -914,7 +926,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB16 0, // Format_Invalid, @@ -939,7 +953,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB8565_Premultiplied 0, // Format_Invalid, @@ -964,7 +980,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB666 0, // Format_Invalid, @@ -989,7 +1007,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB6666_Premultiplied 0, // Format_Invalid, @@ -1014,7 +1034,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB555 0, // Format_Invalid, @@ -1039,7 +1061,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB8555_Premultiplied 0, // Format_Invalid, @@ -1064,7 +1088,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB888 0, // Format_Invalid, @@ -1089,7 +1115,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB444 0, // Format_Invalid, @@ -1114,7 +1142,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB4444_Premultiplied 0, // Format_Invalid, @@ -1139,7 +1169,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGBX8888 0, // Format_Invalid, @@ -1170,7 +1202,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGBA8888 0, // Format_Invalid, @@ -1195,7 +1229,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGBA8888_Premultiplied 0, // Format_Invalid, @@ -1226,7 +1262,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_BGR30 0, // Format_Invalid, @@ -1251,7 +1289,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_A2BGR30_Premultiplied 0, // Format_Invalid, @@ -1276,7 +1316,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB30 0, // Format_Invalid, @@ -1301,7 +1343,9 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_A2RGB30_Premultiplied 0, // Format_Invalid, @@ -1326,8 +1370,64 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 + }, + { // Format_Alpha8 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, + { // Format_Grayscale8 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 + } }; @@ -1355,7 +1455,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_Mono 0, // Format_Invalid, @@ -1380,7 +1482,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_MonoLSB 0, // Format_Invalid, @@ -1405,7 +1509,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_Indexed8 0, // Format_Invalid, @@ -1430,7 +1536,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB32 0, // Format_Invalid, @@ -1455,7 +1563,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB32 0, // Format_Invalid, @@ -1480,7 +1590,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB32_Premultiplied 0, // Format_Invalid, @@ -1505,7 +1617,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB16 0, // Format_Invalid, @@ -1530,7 +1644,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB8565_Premultiplied 0, // Format_Invalid, @@ -1555,7 +1671,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB666 0, // Format_Invalid, @@ -1580,7 +1698,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB6666_Premultiplied 0, // Format_Invalid, @@ -1605,7 +1725,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB555 0, // Format_Invalid, @@ -1630,7 +1752,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB8555_Premultiplied 0, // Format_Invalid, @@ -1655,7 +1779,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB888 0, // Format_Invalid, @@ -1680,7 +1806,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB444 0, // Format_Invalid, @@ -1705,7 +1833,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB4444_Premultiplied 0, // Format_Invalid, @@ -1730,7 +1860,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGBX8888 0, // Format_Invalid, @@ -1761,7 +1893,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGBA8888 0, // Format_Invalid, @@ -1786,7 +1920,9 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGBA8888_Premultiplied 0, // Format_Invalid, @@ -1818,6 +1954,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_BGR30 0, // Format_Invalid, @@ -1843,6 +1981,7 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = qt_blend_a2rgb30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied, qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_RGB30, qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied, + 0, 0, }, { // Format_A2BGR30_Premultiplied 0, // Format_Invalid, @@ -1868,6 +2007,7 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = qt_blend_a2rgb30pm_on_a2rgb30pm, // Format_A2BGR30_Premultiplied, qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_RGB30, qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied, + 0, 0, }, { // Format_RGB30 0, // Format_Invalid, @@ -1893,6 +2033,7 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2BGR30_Premultiplied, qt_blend_rgb30_on_rgb30, // Format_RGB30, qt_blend_a2rgb30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied, + 0, 0, }, { // Format_A2RGB30_Premultiplied 0, // Format_Invalid, @@ -1917,8 +2058,63 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_BGR30, qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2BGR30_Premultiplied, qt_blend_rgb30_on_rgb30, // Format_RGB30, - qt_blend_a2rgb30pm_on_a2rgb30pm // Format_A2RGB30_Premultiplied, + qt_blend_a2rgb30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied, + 0, 0, + }, + { // Format_Alpha8 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, + { // Format_Grayscale8 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 + } }; SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats] = { @@ -1945,7 +2141,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_Mono 0, // Format_Invalid, @@ -1970,7 +2168,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_MonoLSB 0, // Format_Invalid, @@ -1995,7 +2195,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_Indexed8 0, // Format_Invalid, @@ -2020,7 +2222,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB32 0, // Format_Invalid, @@ -2045,7 +2249,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB32 0, // Format_Invalid, @@ -2070,7 +2276,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB32_Premultiplied 0, // Format_Invalid, @@ -2095,7 +2303,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB16 0, // Format_Invalid, @@ -2120,7 +2330,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB8565_Premultiplied 0, // Format_Invalid, @@ -2145,7 +2357,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB666 0, // Format_Invalid, @@ -2170,7 +2384,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB6666_Premultiplied 0, // Format_Invalid, @@ -2195,7 +2411,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB555 0, // Format_Invalid, @@ -2220,7 +2438,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB8555_Premultiplied 0, // Format_Invalid, @@ -2245,7 +2465,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB888 0, // Format_Invalid, @@ -2270,7 +2492,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB444 0, // Format_Invalid, @@ -2295,7 +2519,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_ARGB4444_Premultiplied 0, // Format_Invalid, @@ -2320,7 +2546,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGBX8888 0, // Format_Invalid, @@ -2351,7 +2579,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGBA8888 0, // Format_Invalid, @@ -2376,7 +2606,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGBA8888_Premultiplied 0, // Format_Invalid, @@ -2407,7 +2639,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_BGR30 0, // Format_Invalid, @@ -2432,7 +2666,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_A2BGR30_Premultiplied 0, // Format_Invalid, @@ -2457,7 +2693,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_RGB30 0, // Format_Invalid, @@ -2482,7 +2720,9 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, { // Format_A2RGB30_Premultiplied 0, // Format_Invalid, @@ -2507,7 +2747,63 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_BGR30, 0, // Format_A2BGR30_Premultiplied, 0, // Format_RGB30, - 0 // Format_A2RGB30_Premultiplied, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 + }, + { // Format_Alpha8 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 + }, + { // Format_Grayscale8 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0, // Format_A2RGB30_Premultiplied, + 0, // Format_Alpha8 + 0, // Format_Grayscale8 }, }; diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h index f81f2be9b4..4435421cd0 100644 --- a/src/gui/painting/qblendfunctions_p.h +++ b/src/gui/painting/qblendfunctions_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qblittable.cpp b/src/gui/painting/qblittable.cpp index a3451c0cd3..a06b83c96a 100644 --- a/src/gui/painting/qblittable.cpp +++ b/src/gui/painting/qblittable.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h index 45ee4b0fdc..47218f2f35 100644 --- a/src/gui/painting/qblittable_p.h +++ b/src/gui/painting/qblittable_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index d136f3a903..27f28f7193 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -35,6 +35,7 @@ #include "qpixmap.h" #include "qbitmap.h" #include "qpixmapcache.h" +#include "qplatformpixmap.h" #include "qdatastream.h" #include "qvariant.h" #include "qline.h" @@ -950,9 +951,34 @@ bool QBrush::operator==(const QBrush &b) const switch (d->style) { case Qt::TexturePattern: { - const QPixmap &us = (static_cast<QTexturedBrushData *>(d.data()))->pixmap(); - const QPixmap &them = (static_cast<QTexturedBrushData *>(b.d.data()))->pixmap(); - return ((us.isNull() && them.isNull()) || us.cacheKey() == them.cacheKey()); + // Note this produces false negatives if the textures have identical data, + // but does not share the same data in memory. Since equality is likely to + // be used to avoid iterating over the data for a texture update, this should + // still be better than doing an accurate comparison. + const QPixmap *us = 0, *them = 0; + qint64 cacheKey1, cacheKey2; + if (qHasPixmapTexture(*this)) { + us = (static_cast<QTexturedBrushData *>(d.data()))->m_pixmap; + cacheKey1 = us->cacheKey(); + } else + cacheKey1 = (static_cast<QTexturedBrushData *>(d.data()))->image().cacheKey(); + + if (qHasPixmapTexture(b)) { + them = (static_cast<QTexturedBrushData *>(b.d.data()))->m_pixmap; + cacheKey2 = them->cacheKey(); + } else + cacheKey2 = (static_cast<QTexturedBrushData *>(b.d.data()))->image().cacheKey(); + + if (cacheKey1 != cacheKey2) + return false; + if (!us == !them) // both images or both pixmaps + return true; + // Only raster QPixmaps use the same cachekeys as QImages. + if (us && us->handle()->classId() == QPlatformPixmap::RasterClass) + return true; + if (them && them->handle()->classId() == QPlatformPixmap::RasterClass) + return true; + return false; } case Qt::LinearGradientPattern: case Qt::RadialGradientPattern: @@ -1029,7 +1055,10 @@ QDataStream &operator<<(QDataStream &s, const QBrush &b) s << style << b.color(); if (b.style() == Qt::TexturePattern) { - s << b.texture(); + if (s.version() >= QDataStream::Qt_5_5) + s << b.textureImage(); + else + s << b.texture(); } else if (s.version() >= QDataStream::Qt_4_0 && gradient_style) { const QGradient *gradient = b.gradient(); int type_as_int = int(gradient->type()); @@ -1089,10 +1118,17 @@ QDataStream &operator>>(QDataStream &s, QBrush &b) QColor color; s >> style; s >> color; + b = QBrush(color); if (style == Qt::TexturePattern) { - QPixmap pm; - s >> pm; - b = QBrush(color, pm); + if (s.version() >= QDataStream::Qt_5_5) { + QImage img; + s >> img; + b.setTextureImage(qMove(img)); + } else { + QPixmap pm; + s >> pm; + b.setTexture(qMove(pm)); + } } else if (style == Qt::LinearGradientPattern || style == Qt::RadialGradientPattern || style == Qt::ConicalGradientPattern) { diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index ff652fe288..a3b88a50ef 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -167,7 +167,6 @@ typedef QVector<QGradientStop> QGradientStops; class Q_GUI_EXPORT QGradient { Q_GADGET - Q_ENUMS(Type Spread CoordinateMode) public: enum Type { LinearGradient, @@ -175,18 +174,21 @@ public: ConicalGradient, NoGradient }; + Q_ENUM(Type) enum Spread { PadSpread, ReflectSpread, RepeatSpread }; + Q_ENUM(Spread) enum CoordinateMode { LogicalMode, StretchToDeviceMode, ObjectBoundingMode }; + Q_ENUM(CoordinateMode) enum InterpolationMode { ColorInterpolation, @@ -235,7 +237,7 @@ private: qreal cx, cy, angle; } conical; } m_data; - void *dummy; + void *dummy; // ### Qt 6: replace with actual content (CoordinateMode, InterpolationMode, ...) }; inline void QGradient::setSpread(Spread aspread) diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 77fa989351..945b150375 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -38,7 +38,6 @@ #include "qvariant.h" #include "qdebug.h" -#include <math.h> #include <stdio.h> #include <limits.h> @@ -506,16 +505,13 @@ QString QColor::name() const QString QColor::name(NameFormat format) const { - QString s; switch (format) { case HexRgb: - s.sprintf("#%02x%02x%02x", red(), green(), blue()); - break; + return QString::asprintf("#%02x%02x%02x", red(), green(), blue()); case HexArgb: - s.sprintf("#%02x%02x%02x%02x", alpha(), red(), green(), blue()); - break; + return QString::asprintf("#%02x%02x%02x%02x", alpha(), red(), green(), blue()); } - return s; + return QString(); } /*! diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index b68504c865..06c218365b 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -65,7 +65,7 @@ public: QColor(QRgb rgb); QColor(const QString& name); QColor(const char *name); - QColor(const QColor &color); + QColor(const QColor &color); // ### Qt 6: remove, the trivial one is fine. QColor(Spec spec); bool isValid() const; diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp index 882d08f402..4ebe74ce4f 100644 --- a/src/gui/painting/qcolor_p.cpp +++ b/src/gui/painting/qcolor_p.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qcolor_p.h b/src/gui/painting/qcolor_p.h index 137a3f56e9..d896022ac1 100644 --- a/src/gui/painting/qcolor_p.h +++ b/src/gui/painting/qcolor_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index d179002127..93c95e4a86 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -34,7 +34,6 @@ #include "qcosmeticstroker_p.h" #include "private/qpainterpath_p.h" #include <qdebug.h> -#include <math.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h index d20b8a8e61..389163dac8 100644 --- a/src/gui/painting/qcosmeticstroker_p.h +++ b/src/gui/painting/qcosmeticstroker_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qcssutil.cpp b/src/gui/painting/qcssutil.cpp index dff258f138..e150b65920 100644 --- a/src/gui/painting/qcssutil.cpp +++ b/src/gui/painting/qcssutil.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qcssutil_p.h b/src/gui/painting/qcssutil_p.h index a2db1d07e4..fac6e55dda 100644 --- a/src/gui/painting/qcssutil_p.h +++ b/src/gui/painting/qcssutil_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h index c003a454e9..0a4a3d5c9e 100644 --- a/src/gui/painting/qdatabuffer_p.h +++ b/src/gui/painting/qdatabuffer_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 9c1b2e707d..20fd41e0ae 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -45,11 +45,11 @@ #include <private/qpaintengine_raster_p.h> #include <private/qpainter_p.h> #include <private/qdrawhelper_x86_p.h> +#include <private/qdrawingprimitive_sse2_p.h> #include <private/qdrawhelper_neon_p.h> #if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) || defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2) #include <private/qdrawhelper_mips_dsp_p.h> #endif -#include <private/qmath_p.h> #include <private/qguiapplication_p.h> #include <qmath.h> @@ -264,6 +264,29 @@ static const uint *QT_FASTCALL convertRGBFromRGB32(uint *buffer, const uint *src } template<QImage::Format Format> +static const uint *QT_FASTCALL convertARGBPMFromRGB32(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1); + Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); + Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); + Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); + + Q_CONSTEXPR uchar redRightShift = 24 - redWidth<Format>(); + Q_CONSTEXPR uchar greenRightShift = 16 - greenWidth<Format>(); + Q_CONSTEXPR uchar blueRightShift = 8 - blueWidth<Format>(); + + for (int i = 0; i < count; ++i) { + Q_CONSTEXPR uint alpha = (0xff & alphaMask) << alphaShift<Format>(); + const uint red = ((src[i] >> redRightShift) & redMask) << redShift<Format>(); + const uint green = ((src[i] >> greenRightShift) & greenMask) << greenShift<Format>(); + const uint blue = ((src[i] >> blueRightShift) & blueMask) << blueShift<Format>(); + buffer[i] = alpha | red | green | blue; + } + return buffer; +} + +template<QImage::Format Format> static const uint *QT_FASTCALL convertARGBPMFromARGB32PM(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) { @@ -311,7 +334,7 @@ template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixe true, bitsPerPixel<Format>(), convertARGBPMToARGB32PM<Format>, convertARGBPMFromARGB32PM<Format>, - 0 + convertARGBPMFromRGB32<Format> }; } @@ -443,12 +466,11 @@ static const uint *QT_FASTCALL convertFromRGB32(uint *buffer, const uint *src, i Q_ASSERT(layout->redWidth <= 8); Q_ASSERT(layout->greenWidth <= 8); Q_ASSERT(layout->blueWidth <= 8); - Q_ASSERT(layout->alphaWidth == 0); - Q_ASSERT(!layout->premultiplied); const uint redMask = (1 << layout->redWidth) - 1; const uint greenMask = (1 << layout->greenWidth) - 1; const uint blueMask = (1 << layout->blueWidth) - 1; + const uint alphaMask = (1 << layout->alphaWidth) - 1; const uchar redRightShift = 24 - layout->redWidth; const uchar greenRightShift = 16 - layout->greenWidth; @@ -458,7 +480,8 @@ static const uint *QT_FASTCALL convertFromRGB32(uint *buffer, const uint *src, i uint red = ((src[i] >> redRightShift) & redMask) << layout->redShift; uint green = ((src[i] >> greenRightShift) & greenMask) << layout->greenShift; uint blue = ((src[i] >> blueRightShift) & blueMask) << layout->blueShift; - buffer[i] = red | green | blue; + uint alpha = (0xff & alphaMask) << layout->alphaShift; + buffer[i] = red | green | blue | alpha; } return buffer; } @@ -503,14 +526,25 @@ static const uint *QT_FASTCALL convertPassThrough(uint *, const uint *src, int, return src; } -static const uint *QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) +static inline const uint *QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) { for (int i = 0; i < count; ++i) buffer[i] = qPremultiply(src[i]); return buffer; } +#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) && !defined(__SSE4_1__) +QT_FUNCTION_TARGET(SSE4_1) +static const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QPixelLayout *layout, const QRgb *clut) +{ + // Twice as fast autovectorized due to SSE4.1 PMULLD instructions. + return convertARGB32ToARGB32PM(buffer, src, count, layout, clut); +} +#endif + + static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) { @@ -519,14 +553,40 @@ static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const u return buffer; } -static const uint *QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) +static inline const uint *QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) { for (int i = 0; i < count; ++i) buffer[i] = qPremultiply(RGBA2ARGB(src[i])); return buffer; } +#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) && !defined(__SSE4_1__) +QT_FUNCTION_TARGET(SSE4_1) +static const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QPixelLayout *layout, const QRgb *clut) +{ + // Twice as fast autovectorized due to SSE4.1 PMULLD instructions. + return convertRGBA8888ToARGB32PM(buffer, src, count, layout, clut); +} +#endif + +static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qRgba(0, 0, 0, src[i]); + return buffer; +} + +static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qRgb(src[i], src[i], src[i]); + return buffer; +} + static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) { @@ -535,6 +595,18 @@ static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uin return buffer; } +#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) +QT_FUNCTION_TARGET(SSE4_1) +static const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qUnpremultiply_sse4(src[i]); + return buffer; +} +#endif + + static const uint *QT_FASTCALL convertRGBA8888PMFromARGB32PM(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) { @@ -551,6 +623,17 @@ static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const u return buffer; } +#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) +QT_FUNCTION_TARGET(SSE4_1) +static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = ARGB2RGBA(qUnpremultiply_sse4(src[i])); + return buffer; +} +#endif + static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) { @@ -567,6 +650,17 @@ static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint return buffer; } +#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) +QT_FUNCTION_TARGET(SSE4_1) +static const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply_sse4(src[i])); + return buffer; +} +#endif + template<QtPixelOrder PixelOrder> static const uint *QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) @@ -603,6 +697,30 @@ static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint return buffer; } +static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qAlpha(src[i]); + return buffer; +} + +static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qGray(src[i]); + return buffer; +} + +static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qGray(qUnpremultiply(src[i])); + return buffer; +} + template <QPixelLayout::BPP bpp> static uint QT_FASTCALL fetchPixel(const uchar *src, int index); @@ -718,10 +836,10 @@ QPixelLayout qPixelLayouts[QImage::NImageFormats] = { { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP1LSB, convertIndexedToARGB32PM, 0, 0 }, // Format_MonoLSB { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP8, convertIndexedToARGB32PM, 0, 0 }, // Format_Indexed8 // Technically using convertPassThrough to convert from ARGB32PM to RGB32 is wrong, - // but everywhere this generic conversion would be wrong is currently overloaed. + // but everywhere this generic conversion would be wrong is currently overloaded. { 8, 16, 8, 8, 8, 0, 0, 0, false, QPixelLayout::BPP32, convertPassThrough, convertPassThrough, convertPassThrough }, // Format_RGB32 - { 8, 16, 8, 8, 8, 0, 8, 24, false, QPixelLayout::BPP32, convertARGB32ToARGB32PM, convertARGB32FromARGB32PM, 0 }, // Format_ARGB32 - { 8, 16, 8, 8, 8, 0, 8, 24, true, QPixelLayout::BPP32, convertPassThrough, convertPassThrough, 0 }, // Format_ARGB32_Premultiplied + { 8, 16, 8, 8, 8, 0, 8, 24, false, QPixelLayout::BPP32, convertARGB32ToARGB32PM, convertARGB32FromARGB32PM, convertPassThrough }, // Format_ARGB32 + { 8, 16, 8, 8, 8, 0, 8, 24, true, QPixelLayout::BPP32, convertPassThrough, convertPassThrough, convertPassThrough }, // Format_ARGB32_Premultiplied #ifdef Q_COMPILER_CONSTEXPR pixelLayoutRGB<QImage::Format_RGB16>(), pixelLayoutARGBPM<QImage::Format_ARGB8565_Premultiplied>(), @@ -734,28 +852,30 @@ QPixelLayout qPixelLayouts[QImage::NImageFormats] = { pixelLayoutARGBPM<QImage::Format_ARGB4444_Premultiplied>(), #else { 5, 11, 6, 5, 5, 0, 0, 0, false, QPixelLayout::BPP16, convertRGB16ToRGB32, convertRGB16FromARGB32PM, convertRGB16FromRGB32 }, // Format_RGB16 - { 5, 19, 6, 13, 5, 8, 8, 0, true, QPixelLayout::BPP24, convertToARGB32PM, convertFromARGB32PM, 0 }, // Format_ARGB8565_Premultiplied + { 5, 19, 6, 13, 5, 8, 8, 0, true, QPixelLayout::BPP24, convertToARGB32PM, convertFromARGB32PM, convertFromRGB32 }, // Format_ARGB8565_Premultiplied { 6, 12, 6, 6, 6, 0, 0, 0, false, QPixelLayout::BPP24, convertToRGB32, convertFromARGB32PM, convertFromRGB32 }, // Format_RGB666 - { 6, 12, 6, 6, 6, 0, 6, 18, true, QPixelLayout::BPP24, convertToARGB32PM, convertFromARGB32PM, 0 }, // Format_ARGB6666_Premultiplied + { 6, 12, 6, 6, 6, 0, 6, 18, true, QPixelLayout::BPP24, convertToARGB32PM, convertFromARGB32PM, convertFromRGB32 }, // Format_ARGB6666_Premultiplied { 5, 10, 5, 5, 5, 0, 0, 0, false, QPixelLayout::BPP16, convertToRGB32, convertFromARGB32PM, convertFromRGB32 }, // Format_RGB555 - { 5, 18, 5, 13, 5, 8, 8, 0, true, QPixelLayout::BPP24, convertToARGB32PM, convertFromARGB32PM, 0 }, // Format_ARGB8555_Premultiplied + { 5, 18, 5, 13, 5, 8, 8, 0, true, QPixelLayout::BPP24, convertToARGB32PM, convertFromARGB32PM, convertFromRGB32 }, // Format_ARGB8555_Premultiplied { 8, 16, 8, 8, 8, 0, 0, 0, false, QPixelLayout::BPP24, convertToRGB32, convertFromARGB32PM, convertFromRGB32 }, // Format_RGB888 { 4, 8, 4, 4, 4, 0, 0, 0, false, QPixelLayout::BPP16, convertToRGB32, convertFromARGB32PM, convertFromRGB32 }, // Format_RGB444 - { 4, 8, 4, 4, 4, 0, 4, 12, true, QPixelLayout::BPP16, convertToARGB32PM, convertFromARGB32PM, 0 }, // Format_ARGB4444_Premultiplied + { 4, 8, 4, 4, 4, 0, 4, 12, true, QPixelLayout::BPP16, convertToARGB32PM, convertFromARGB32PM, convertFromRGB32 }, // Format_ARGB4444_Premultiplied #endif #if Q_BYTE_ORDER == Q_BIG_ENDIAN { 8, 24, 8, 16, 8, 8, 0, 0, false, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBXFromARGB32PM, convertRGBXFromRGB32 }, // Format_RGBX8888 - { 8, 24, 8, 16, 8, 8, 8, 0, false, QPixelLayout::BPP32, convertRGBA8888ToARGB32PM, convertRGBA8888FromARGB32PM, 0 }, // Format_RGBA8888 - { 8, 24, 8, 16, 8, 8, 8, 0, true, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBA8888PMFromARGB32PM, 0 }, // Format_RGBA8888_Premultiplied + { 8, 24, 8, 16, 8, 8, 8, 0, false, QPixelLayout::BPP32, convertRGBA8888ToARGB32PM, convertRGBA8888FromARGB32PM, convertRGBXFromRGB32 }, // Format_RGBA8888 + { 8, 24, 8, 16, 8, 8, 8, 0, true, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBA8888PMFromARGB32PM, convertRGBXFromRGB32}, // Format_RGBA8888_Premultiplied #else { 8, 0, 8, 8, 8, 16, 0, 24, false, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBXFromARGB32PM, convertRGBXFromRGB32 }, // Format_RGBX8888 - { 8, 0, 8, 8, 8, 16, 8, 24, false, QPixelLayout::BPP32, convertRGBA8888ToARGB32PM, convertRGBA8888FromARGB32PM, 0 }, // Format_RGBA8888 (ABGR32) - { 8, 0, 8, 8, 8, 16, 8, 24, true, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBA8888PMFromARGB32PM, 0 }, // Format_RGBA8888_Premultiplied + { 8, 0, 8, 8, 8, 16, 8, 24, false, QPixelLayout::BPP32, convertRGBA8888ToARGB32PM, convertRGBA8888FromARGB32PM, convertRGBXFromRGB32 }, // Format_RGBA8888 (ABGR32) + { 8, 0, 8, 8, 8, 16, 8, 24, true, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBA8888PMFromARGB32PM, convertRGBXFromRGB32 }, // Format_RGBA8888_Premultiplied #endif { 10, 20, 10, 10, 10, 0, 0, 30, false, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderBGR>, convertRGB30FromARGB32PM<PixelOrderBGR>, convertRGB30FromRGB32<PixelOrderBGR> }, // Format_BGR30 - { 10, 20, 10, 10, 10, 0, 2, 30, true, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderBGR>, convertA2RGB30PMFromARGB32PM<PixelOrderBGR>, 0 }, // Format_A2BGR30_Premultiplied + { 10, 20, 10, 10, 10, 0, 2, 30, true, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderBGR>, convertA2RGB30PMFromARGB32PM<PixelOrderBGR>, convertRGB30FromRGB32<PixelOrderBGR> }, // Format_A2BGR30_Premultiplied { 10, 0, 10, 10, 10, 20, 0, 30, false, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderRGB>, convertRGB30FromARGB32PM<PixelOrderRGB>, convertRGB30FromRGB32<PixelOrderRGB> }, // Format_RGB30 - { 10, 0, 10, 10, 10, 20, 2, 30, true, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderRGB>, convertA2RGB30PMFromARGB32PM<PixelOrderRGB>, 0 }, // Format_A2RGB30_Premultiplied + { 10, 0, 10, 10, 10, 20, 2, 30, true, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderRGB>, convertA2RGB30PMFromARGB32PM<PixelOrderRGB>, convertRGB30FromRGB32<PixelOrderRGB> }, // Format_A2RGB30_Premultiplied + { 0, 0, 0, 0, 0, 0, 8, 0, false, QPixelLayout::BPP8, convertAlpha8ToRGB32, convertAlpha8FromARGB32PM, 0 }, // Format_Alpha8 + { 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP8, convertGrayscale8ToRGB32, convertGrayscale8FromARGB32PM, convertGrayscale8FromRGB32 } // Format_Grayscale8 }; FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = { @@ -867,6 +987,8 @@ static DestFetchProc destFetchProc[QImage::NImageFormats] = destFetch, // Format_A2BGR30_Premultiplied destFetch, // Format_RGB30 destFetch, // Format_A2RGB30_Premultiplied + destFetch, // Format_Alpha8 + destFetch, // Format_Grayscale8 }; /* @@ -974,10 +1096,9 @@ static void QT_FASTCALL destStore(QRasterBuffer *rasterBuffer, int x, int y, con while (length) { int l = qMin(length, buffer_size); const uint *ptr = 0; - if (layout->convertFromRGB32) { - Q_ASSERT(!layout->premultiplied && !layout->alphaWidth); + if (!layout->premultiplied && !layout->alphaWidth) ptr = layout->convertFromRGB32(buf, buffer, l, layout, 0); - } else + else ptr = layout->convertFromARGB32PM(buf, buffer, l, layout, 0); store(dest, ptr, x, l); length -= l; @@ -1011,6 +1132,8 @@ static DestStoreProc destStoreProc[QImage::NImageFormats] = destStore, // Format_A2BGR30_Premultiplied destStore, // Format_RGB30 destStore, // Format_A2RGB30_Premultiplied + destStore, // Format_Alpha8 + destStore, // Format_Grayscale8 }; /* @@ -1560,7 +1683,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c b++; fx += fdx; } - } else if ((fdx < 0 && fdx > -(fixed_scale / 8)) || fabs(data->m22) < (1./8.)) { // scale up more than 8x + } else if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x int y1 = (fy >> 16); int y2; fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2); @@ -1719,7 +1842,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c } } } else { //rotation - if (fabs(data->m11) > 8 || fabs(data->m22) > 8) { + if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) { //if we are zooming more than 8 times, we use 8bit precision for the position. while (b < end) { int x1 = (fx >> 16); @@ -2072,7 +2195,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); - if ((fdx < 0 && fdx > -(fixed_scale / 8)) || fabs(data->m22) < (1./8.)) { // scale up more than 8x + if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x int disty = (fy & 0x0000ffff) >> 8; for (int i = 0; i < len; ++i) { uint tl = buf1[i * 2 + 0]; @@ -2131,7 +2254,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut); layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut); - if (fabs(data->m11) > 8 || fabs(data->m22) > 8) { + if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) { //if we are zooming more than 8 times, we use 8bit precision for the position. for (int i = 0; i < len; ++i) { uint tl = buf1[i * 2 + 0]; @@ -2266,6 +2389,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchUntransformed, // Format_A2BGR30_Premultiplied fetchUntransformed, // Format_RGB30 fetchUntransformed, // Format_A2RGB30_Premultiplied + fetchUntransformed, // Alpha8 + fetchUntransformed, // Grayscale8 }, // Tiled { @@ -2291,7 +2416,9 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchUntransformed, // BGR30 fetchUntransformed, // A2BGR30_Premultiplied fetchUntransformed, // RGB30 - fetchUntransformed // A2RGB30_Premultiplied + fetchUntransformed, // A2RGB30_Premultiplied + fetchUntransformed, // Alpha8 + fetchUntransformed, // Grayscale8 }, // Transformed { @@ -2318,6 +2445,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchTransformed<BlendTransformed>, // A2BGR30_Premultiplied fetchTransformed<BlendTransformed>, // RGB30 fetchTransformed<BlendTransformed>, // A2RGB30_Premultiplied + fetchTransformed<BlendTransformed>, // Alpah8 + fetchTransformed<BlendTransformed>, // Grayscale8 }, { 0, // TransformedTiled @@ -2343,6 +2472,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchTransformed<BlendTransformedTiled>, // A2BGR30_Premultiplied fetchTransformed<BlendTransformedTiled>, // RGB30 fetchTransformed<BlendTransformedTiled>, // A2RGB30_Premultiplied + fetchTransformed<BlendTransformedTiled>, // Alpha8 + fetchTransformed<BlendTransformedTiled>, // Grayscale8 }, { 0, // Bilinear @@ -2368,6 +2499,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchTransformedBilinear<BlendTransformedBilinear>, // A2BGR30_Premultiplied fetchTransformedBilinear<BlendTransformedBilinear>, // RGB30 fetchTransformedBilinear<BlendTransformedBilinear>, // A2RGB30_Premultiplied + fetchTransformedBilinear<BlendTransformedBilinear>, // Alpha8 + fetchTransformedBilinear<BlendTransformedBilinear>, // Grayscale8 }, { 0, // BilinearTiled @@ -2392,7 +2525,9 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchTransformedBilinear<BlendTransformedBilinearTiled>, // BGR30 fetchTransformedBilinear<BlendTransformedBilinearTiled>, // A2BGR30_Premultiplied fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB30 - fetchTransformedBilinear<BlendTransformedBilinearTiled> // A2RGB30_Premultiplied + fetchTransformedBilinear<BlendTransformedBilinearTiled>, // A2RGB30_Premultiplied + fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Alpha8 + fetchTransformedBilinear<BlendTransformedBilinearTiled>, // Grayscale8 }, }; @@ -2553,6 +2688,8 @@ static const uint * QT_FASTCALL qt_fetch_conical_gradient(uint *buffer, const Op + data->dy + data->m12 * (x + qreal(0.5)); bool affine = !data->m13 && !data->m23; + const qreal inv2pi = M_1_PI / 2.0; + const uint *end = buffer + length; if (affine) { rx -= data->gradient.conical.center.x; @@ -2560,7 +2697,7 @@ static const uint * QT_FASTCALL qt_fetch_conical_gradient(uint *buffer, const Op while (buffer < end) { qreal angle = qAtan2(ry, rx) + data->gradient.conical.angle; - *buffer = qt_gradient_pixel(&data->gradient, 1 - angle / (2*Q_PI)); + *buffer = qt_gradient_pixel(&data->gradient, 1 - angle * inv2pi); rx += data->m11; ry += data->m12; @@ -2576,7 +2713,7 @@ static const uint * QT_FASTCALL qt_fetch_conical_gradient(uint *buffer, const Op rx/rw - data->gradient.conical.center.y) + data->gradient.conical.angle; - *buffer = qt_gradient_pixel(&data->gradient, 1. - angle / (2*Q_PI)); + *buffer = qt_gradient_pixel(&data->gradient, 1 - angle * inv2pi); rx += data->m11; ry += data->m12; @@ -2590,32 +2727,10 @@ static const uint * QT_FASTCALL qt_fetch_conical_gradient(uint *buffer, const Op return b; } -#if defined(Q_CC_RVCT) -// Force ARM code generation for comp_func_* -methods -# pragma push -# pragma arm -# if defined(Q_PROCESSOR_ARM_V6) -static __forceinline void preload(const uint *start) -{ - asm( "pld [start]" ); -} -static const uint L2CacheLineLength = 32; -static const uint L2CacheLineLengthInInts = L2CacheLineLength/sizeof(uint); -# define PRELOAD_INIT(x) preload(x); -# define PRELOAD_INIT2(x,y) PRELOAD_INIT(x) PRELOAD_INIT(y) -# define PRELOAD_COND(x) if (((uint)&x[i])%L2CacheLineLength == 0) preload(&x[i] + L2CacheLineLengthInInts); -// Two consecutive preloads stall, so space them out a bit by using different modulus. -# define PRELOAD_COND2(x,y) if (((uint)&x[i])%L2CacheLineLength == 0) preload(&x[i] + L2CacheLineLengthInInts); \ - if (((uint)&y[i])%L2CacheLineLength == 16) preload(&y[i] + L2CacheLineLengthInInts); -# endif // Q_PROCESSOR_ARM_V6 -#endif // Q_CC_RVCT - -#if !defined(Q_CC_RVCT) || !defined(Q_PROCESSOR_ARM_V6) # define PRELOAD_INIT(x) # define PRELOAD_INIT2(x,y) # define PRELOAD_COND(x) # define PRELOAD_COND2(x,y) -#endif /* The constant alpha factor describes an alpha factor that gets applied to the result of the composition operation combining it with the destination. @@ -3770,11 +3885,7 @@ static inline int soft_light_op(int dst, int src, int da, int sa) else if (4 * dst <= da) return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025; else { -# ifdef Q_CC_RVCT // needed to avoid compiler crash in RVCT 2.2 - return (dst * sa * 255 + da * (src2 - sa) * (qIntSqrtInt(dst_np * 255) - dst_np) + temp) / 65025; -# else return (dst * sa * 255 + da * (src2 - sa) * (int(qSqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025; -# endif } } @@ -3982,11 +4093,6 @@ void QT_FASTCALL comp_func_Exclusion(uint *Q_DECL_RESTRICT dest, const uint *Q_D comp_func_Exclusion_impl(dest, src, length, QPartialCoverage(const_alpha)); } -#if defined(Q_CC_RVCT) -// Restore pragma state from previous #pragma arm -# pragma pop -#endif - void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest, int length, uint color, @@ -5815,6 +5921,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_untransformed_generic, blend_untransformed_generic, blend_untransformed_generic, + blend_untransformed_generic, + blend_untransformed_generic, }, // Tiled { @@ -5841,6 +5949,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_tiled_generic, blend_tiled_generic, blend_tiled_generic, + blend_tiled_generic, + blend_tiled_generic, }, // Transformed { @@ -5867,6 +5977,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_src_generic, blend_src_generic, blend_src_generic, + blend_src_generic, + blend_src_generic, }, // TransformedTiled { @@ -5892,6 +6004,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_src_generic, blend_src_generic, blend_src_generic, + blend_src_generic, blend_src_generic }, // Bilinear @@ -5919,6 +6032,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_src_generic, blend_src_generic, blend_src_generic, + blend_src_generic, + blend_src_generic, }, // BilinearTiled { @@ -5945,6 +6060,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_src_generic, // A2BGR30_Premultiplied blend_src_generic, // RGB30 blend_src_generic, // A2RGB30_Premultiplied + blend_src_generic, // Alpha8 + blend_src_generic, // Grayscale8 } }; @@ -6468,6 +6585,22 @@ static void qt_rectfill_nonpremul_rgba(QRasterBuffer *rasterBuffer, ARGB2RGBA(qUnpremultiply(color)), x, y, width, height, rasterBuffer->bytesPerLine()); } +static void qt_rectfill_alpha(QRasterBuffer *rasterBuffer, + int x, int y, int width, int height, + quint32 color) +{ + qt_rectfill<quint8>(reinterpret_cast<quint8 *>(rasterBuffer->buffer()), + qAlpha(color), x, y, width, height, rasterBuffer->bytesPerLine()); +} + +static void qt_rectfill_gray(QRasterBuffer *rasterBuffer, + int x, int y, int width, int height, + quint32 color) +{ + qt_rectfill<quint8>(reinterpret_cast<quint8 *>(rasterBuffer->buffer()), + qGray(color), x, y, width, height, rasterBuffer->bytesPerLine()); +} + // Map table for destination image format. Contains function pointers // for blends of various types unto the destination @@ -6652,6 +6785,20 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = 0, 0 }, + // Format_Alpha8 + { + blend_color_generic, + blend_src_generic, + 0, 0, 0, + qt_rectfill_alpha + }, + // Format_Grayscale8 + { + blend_color_generic, + blend_src_generic, + 0, 0, 0, + qt_rectfill_gray + }, }; #if defined(Q_CC_MSVC) && !defined(_MIPS_) @@ -6790,6 +6937,18 @@ void qInitDrawhelperAsm() } #endif // SSSE3 +#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) + if (qCpuHasFeature(SSE4_1)) { +#if !defined(__SSE4_1__) + qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4; + qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4; +#endif + qPixelLayouts[QImage::Format_ARGB32].convertFromARGB32PM = convertARGB32FromARGB32PM_sse4; + qPixelLayouts[QImage::Format_RGBA8888].convertFromARGB32PM = convertRGBA8888FromARGB32PM_sse4; + qPixelLayouts[QImage::Format_RGBX8888].convertFromARGB32PM = convertRGBXFromARGB32PM_sse4; + } +#endif + functionForModeAsm = qt_functionForMode_SSE2; functionForModeSolidAsm = qt_functionForModeSolid_SSE2; #endif // SSE2 diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp index 764e7763a8..721b228395 100644 --- a/src/gui/painting/qdrawhelper_mips_dsp.cpp +++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qdrawhelper_mips_dsp_asm.S b/src/gui/painting/qdrawhelper_mips_dsp_asm.S index 26b48f9d62..1d88dac354 100644 --- a/src/gui/painting/qdrawhelper_mips_dsp_asm.S +++ b/src/gui/painting/qdrawhelper_mips_dsp_asm.S @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/painting/qdrawhelper_mips_dsp_p.h b/src/gui/painting/qdrawhelper_mips_dsp_p.h index e33ce28ca0..ca05c9273f 100644 --- a/src/gui/painting/qdrawhelper_mips_dsp_p.h +++ b/src/gui/painting/qdrawhelper_mips_dsp_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qdrawhelper_mips_dspr2_asm.S b/src/gui/painting/qdrawhelper_mips_dspr2_asm.S index c7a603eebe..85ec66537b 100644 --- a/src/gui/painting/qdrawhelper_mips_dspr2_asm.S +++ b/src/gui/painting/qdrawhelper_mips_dspr2_asm.S @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index 2f1452f430..7e12e62151 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qdrawhelper_neon_asm.S b/src/gui/painting/qdrawhelper_neon_asm.S index d9a549d0e3..42a2084bbd 100644 --- a/src/gui/painting/qdrawhelper_neon_asm.S +++ b/src/gui/painting/qdrawhelper_neon_asm.S @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h index 4dfd37da71..bd030a8bf3 100644 --- a/src/gui/painting/qdrawhelper_neon_p.h +++ b/src/gui/painting/qdrawhelper_neon_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 695fbbdbbd..08bc0776f7 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -46,6 +46,7 @@ // #include "QtCore/qglobal.h" +#include "QtCore/qmath.h" #include "QtGui/qcolor.h" #include "QtGui/qpainter.h" #include "QtGui/qimage.h" @@ -55,16 +56,10 @@ #endif #include "private/qrasterdefs_p.h" #include <private/qsimd_p.h> -#include <private/qmath_p.h> QT_BEGIN_NAMESPACE -#if defined(Q_CC_RVCT) -// RVCT doesn't like static template functions -# define Q_STATIC_TEMPLATE_FUNCTION -# define Q_ALWAYS_INLINE __forceinline -# define Q_DECL_RESTRICT -#elif defined(Q_CC_GNU) +#if defined(Q_CC_GNU) # define Q_STATIC_TEMPLATE_FUNCTION static # define Q_ALWAYS_INLINE inline __attribute__((always_inline)) # define Q_DECL_RESTRICT __restrict__ @@ -555,10 +550,6 @@ public: } }; -#if defined(Q_CC_RVCT) -# pragma push -# pragma arm -#endif static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; @@ -570,9 +561,6 @@ static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b x |= t; return x; } -#if defined(Q_CC_RVCT) -# pragma pop -#endif #if QT_POINTER_SIZE == 8 // 64-bit versions @@ -604,10 +592,6 @@ static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b return x; } -#if defined(Q_CC_RVCT) -# pragma push -# pragma arm -#endif static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) { uint t = (x & 0xff00ff) * a; t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; @@ -619,10 +603,6 @@ static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) { x |= t; return x; } -#if defined(Q_CC_RVCT) -# pragma pop -#endif - #endif @@ -664,14 +644,7 @@ static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) { return t; } -#if defined(Q_CC_RVCT) -# pragma push -# pragma arm -#endif static Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; } -#if defined(Q_CC_RVCT) -# pragma pop -#endif static Q_ALWAYS_INLINE uint BYTE_MUL_RGB30(uint x, uint a) { uint xa = x >> 30; @@ -693,11 +666,6 @@ static Q_ALWAYS_INLINE uint qAlphaRgb30(uint c) return a; } - -// FIXME: Remove when all Qt modules have stopped using PREMUL and INV_PREMUL -#define PREMUL(x) qPremultiply(x) -#define INV_PREMUL(p) qUnpremultiply(p) - struct quint24 { quint24(uint value); operator uint() const; diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 77889b3c35..93d2d94626 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -484,9 +484,7 @@ void qt_bitmapblit16_sse2(QRasterBuffer *rasterBuffer, int x, int y, const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16); const __m128i c128 = _mm_set1_epi16(c); -#if defined(Q_CC_MSVC) -# pragma warning(disable: 4309) // truncation of constant value -#endif +QT_WARNING_DISABLE_MSVC(4309) // truncation of constant value const __m128i maskmask = _mm_set_epi16(0x0101, 0x0202, 0x0404, 0x0808, 0x1010, 0x2020, 0x4040, 0x8080); const __m128i maskadd = _mm_set_epi16(0x7f7f, 0x7e7e, 0x7c7c, 0x7878, @@ -539,18 +537,7 @@ public: static inline Int32x4 v_toInt(Float32x4 x) { return _mm_cvttps_epi32(x); } - // pre-VS 2008 doesn't have cast intrinsics, whereas 2008 and later requires it - // (same deal with gcc prior to 4.0) -#if (defined(Q_CC_MSVC) && _MSC_VER < 1500) || (defined(Q_CC_GNU) && __GNUC__ < 4) - static inline Int32x4 v_greaterOrEqual(Float32x4 a, Float32x4 b) - { - union Convert { Int32x4 vi; Float32x4 vf; } convert; - convert.vf = _mm_cmpgt_ps(a, b); - return convert.vi; - } -#else static inline Int32x4 v_greaterOrEqual(Float32x4 a, Float32x4 b) { return _mm_castps_si128(_mm_cmpgt_ps(a, b)); } -#endif }; const uint * QT_FASTCALL qt_fetch_radial_gradient_sse2(uint *buffer, const Operator *op, const QSpanData *data, diff --git a/src/gui/painting/qdrawhelper_sse_p.h b/src/gui/painting/qdrawhelper_sse_p.h deleted file mode 100644 index a1f878b5c0..0000000000 --- a/src/gui/painting/qdrawhelper_sse_p.h +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDRAWHELPER_SSE_P_H -#define QDRAWHELPER_SSE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qdrawhelper_mmx_p.h> - -#ifdef QT_COMPILER_SUPPORTS_SSE - -#ifdef QT_LINUXBASE -// this is an evil hack - the posix_memalign declaration in LSB -// is wrong - see http://bugs.linuxbase.org/show_bug.cgi?id=2431 -# define posix_memalign _lsb_hack_posix_memalign -# include <xmmintrin.h> -# undef posix_memalign -#else -# include <xmmintrin.h> -#endif - -QT_BEGIN_NAMESPACE - -#ifndef _MM_SHUFFLE -#define _MM_SHUFFLE(fp3,fp2,fp1,fp0) \ - (((fp3) << 6) | ((fp2) << 4) | ((fp1) << 2) | (fp0)) -#endif - -struct QSSEIntrinsics : public QMMXIntrinsics -{ - static inline m64 alpha(m64 x) { - return _mm_shuffle_pi16 (x, _MM_SHUFFLE(3, 3, 3, 3)); - } - - static inline m64 _load_alpha(uint x, const m64 &mmx_0x0000) { - m64 t = _mm_unpacklo_pi8(_mm_cvtsi32_si64(x), mmx_0x0000); - return _mm_shuffle_pi16 (t, _MM_SHUFFLE(0, 0, 0, 0)); - } -}; - -template <class MM> -inline void qt_memfill32_sse_template(quint32 *dest, quint32 value, int count) -{ - if (count < 7) { - switch (count) { - case 6: *dest++ = value; - case 5: *dest++ = value; - case 4: *dest++ = value; - case 3: *dest++ = value; - case 2: *dest++ = value; - case 1: *dest = value; - } - return; - }; - - __m64 *dst64 = reinterpret_cast<__m64*>(dest); - const __m64 value64 = _mm_set_pi32(value, value); - int count64 = count / 2; - - int n = (count64 + 3) / 4; - switch (count64 & 0x3) { - case 0: do { _mm_stream_pi(dst64++, value64); - case 3: _mm_stream_pi(dst64++, value64); - case 2: _mm_stream_pi(dst64++, value64); - case 1: _mm_stream_pi(dst64++, value64); - } while (--n > 0); - } - - if (count & 0x1) - dest[count - 1] = value; - - MM::end(); -} - -template <class MM> -inline void qt_bitmapblit16_sse_template(QRasterBuffer *rasterBuffer, - int x, int y, - quint32 color, - const uchar *src, - int width, int height, int stride) -{ - const quint16 c = qConvertRgb32To16(color); - quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(y)) + x; - const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16); - - const __m64 c64 = _mm_set1_pi16(c); -#ifdef Q_CC_MSVC -# pragma warning(disable: 4309) // truncation of constant value -#endif - const __m64 maskmask1 = _mm_set_pi16(0x1010, 0x2020, 0x4040, 0x8080); - const __m64 maskadd1 = _mm_set_pi16(0x7070, 0x6060, 0x4040, 0x0000); - - if (width > 4) { - const __m64 maskmask2 = _mm_set_pi16(0x0101, 0x0202, 0x0404, 0x0808); - const __m64 maskadd2 = _mm_set_pi16(0x7f7f, 0x7e7e, 0x7c7c, 0x7878); - - while (height--) { - for (int x = 0; x < width; x += 8) { - const quint8 s = src[x >> 3]; - if (!s) - continue; - __m64 mask1 = _mm_set1_pi8(s); - __m64 mask2 = mask1; - mask1 = _m_pand(mask1, maskmask1); - mask1 = _mm_add_pi16(mask1, maskadd1); - _mm_maskmove_si64(c64, mask1, (char*)(dest + x)); - mask2 = _m_pand(mask2, maskmask2); - mask2 = _mm_add_pi16(mask2, maskadd2); - _mm_maskmove_si64(c64, mask2, (char*)(dest + x + 4)); - } - dest += destStride; - src += stride; - } - } else { - while (height--) { - const quint8 s = *src; - if (s) { - __m64 mask1 = _mm_set1_pi8(s); - mask1 = _m_pand(mask1, maskmask1); - mask1 = _mm_add_pi16(mask1, maskadd1); - _mm_maskmove_si64(c64, mask1, (char*)(dest)); - } - dest += destStride; - src += stride; - } - } - - MM::end(); -} - -QT_END_NAMESPACE - -#endif // QT_COMPILER_SUPPORTS_SSE -#endif // QDRAWHELPER_SSE_P_H diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp index b403e189f7..cb4bd35d33 100644 --- a/src/gui/painting/qdrawhelper_ssse3.cpp +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h index 4dd5692a00..4d203c4f9d 100644 --- a/src/gui/painting/qdrawhelper_x86_p.h +++ b/src/gui/painting/qdrawhelper_x86_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h index 2b4cdc286e..aded999cdd 100644 --- a/src/gui/painting/qdrawingprimitive_sse2_p.h +++ b/src/gui/painting/qdrawingprimitive_sse2_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -236,4 +236,25 @@ QT_END_NAMESPACE #endif // __SSE2__ +QT_BEGIN_NAMESPACE +#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) +QT_FUNCTION_TARGET(SSE4_1) +inline QRgb qUnpremultiply_sse4(QRgb p) +{ + const uint alpha = qAlpha(p); + const uint invAlpha = qt_inv_premul_factor[alpha]; + const __m128i via = _mm_set1_epi32(invAlpha); + const __m128i vr = _mm_set1_epi32(0x8000); + __m128i vl = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(p)); + vl = _mm_mullo_epi32(vl, via); + vl = _mm_add_epi32(vl, vr); + vl = _mm_srai_epi32(vl, 16); + vl = _mm_insert_epi32(vl, alpha, 3); + vl = _mm_packus_epi32(vl, _mm_setzero_si128()); + vl = _mm_packus_epi16(vl, _mm_setzero_si128()); + return _mm_cvtsi128_si32(vl); +} +#endif +QT_END_NAMESPACE + #endif // QDRAWINGPRIMITIVE_SSE2_P_H diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp index 9e8e36dd9d..12ba67c124 100644 --- a/src/gui/painting/qemulationpaintengine.cpp +++ b/src/gui/painting/qemulationpaintengine.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h index b4481a067c..ab35e9b23e 100644 --- a/src/gui/painting/qemulationpaintengine_p.h +++ b/src/gui/painting/qemulationpaintengine_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h index 68314d0434..c29dacae3d 100644 --- a/src/gui/painting/qfixed_p.h +++ b/src/gui/painting/qfixed_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qgammatables.cpp b/src/gui/painting/qgammatables.cpp index 76c1c84631..83c31bbe95 100644 --- a/src/gui/painting/qgammatables.cpp +++ b/src/gui/painting/qgammatables.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 614d95ace1..b536028fe3 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -480,10 +480,10 @@ ras.area = 0; ras.cover = 0; + ras.ex = ex; + ras.ey = ey; } - ras.ex = ex; - ras.ey = ey; ras.invalid = ( (unsigned)ey >= (unsigned)ras.count_ey || ex >= ras.count_ex ); } @@ -670,38 +670,64 @@ } /* vertical line - avoid calling gray_render_scanline */ - incr = 1; - if ( dx == 0 ) { TCoord ex = TRUNC( ras.x ); TCoord two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 ); - TPos area; + TPos area, max_ey1; first = ONE_PIXEL; if ( dy < 0 ) - { first = 0; - incr = -1; - } delta = (int)( first - fy1 ); ras.area += (TArea)two_fx * delta; ras.cover += delta; - ey1 += incr; - - gray_set_cell( &ras, ex, ey1 ); delta = (int)( first + first - ONE_PIXEL ); area = (TArea)two_fx * delta; - while ( ey1 != ey2 ) - { - ras.area += area; - ras.cover += delta; - ey1 += incr; + max_ey1 = ras.count_ey + ras.min_ey; + if (dy < 0) { + if (ey1 > max_ey1) { + ey1 = (max_ey1 > ey2) ? max_ey1 : ey2; + gray_set_cell( &ras, ex, ey1 ); + } else { + ey1--; + gray_set_cell( &ras, ex, ey1 ); + } + while ( ey1 > ey2 && ey1 >= ras.min_ey) + { + ras.area += area; + ras.cover += delta; + ey1--; + + gray_set_cell( &ras, ex, ey1 ); + } + if (ey1 != ey2) { + ey1 = ey2; + gray_set_cell( &ras, ex, ey1 ); + } + } else { + if (ey1 < ras.min_ey) { + ey1 = (ras.min_ey < ey2) ? ras.min_ey : ey2; + gray_set_cell( &ras, ex, ey1 ); + } else { + ey1++; + gray_set_cell( &ras, ex, ey1 ); + } + while ( ey1 < ey2 && ey1 < max_ey1) + { + ras.area += area; + ras.cover += delta; + ey1++; - gray_set_cell( &ras, ex, ey1 ); + gray_set_cell( &ras, ex, ey1 ); + } + if (ey1 != ey2) { + ey1 = ey2; + gray_set_cell( &ras, ex, ey1 ); + } } delta = (int)( fy2 - ONE_PIXEL + first ); diff --git a/src/gui/painting/qgrayraster_p.h b/src/gui/painting/qgrayraster_p.h index 9a2ef3a413..8d1dec6b80 100644 --- a/src/gui/painting/qgrayraster_p.h +++ b/src/gui/painting/qgrayraster_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp index 4934a18747..9ae95dff78 100644 --- a/src/gui/painting/qimagescale.cpp +++ b/src/gui/painting/qimagescale.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qimagescale_p.h b/src/gui/painting/qimagescale_p.h index 61767dd905..512ec6488e 100644 --- a/src/gui/painting/qimagescale_p.h +++ b/src/gui/painting/qimagescale_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qmath_p.h b/src/gui/painting/qmath_p.h index fedcb3bd3e..13f82a82bb 100644 --- a/src/gui/painting/qmath_p.h +++ b/src/gui/painting/qmath_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -45,21 +45,13 @@ // We mean it. // -#include <math.h> #include <qmath.h> QT_BEGIN_NAMESPACE -static const qreal Q_PI = qreal(3.14159265358979323846); // pi -static const qreal Q_2PI = qreal(6.28318530717958647693); // 2*pi -static const qreal Q_PI2 = qreal(1.57079632679489661923); // pi/2 +static const qreal Q_PI = qreal(M_PI); // pi static const qreal Q_MM_PER_INCH = 25.4; -inline int qIntSqrtInt(int v) -{ - return static_cast<int>(qSqrt(static_cast<qreal>(v))); -} - QT_END_NAMESPACE #endif // QMATH_P_H diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp index 9a59408e52..679b5000cb 100644 --- a/src/gui/painting/qmatrix.cpp +++ b/src/gui/painting/qmatrix.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h index f09c5cbec4..ddffa8a8b9 100644 --- a/src/gui/painting/qmatrix.h +++ b/src/gui/painting/qmatrix.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp index b55f3b0dcc..f205cb1c5e 100644 --- a/src/gui/painting/qmemrotate.cpp +++ b/src/gui/painting/qmemrotate.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -473,6 +473,21 @@ QT_IMPL_MEMROTATE(quint16) QT_IMPL_MEMROTATE(quint24) QT_IMPL_MEMROTATE(quint8) +void qt_memrotate90_8(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate90(srcPixels, w, h, sbpl, destPixels, dbpl); +} + +void qt_memrotate180_8(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate180(srcPixels, w, h, sbpl, destPixels, dbpl); +} + +void qt_memrotate270_8(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) +{ + qt_memrotate270(srcPixels, w, h, sbpl, destPixels, dbpl); +} + void qt_memrotate90_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl) { qt_memrotate90((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl); @@ -529,6 +544,8 @@ MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3] = { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_A2BGR30_Premultiplied, { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_RGB30, { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_A2RGB30_Premultiplied, + { qt_memrotate90_8, qt_memrotate180_8, qt_memrotate270_8 }, // Format_Alpha8, + { qt_memrotate90_8, qt_memrotate180_8, qt_memrotate270_8 }, // Format_Grayscale8, }; QT_END_NAMESPACE diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h index 24b23da57d..ece6e94765 100644 --- a/src/gui/painting/qmemrotate_p.h +++ b/src/gui/painting/qmemrotate_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp index 358f8c2b19..84061a5c25 100644 --- a/src/gui/painting/qoutlinemapper.cpp +++ b/src/gui/painting/qoutlinemapper.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h index 4e3a4bfb9a..9d75e12619 100644 --- a/src/gui/painting/qoutlinemapper_p.h +++ b/src/gui/painting/qoutlinemapper_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpagedpaintdevice.cpp b/src/gui/painting/qpagedpaintdevice.cpp index fb3e860a7d..3adc5e9411 100644 --- a/src/gui/painting/qpagedpaintdevice.cpp +++ b/src/gui/painting/qpagedpaintdevice.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h index 10d18c4ae2..8d5f677bc5 100644 --- a/src/gui/painting/qpagedpaintdevice.h +++ b/src/gui/painting/qpagedpaintdevice.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpagedpaintdevice_p.h b/src/gui/painting/qpagedpaintdevice_p.h index a17f1606ae..62f69747db 100644 --- a/src/gui/painting/qpagedpaintdevice_p.h +++ b/src/gui/painting/qpagedpaintdevice_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp index 4531a0558d..c1b23960ad 100644 --- a/src/gui/painting/qpagelayout.cpp +++ b/src/gui/painting/qpagelayout.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 John Layt <jlayt@kde.org> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpagelayout.h b/src/gui/painting/qpagelayout.h index 252e65bc23..17e5eeece2 100644 --- a/src/gui/painting/qpagelayout.h +++ b/src/gui/painting/qpagelayout.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 John Layt <jlayt@kde.org> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp index 92a14119c8..fe445c0aec 100644 --- a/src/gui/painting/qpagesize.cpp +++ b/src/gui/painting/qpagesize.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 John Layt <jlayt@kde.org> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpagesize.h b/src/gui/painting/qpagesize.h index d12c51513f..00e22a243f 100644 --- a/src/gui/painting/qpagesize.h +++ b/src/gui/painting/qpagesize.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 John Layt <jlayt@kde.org> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp deleted file mode 100644 index be147ec842..0000000000 --- a/src/gui/painting/qpaintbuffer.cpp +++ /dev/null @@ -1,2209 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <qmath.h> -#include <private/qpainterpath_p.h> -#include <private/qpaintbuffer_p.h> -//#include <private/qtextengine_p.h> -#include <private/qfontengine_p.h> -#include <private/qemulationpaintengine_p.h> -#include <private/qimage_p.h> -#include <qstatictext.h> -#include <private/qstatictext_p.h> - -#include <QDebug> - -// #define QPAINTBUFFER_DEBUG_DRAW - -QT_BEGIN_NAMESPACE - -extern void qt_format_text(const QFont &font, - const QRectF &_r, int tf, const QTextOption *option, const QString& str, QRectF *brect, - int tabstops, int* tabarray, int tabarraylen, - QPainter *painter); - -QTextItemIntCopy::QTextItemIntCopy(const QTextItem &item) - : m_item(static_cast<const QTextItemInt &>(item)) -{ - QChar *chars = new QChar[m_item.num_chars]; - unsigned short *logClusters = new unsigned short[m_item.num_chars]; - memcpy(chars, m_item.chars, m_item.num_chars * sizeof(QChar)); - memcpy(logClusters, m_item.logClusters, m_item.num_chars * sizeof(unsigned short)); - m_item.chars = chars; - m_item.logClusters = logClusters; - - char *glyphLayoutData = new char[m_item.glyphs.numGlyphs * QGlyphLayout::SpaceNeeded]; - QGlyphLayout glyphs(glyphLayoutData, m_item.glyphs.numGlyphs); - memcpy(glyphs.offsets, m_item.glyphs.offsets, m_item.glyphs.numGlyphs * sizeof(QFixedPoint)); - memcpy(glyphs.glyphs, m_item.glyphs.glyphs, m_item.glyphs.numGlyphs * sizeof(glyph_t)); - memcpy(glyphs.advances, m_item.glyphs.advances, m_item.glyphs.numGlyphs * sizeof(QFixed)); - memcpy(glyphs.justifications, m_item.glyphs.justifications, m_item.glyphs.numGlyphs * sizeof(QGlyphJustification)); - memcpy(glyphs.attributes, m_item.glyphs.attributes, m_item.glyphs.numGlyphs * sizeof(QGlyphAttributes)); - m_item.glyphs = glyphs; - - m_font = *m_item.f; - m_item.f = &m_font; - - m_item.fontEngine->ref.ref(); // Increment reference count. -} - -QTextItemIntCopy::~QTextItemIntCopy() -{ - delete [] m_item.chars; - delete [] m_item.logClusters; - delete [] m_item.glyphs.data(); - if (!m_item.fontEngine->ref.deref()) - delete m_item.fontEngine; -} - -/************************************************************************ - * - * QPaintBufferPrivate - * - ************************************************************************/ - -QPaintBufferPrivate::QPaintBufferPrivate() - : ref(1), engine(0), penWidthAdjustment(0) - , calculateBoundingRect(true) - , cache(0) -{ -} - -QPaintBufferPrivate::~QPaintBufferPrivate() -{ - for (int i = 0; i < commands.size(); ++i) { - const QPaintBufferCommand &cmd = commands.at(i); - if (cmd.id == QPaintBufferPrivate::Cmd_DrawTextItem) - delete reinterpret_cast<QTextItemIntCopy *>(qvariant_cast<void *>(variants.at(cmd.offset))); - } -} - - -inline void QPaintBufferPrivate::updateBoundingRect(const QRectF &br) -{ - // transform to device coords and adjust for pen width - Q_ASSERT(engine && engine->painter()); - QPainter *painter = engine->painter(); - const QTransform transform = painter->transform(); - QRectF devRect = transform.mapRect(br); - if (penWidthAdjustment > 0) { - devRect = devRect.adjusted(-penWidthAdjustment, -penWidthAdjustment, - penWidthAdjustment, penWidthAdjustment); - } - - if (boundingRect.isEmpty()) { - boundingRect = devRect; - } else { - qreal min_x = qMin(devRect.left(), boundingRect.left()); - qreal min_y = qMin(devRect.top(), boundingRect.top()); - qreal max_x = qMax(devRect.right(), boundingRect.right()); - qreal max_y = qMax(devRect.bottom(), boundingRect.bottom()); - boundingRect = QRectF(min_x, min_y, max_x - min_x, max_y - min_y); - } - if (painter->hasClipping()) - boundingRect &= transform.mapRect(painter->clipRegion().boundingRect()); -} - - -/************************************************************************ - * - * QPaintBuffer - * - ************************************************************************/ - - - -QPaintBuffer::QPaintBuffer() - : d_ptr(new QPaintBufferPrivate) -{ -} - -QPaintBuffer::~QPaintBuffer() -{ - if (!d_ptr->ref.deref()) - delete d_ptr; -} - -QPaintBuffer::QPaintBuffer(const QPaintBuffer &other) - : QPaintDevice(), d_ptr(other.d_ptr) -{ - d_ptr->ref.ref(); -} - -QPaintEngine *QPaintBuffer::paintEngine() const -{ - QPaintBufferPrivate *d = const_cast<QPaintBuffer *>(this)->d_ptr; - if (!d->engine) - d->engine = new QPaintBufferEngine(d); - return d->engine; -} - - -int QPaintBuffer::metric(PaintDeviceMetric metric) const -{ - int val = 0; - switch (metric) { - case PdmWidth: - val = qCeil(d_ptr->boundingRect.width()); - break; - case PdmHeight: - val = qCeil(d_ptr->boundingRect.height()); - break; - case PdmDpiX: - case PdmPhysicalDpiX: - val = qt_defaultDpiX(); - break; - case PdmDpiY: - case PdmPhysicalDpiY: - val = qt_defaultDpiY(); - break; - default: - val = QPaintDevice::metric(metric); - } - - return val; -} - -int QPaintBuffer::devType() const -{ - return QInternal::PaintBuffer; -} - -QPaintBuffer &QPaintBuffer::operator=(const QPaintBuffer &other) -{ - if (other.d_ptr != d_ptr) { - QPaintBufferPrivate *data = other.d_ptr; - data->ref.ref(); - if (d_ptr->ref.deref()) - delete d_ptr; - d_ptr = data; - } - return *this; -} - -bool QPaintBuffer::isEmpty() const -{ - return d_ptr->commands.isEmpty(); -} - - - -void QPaintBuffer::draw(QPainter *painter, int frame) const -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBuffer::draw() --------------------------------"; - - Q_D(const QPaintBuffer); - printf("Float buffer:"); - for (int i=0; i<d->floats.size(); i++) { - if ((i % 10) == 0) { - printf("\n%4d-%4d: ", i, i+9); - } - printf("%4.2f ", d->floats[i]); - } - printf("\n"); - - printf("Int Buffer:"); - for (int i=0; i<d->ints.size(); i++) { - if ((i % 10) == 0) { - printf("\n%4d-%4d: ", i, i+10); - } - printf("%5d", d->ints[i]); - } - printf("\n"); -#endif - - processCommands(painter, frameStartIndex(frame), frameEndIndex(frame)); - -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBuffer::draw() -------------------------------- DONE!"; -#endif -} - -int QPaintBuffer::frameStartIndex(int frame) const -{ - return (frame == 0) ? 0 : d_ptr->frames.at(frame - 1); -} - -int QPaintBuffer::frameEndIndex(int frame) const -{ - return (frame == d_ptr->frames.size()) ? d_ptr->commands.size() : d_ptr->frames.at(frame); -} - -int QPaintBuffer::processCommands(QPainter *painter, int begin, int end) const -{ - if (!painter || !painter->isActive()) - return 0; - - QPaintEngineEx *xengine = painter->paintEngine()->isExtended() - ? (QPaintEngineEx *) painter->paintEngine() : 0; - if (xengine) { - QPaintEngineExReplayer player; - player.processCommands(*this, painter, begin, end); - } else { - QPainterReplayer player; - player.processCommands(*this, painter, begin, end); - } - - int depth = 0; - for (int i = begin; i < end; ++i) { - const QPaintBufferCommand &cmd = d_ptr->commands.at(i); - if (cmd.id == QPaintBufferPrivate::Cmd_Save) - ++depth; - else if (cmd.id == QPaintBufferPrivate::Cmd_Restore) - --depth; - } - return depth; -} - -#ifndef QT_NO_DEBUG_STREAM -QString QPaintBuffer::commandDescription(int command) const -{ - QString desc; - QDebug debug(&desc); - - const QPaintBufferCommand &cmd = d_ptr->commands.at(command); - - switch (cmd.id) { - case QPaintBufferPrivate::Cmd_Save: { - debug << "Cmd_Save"; - break; } - - case QPaintBufferPrivate::Cmd_Restore: { - debug << "Cmd_Restore"; - break; } - - case QPaintBufferPrivate::Cmd_SetBrush: { - QBrush brush = qvariant_cast<QBrush>(d_ptr->variants.at(cmd.offset)); - debug << "Cmd_SetBrush: " << brush; - break; } - - case QPaintBufferPrivate::Cmd_SetBrushOrigin: { - debug << "Cmd_SetBrushOrigin: " << d_ptr->variants.at(cmd.offset).toPointF(); - break; } - - case QPaintBufferPrivate::Cmd_SetCompositionMode: { - QPainter::CompositionMode mode = (QPainter::CompositionMode) cmd.extra; - debug << "ExCmd_SetCompositionMode, mode: " << mode; - break; } - - case QPaintBufferPrivate::Cmd_SetOpacity: { - debug << "ExCmd_SetOpacity: " << d_ptr->variants.at(cmd.offset).toDouble(); - break; } - - case QPaintBufferPrivate::Cmd_DrawVectorPath: { - debug << "ExCmd_DrawVectorPath: size: " << cmd.size -// << ", hints:" << d->ints[cmd.offset2+cmd.size] - << "pts/elms:" << cmd.offset << cmd.offset2; - break; } - - case QPaintBufferPrivate::Cmd_StrokeVectorPath: { - QPen pen = qvariant_cast<QPen>(d_ptr->variants.at(cmd.extra)); - debug << "ExCmd_StrokeVectorPath: size: " << cmd.size -// << ", hints:" << d->ints[cmd.offset2+cmd.size] - << "pts/elms:" << cmd.offset << cmd.offset2 << pen; - break; } - - case QPaintBufferPrivate::Cmd_FillVectorPath: { - QBrush brush = qvariant_cast<QBrush>(d_ptr->variants.at(cmd.extra)); - debug << "ExCmd_FillVectorPath: size: " << cmd.size -// << ", hints:" << d->ints[cmd.offset2+cmd.size] - << "pts/elms:" << cmd.offset << cmd.offset2 << brush; - break; } - - case QPaintBufferPrivate::Cmd_FillRectBrush: { - QBrush brush = qvariant_cast<QBrush>(d_ptr->variants.at(cmd.extra)); - QRectF *rect = (QRectF *)(d_ptr->floats.constData() + cmd.offset); - debug << "ExCmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " brush: " << brush; - break; } - - case QPaintBufferPrivate::Cmd_FillRectColor: { - QColor color = qvariant_cast<QColor>(d_ptr->variants.at(cmd.extra)); - QRectF *rect = (QRectF *)(d_ptr->floats.constData() + cmd.offset); - debug << "ExCmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " color: " << color; - break; } - - case QPaintBufferPrivate::Cmd_DrawPolygonF: { - debug << "ExCmd_DrawPolygonF, offset: " << cmd.offset << " size: " << cmd.size - << " mode: " << cmd.extra - << d_ptr->floats.at(cmd.offset) - << d_ptr->floats.at(cmd.offset+1); - break; } - - case QPaintBufferPrivate::Cmd_DrawPolygonI: { - debug << "ExCmd_DrawPolygonI, offset: " << cmd.offset << " size: " << cmd.size - << " mode: " << cmd.extra - << d_ptr->ints.at(cmd.offset) - << d_ptr->ints.at(cmd.offset+1); - break; } - - case QPaintBufferPrivate::Cmd_DrawEllipseF: { - debug << "ExCmd_DrawEllipseF, offset: " << cmd.offset; - break; } - - case QPaintBufferPrivate::Cmd_DrawLineF: { - debug << "ExCmd_DrawLineF, offset: " << cmd.offset << " size: " << cmd.size; - break; } - - case QPaintBufferPrivate::Cmd_DrawLineI: { - debug << "ExCmd_DrawLineI, offset: " << cmd.offset << " size: " << cmd.size; - break; } - - case QPaintBufferPrivate::Cmd_DrawPointsF: { - debug << "ExCmd_DrawPointsF, offset: " << cmd.offset << " size: " << cmd.size; - break; } - - case QPaintBufferPrivate::Cmd_DrawPointsI: { - debug << "ExCmd_DrawPointsI, offset: " << cmd.offset << " size: " << cmd.size; - break; } - - case QPaintBufferPrivate::Cmd_DrawPolylineF: { - debug << "ExCmd_DrawPolylineF, offset: " << cmd.offset << " size: " << cmd.size; - break; } - - case QPaintBufferPrivate::Cmd_DrawPolylineI: { - debug << "ExCmd_DrawPolylineI, offset: " << cmd.offset << " size: " << cmd.size; - break; } - - case QPaintBufferPrivate::Cmd_DrawRectF: { - debug << "ExCmd_DrawRectF, offset: " << cmd.offset << " size: " << cmd.size; - break; } - - case QPaintBufferPrivate::Cmd_DrawRectI: { - debug << "ExCmd_DrawRectI, offset: " << cmd.offset << " size: " << cmd.size; - break; } - - case QPaintBufferPrivate::Cmd_SetClipEnabled: { - bool clipEnabled = d_ptr->variants.at(cmd.offset).toBool(); - debug << "ExCmd_SetClipEnabled:" << clipEnabled; - break; } - - case QPaintBufferPrivate::Cmd_ClipVectorPath: { - QVectorPathCmd path(d_ptr, cmd); - debug << "ExCmd_ClipVectorPath:" << path().elementCount(); - break; } - - case QPaintBufferPrivate::Cmd_ClipRect: { - QRect rect(QPoint(d_ptr->ints.at(cmd.offset), d_ptr->ints.at(cmd.offset + 1)), - QPoint(d_ptr->ints.at(cmd.offset + 2), d_ptr->ints.at(cmd.offset + 3))); - debug << "ExCmd_ClipRect:" << rect << cmd.extra; - break; } - - case QPaintBufferPrivate::Cmd_ClipRegion: { - QRegion region(d_ptr->variants.at(cmd.offset).value<QRegion>()); - debug << "ExCmd_ClipRegion:" << region.boundingRect() << cmd.extra; - break; } - - case QPaintBufferPrivate::Cmd_SetPen: { - QPen pen = qvariant_cast<QPen>(d_ptr->variants.at(cmd.offset)); - debug << "Cmd_SetPen: " << pen; - break; } - - case QPaintBufferPrivate::Cmd_SetTransform: { - QTransform xform = qvariant_cast<QTransform>(d_ptr->variants.at(cmd.offset)); - debug << "Cmd_SetTransform, offset: " << cmd.offset << xform; - break; } - - case QPaintBufferPrivate::Cmd_SetRenderHints: { - debug << "Cmd_SetRenderHints, hints: " << cmd.extra; - break; } - - case QPaintBufferPrivate::Cmd_SetBackgroundMode: { - debug << "Cmd_SetBackgroundMode: " << cmd.extra; - break; } - - case QPaintBufferPrivate::Cmd_DrawConvexPolygonF: { - debug << "Cmd_DrawConvexPolygonF, offset: " << cmd.offset << " size: " << cmd.size; - break; } - - case QPaintBufferPrivate::Cmd_DrawConvexPolygonI: { - debug << "Cmd_DrawConvexPolygonI, offset: " << cmd.offset << " size: " << cmd.size; - break; } - - case QPaintBufferPrivate::Cmd_DrawEllipseI: { - debug << "Cmd_DrawEllipseI, offset: " << cmd.offset; - break; } - - case QPaintBufferPrivate::Cmd_DrawPixmapRect: { - QPixmap pm(d_ptr->variants.at(cmd.offset).value<QPixmap>()); - QRectF r(d_ptr->floats.at(cmd.extra), d_ptr->floats.at(cmd.extra+1), - d_ptr->floats.at(cmd.extra+2), d_ptr->floats.at(cmd.extra+3)); - - QRectF sr(d_ptr->floats.at(cmd.extra+4), d_ptr->floats.at(cmd.extra+5), - d_ptr->floats.at(cmd.extra+6), d_ptr->floats.at(cmd.extra+7)); - debug << "Cmd_DrawPixmapRect:" << r << sr << pm.size(); - break; } - - case QPaintBufferPrivate::Cmd_DrawPixmapPos: { - QPixmap pm(d_ptr->variants.at(cmd.offset).value<QPixmap>()); - QPointF pos(d_ptr->floats.at(cmd.extra), d_ptr->floats.at(cmd.extra+1)); - debug << "Cmd_DrawPixmapPos:" << pos << pm.size(); - break; } - - case QPaintBufferPrivate::Cmd_DrawTiledPixmap: { - QPixmap pm(d_ptr->variants.at(cmd.offset).value<QPixmap>()); - QRectF r(d_ptr->floats.at(cmd.extra), d_ptr->floats.at(cmd.extra+1), - d_ptr->floats.at(cmd.extra+2), d_ptr->floats.at(cmd.extra+3)); - - QPointF offset(d_ptr->floats.at(cmd.extra+4), d_ptr->floats.at(cmd.extra+5)); - debug << "Cmd_DrawTiledPixmap:" << r << offset << pm.size(); - break; } - - case QPaintBufferPrivate::Cmd_DrawImageRect: { - QImage image(d_ptr->variants.at(cmd.offset).value<QImage>()); - QRectF r(d_ptr->floats.at(cmd.extra), d_ptr->floats.at(cmd.extra+1), - d_ptr->floats.at(cmd.extra+2), d_ptr->floats.at(cmd.extra+3)); - QRectF sr(d_ptr->floats.at(cmd.extra+4), d_ptr->floats.at(cmd.extra+5), - d_ptr->floats.at(cmd.extra+6), d_ptr->floats.at(cmd.extra+7)); - debug << "Cmd_DrawImageRect:" << r << sr << image.size(); - break; } - - case QPaintBufferPrivate::Cmd_DrawImagePos: { - QImage image(d_ptr->variants.at(cmd.offset).value<QImage>()); - QPointF pos(d_ptr->floats.at(cmd.extra), d_ptr->floats.at(cmd.extra+1)); - debug << "Cmd_DrawImagePos:" << pos << image.size(); - break; } - - case QPaintBufferPrivate::Cmd_DrawText: { - QPointF pos(d_ptr->floats.at(cmd.extra), d_ptr->floats.at(cmd.extra+1)); - QList<QVariant> variants(d_ptr->variants.at(cmd.offset).value<QList<QVariant> >()); - - QFont font(variants.at(0).value<QFont>()); - QString text(variants.at(1).value<QString>()); - - debug << "Cmd_DrawText:" << pos << text << font.family(); - break; } - - case QPaintBufferPrivate::Cmd_DrawTextItem: { - QPointF pos(d_ptr->floats.at(cmd.extra), d_ptr->floats.at(cmd.extra+1)); - QTextItemIntCopy *tiCopy = reinterpret_cast<QTextItemIntCopy *>(qvariant_cast<void *>(d_ptr->variants.at(cmd.offset))); - QTextItemInt &ti = (*tiCopy)(); - QString text(ti.text()); - - debug << "Cmd_DrawTextItem:" << pos << " " << text; - break; } - case QPaintBufferPrivate::Cmd_SystemStateChanged: { - QRegion systemClip(d_ptr->variants.at(cmd.offset).value<QRegion>()); - - debug << "Cmd_SystemStateChanged:" << systemClip; - break; } - case QPaintBufferPrivate::Cmd_Translate: { - QPointF delta(d_ptr->floats.at(cmd.extra), d_ptr->floats.at(cmd.extra+1)); - debug << "Cmd_Translate:" << delta; - break; } - case QPaintBufferPrivate::Cmd_DrawStaticText: { - debug << "Cmd_DrawStaticText"; - break; } - } - - return desc; -} -#endif - -QRectF QPaintBuffer::boundingRect() const -{ - return d_ptr->boundingRect; -} - -void QPaintBuffer::setBoundingRect(const QRectF &rect) -{ - d_ptr->boundingRect = rect; - d_ptr->calculateBoundingRect = false; -} - - -class QPaintBufferEnginePrivate : public QPaintEngineExPrivate -{ - Q_DECLARE_PUBLIC(QPaintBufferEngine) -public: - void systemStateChanged() { - Q_Q(QPaintBufferEngine); - q->buffer->addCommand(QPaintBufferPrivate::Cmd_SystemStateChanged, QVariant(systemClip)); - } - - QTransform last; -}; - - -/************************************************************************ - * - * QPaintBufferEngine - * - ************************************************************************/ - -QPaintBufferEngine::QPaintBufferEngine(QPaintBufferPrivate *b) - : QPaintEngineEx(*(new QPaintBufferEnginePrivate)) - , buffer(b) - , m_begin_detected(false) - , m_save_detected(false) - , m_stream_raw_text_items(false) -{ -} - -bool QPaintBufferEngine::begin(QPaintDevice *) -{ - Q_D(QPaintBufferEngine); - painter()->save(); - d->systemStateChanged(); - return true; -} - -bool QPaintBufferEngine::end() -{ - painter()->restore(); - m_created_state = 0; - return true; -} - -QPainterState *QPaintBufferEngine::createState(QPainterState *orig) const -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: createState, orig=" << orig << ", current=" << state(); -#endif - - Q_ASSERT(!m_begin_detected); - Q_ASSERT(!m_save_detected); - - if (orig == 0) { - m_begin_detected = true; - return new QPainterState(); - } else { - m_save_detected = true; - return new QPainterState(orig); - } -} - -void QPaintBufferEngine::clip(const QVectorPath &path, Qt::ClipOperation op) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: clip vpath:" << path.elementCount() << "op:" << op; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_ClipVectorPath, path); - cmd->extra = op; -} - -void QPaintBufferEngine::clip(const QRect &rect, Qt::ClipOperation op) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: clip rect:" << rect << "op:" << op; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_ClipRect, (int *) &rect, 4, 1); - cmd->extra = op; -} - -void QPaintBufferEngine::clip(const QRegion ®ion, Qt::ClipOperation op) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: clip region br:" << region.boundingRect() << "op:" << op; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_ClipRegion, QVariant(region)); - cmd->extra = op; -} - -void QPaintBufferEngine::clip(const QPainterPath &path, Qt::ClipOperation op) -{ - // ### TODO -// QPaintBufferCommand *cmd = -// buffer->addCommand(QPaintBufferPrivate::Cmd_ClipPath, QVariant(path)); -// cmd->extra = op; - QPaintEngineEx::clip(path, op); -} - -void QPaintBufferEngine::clipEnabledChanged() -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: clip enable change" << state()->clipEnabled; -#endif - - buffer->addCommand(QPaintBufferPrivate::Cmd_SetClipEnabled, state()->clipEnabled); -} - -void QPaintBufferEngine::penChanged() -{ - const QPen &pen = state()->pen; - - if (!buffer->commands.isEmpty() - && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetPen) { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: penChanged (compressed)" << state()->pen; -#endif - buffer->variants[buffer->commands.last().offset] = pen; - return; - } - - if (buffer->calculateBoundingRect) { - if (pen.style() == Qt::NoPen) { - buffer->penWidthAdjustment = 0; - } else { - qreal penWidth = (pen.widthF() == 0) ? 1 : pen.widthF(); - QPointF transformedWidth(penWidth, penWidth); - if (!qt_pen_is_cosmetic(pen, state()->renderHints)) - transformedWidth = painter()->transform().map(transformedWidth); - buffer->penWidthAdjustment = transformedWidth.x() / 2.0; - } - } -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: penChanged" << state()->pen; -#endif - buffer->addCommand(QPaintBufferPrivate::Cmd_SetPen, pen); -} - -void QPaintBufferEngine::brushChanged() -{ - const QBrush &brush = state()->brush; - - if (!buffer->commands.isEmpty() - && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetBrush) { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: brushChanged (compressed)" << state()->brush; -#endif - buffer->variants[buffer->commands.last().offset] = brush; - return; - } - -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: brushChanged" << state()->brush; -#endif - buffer->addCommand(QPaintBufferPrivate::Cmd_SetBrush, brush); -} - -void QPaintBufferEngine::brushOriginChanged() -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: brush origin changed" << state()->brushOrigin; -#endif - buffer->addCommand(QPaintBufferPrivate::Cmd_SetBrushOrigin, state()->brushOrigin); -} - -void QPaintBufferEngine::opacityChanged() -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: opacity changed" << state()->opacity; -#endif - buffer->addCommand(QPaintBufferPrivate::Cmd_SetOpacity, state()->opacity); -} - -void QPaintBufferEngine::compositionModeChanged() -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: composition mode" << state()->composition_mode; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_SetCompositionMode); - cmd->extra = state()->composition_mode; -} - -void QPaintBufferEngine::renderHintsChanged() -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: render hints changed" << state()->renderHints; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_SetRenderHints); - cmd->extra = state()->renderHints; -} - -void QPaintBufferEngine::transformChanged() -{ - Q_D(QPaintBufferEngine); - const QTransform &transform = state()->matrix; - - QTransform delta; - - bool invertible = false; - if (transform.type() <= QTransform::TxScale && transform.type() == d->last.type()) - delta = transform * d->last.inverted(&invertible); - - d->last = transform; - - if (invertible && delta.type() == QTransform::TxNone) - return; - - if (invertible && delta.type() == QTransform::TxTranslate) { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: transformChanged (translate only) " << state()->matrix; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_Translate); - - qreal data[] = { delta.dx(), delta.dy() }; - cmd->extra = buffer->addData((qreal *) data, 2); - return; - } - - // ### accumulate, like in QBrush case... - if (!buffer->commands.isEmpty() - && buffer->commands.last().id == QPaintBufferPrivate::Cmd_SetTransform) { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: transformChanged (compressing) " << state()->matrix; -#endif - buffer->variants[buffer->commands.last().offset] = state()->matrix; - return; - } - -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: transformChanged:" << state()->matrix; -#endif - buffer->addCommand(QPaintBufferPrivate::Cmd_SetTransform, state()->matrix); -} - -void QPaintBufferEngine::backgroundModeChanged() -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintEngineBuffer: background mode changed" << state()->bgMode; -#endif - QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_SetBackgroundMode); - cmd->extra = state()->bgMode; -} - -void QPaintBufferEngine::draw(const QVectorPath &path) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: draw vpath:" << path.elementCount(); -#endif - - bool hasBrush = qbrush_style(state()->brush) != Qt::NoBrush; - bool hasPen = qpen_style(state()->pen) != Qt::NoPen - && qbrush_style(qpen_brush(state()->pen)) != Qt::NoBrush; - - if (hasPen || hasBrush) - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawVectorPath, path); -#ifdef QPAINTBUFFER_DEBUG_DRAW - else - qDebug() << " - no pen or brush active, discarded...\n"; -#endif - -// if (buffer->calculateBoundingRect) { -// QRealRect r = path.controlPointRect(); -// buffer->updateBoundingRect(QRectF(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1)); -// } -} - -void QPaintBufferEngine::fill(const QVectorPath &path, const QBrush &brush) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: fill vpath:" << path.elementCount() << brush; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_FillVectorPath, path); - cmd->extra = buffer->addData(QVariant(brush)); -// if (buffer->calculateBoundingRect) { -// QRealRect r = path.controlPointRect(); -// buffer->updateBoundingRect(QRectF(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1)); -// } -} - -void QPaintBufferEngine::stroke(const QVectorPath &path, const QPen &pen) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: stroke vpath:" << path.elementCount() << pen; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_StrokeVectorPath, path); - cmd->extra = buffer->addData(QVariant(pen)); -// if (buffer->calculateBoundingRect) { -// QRealRect r = path.controlPointRect(); -// buffer->updateBoundingRect(QRectF(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1)); -// } -} - -void QPaintBufferEngine::fillRect(const QRectF &rect, const QBrush &brush) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: fillRect brush:" << rect << brush; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_FillRectBrush, (qreal *) &rect, 4, 1); - cmd->extra = buffer->addData(brush); - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(rect); -} - -void QPaintBufferEngine::fillRect(const QRectF &rect, const QColor &color) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: fillRect color:" << rect << color; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_FillRectColor, (qreal *) &rect, 4, 1); - cmd->extra = buffer->addData(color); - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(rect); -} - -void QPaintBufferEngine::drawRects(const QRect *rects, int rectCount) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawRectsI:" << rectCount; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawRectI, (int *) rects, 4 * rectCount, rectCount); - cmd->extra = rectCount; - - if (buffer->calculateBoundingRect) { - if (rectCount == 1) { - buffer->updateBoundingRect(rects[0]); - } else { - int min_x = rects[0].left(); - int min_y = rects[0].top(); - int max_x = rects[0].left() + rects[0].width(); - int max_y = rects[0].top() + rects[0].height(); - for (int i=1; i< rectCount; ++i) { - if (rects[i].left() < min_x) - min_x = rects[i].left(); - if (rects[i].top() < min_y) - min_y = rects[i].top(); - if (rects[i].right() > max_x) - max_x = rects[i].left() + rects[i].width(); - if (rects[i].bottom() > max_y) - max_y = rects[i].top() + rects[i].height(); - - } - buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y)); - } - } -} - -void QPaintBufferEngine::drawRects(const QRectF *rects, int rectCount) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawRectsF:" << rectCount; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawRectF, (qreal *) rects, 4 * rectCount, rectCount); - cmd->extra = rectCount; - - if (buffer->calculateBoundingRect) { - if (rectCount == 1) { - buffer->updateBoundingRect(rects[0]); - } else { - qreal min_x = rects[0].left(); - qreal min_y = rects[0].top(); - qreal max_x = rects[0].right(); - qreal max_y = rects[0].bottom(); - for (int i=1; i< rectCount; ++i) { - if (rects[i].left() < min_x) - min_x = rects[i].left(); - if (rects[i].top() < min_y) - min_y = rects[i].top(); - if (rects[i].right() > max_x) - max_x = rects[i].right(); - if (rects[i].bottom() > max_y) - max_y = rects[i].bottom(); - - } - buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y)); - } - } -} - -void QPaintBufferEngine::drawLines(const QLine *lines, int lineCount) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawLinesI:" << lineCount; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawLineI, (int *) lines, 4 * lineCount, lineCount); - cmd->extra = lineCount; - - if (buffer->calculateBoundingRect) { - int min_x = lines[0].p1().x(); - int min_y = lines[0].p1().y(); - int max_x = lines[0].p2().x(); - int max_y = lines[0].p2().y(); - if (min_x > max_x) - qSwap(min_x, max_x); - if (min_y > max_y) - qSwap(min_y, max_y); - for (int i=1; i < lineCount; ++i) { - int p1_x = lines[i].p1().x(); - int p1_y = lines[i].p1().y(); - int p2_x = lines[i].p2().x(); - int p2_y = lines[i].p2().y(); - if (p1_x > p2_x) { - min_x = qMin(p2_x, min_x); - max_x = qMax(p1_x, max_x); - } else { - min_x = qMin(p1_x, min_x); - max_x = qMax(p2_x, max_x); - } - if (p1_y > p2_y) { - min_y = qMin(p2_y, min_y); - max_y = qMax(p1_y, max_y); - } else { - min_y = qMin(p1_y, min_y); - max_y = qMax(p2_y, max_y); - } - } - buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y)); - } -} - -void QPaintBufferEngine::drawLines(const QLineF *lines, int lineCount) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawLinesF:" << lineCount; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawLineF, (qreal *) lines, 4 * lineCount, lineCount); - cmd->extra = lineCount; - - if (buffer->calculateBoundingRect) { - qreal min_x = lines[0].p1().x(); - qreal min_y = lines[0].p1().y(); - qreal max_x = lines[0].p2().x(); - qreal max_y = lines[0].p2().y(); - if (min_x > max_x) - qSwap(min_x, max_x); - if (min_y > max_y) - qSwap(min_y, max_y); - for (int i=1; i < lineCount; ++i) { - qreal p1_x = lines[i].p1().x(); - qreal p1_y = lines[i].p1().y(); - qreal p2_x = lines[i].p2().x(); - qreal p2_y = lines[i].p2().y(); - if (p1_x > p2_x) { - min_x = qMin(p2_x, min_x); - max_x = qMax(p1_x, max_x); - } else { - min_x = qMin(p1_x, min_x); - max_x = qMax(p2_x, max_x); - } - if (p1_y > p2_y) { - min_y = qMin(p2_y, min_y); - max_y = qMax(p1_y, max_y); - } else { - min_y = qMin(p1_y, min_y); - max_y = qMax(p2_y, max_y); - } - } - buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y)); - } -} - -void QPaintBufferEngine::drawEllipse(const QRectF &r) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawEllipseF:" << r; -#endif - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawEllipseF, (qreal *) &r, 4, 1); - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(r); -} - -void QPaintBufferEngine::drawEllipse(const QRect &r) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawEllipseI:" << r; -#endif - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawEllipseI, (int *) &r, 4, 1); - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(r); -} - -void QPaintBufferEngine::drawPath(const QPainterPath &path) -{ -// #ifdef QPAINTBUFFER_DEBUG_DRAW -// qDebug() << "QPaintBufferEngine: drawPath: element count:" << path.elementCount(); -// #endif -// // ### Path -> QVariant -// // buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPath, QVariant(path)); - QPaintEngineEx::drawPath(path); - -// if (buffer->calculateBoundingRect) -// buffer->updateBoundingRect(path.boundingRect()); -} - -void QPaintBufferEngine::drawPoints(const QPoint *points, int pointCount) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawPointsI: " << pointCount; -#endif - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPointsI, (int *) points, 2 * pointCount, pointCount); - - if (buffer->calculateBoundingRect) { - int min_x = points[0].x(); - int min_y = points[0].y(); - int max_x = points[0].x()+1; - int max_y = points[0].y()+1; - for (int i=1; i<pointCount; ++i) { - int x = points[i].x(); - int y = points[i].y(); - min_x = qMin(min_x, x); - min_y = qMin(min_y, y); - max_x = qMax(max_x, x+1); - max_y = qMax(max_y, y+1); - } - buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y)); - } -} - -void QPaintBufferEngine::drawPoints(const QPointF *points, int pointCount) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawPointsF: " << pointCount; -#endif - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPointsF, (qreal *) points, 2 * pointCount, pointCount); - - if (buffer->calculateBoundingRect) { - qreal min_x = points[0].x(); - qreal min_y = points[0].y(); - qreal max_x = points[0].x()+1; - qreal max_y = points[0].y()+1; - for (int i=1; i<pointCount; ++i) { - qreal x = points[i].x(); - qreal y = points[i].y(); - min_x = qMin(min_x, x); - min_y = qMin(min_y, y); - max_x = qMax(max_x, x+1); - max_y = qMax(max_y, y+1); - } - buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y)); - } -} - -void QPaintBufferEngine::drawPolygon(const QPoint *pts, int count, PolygonDrawMode mode) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawPolygonI: size:" << count << ", mode:" << mode; -#endif - if (mode == QPaintEngine::OddEvenMode || mode == QPaintEngine::WindingMode) { - QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPolygonI, - (int *) pts, 2 * count, count); - cmd->extra = mode; - } else if (mode == QPaintEngine::PolylineMode) { - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPolylineI, (int *) pts, 2 * count, count); - } else { - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawConvexPolygonI, (int *) pts, 2 * count, count); - } - - if (buffer->calculateBoundingRect) { - int min_x = pts[0].x(); - int min_y = pts[0].y(); - int max_x = pts[0].x(); - int max_y = pts[0].y(); - for (int i=1; i<count; ++i) { - int x = pts[i].x(); - int y = pts[i].y(); - min_x = qMin(min_x, x); - min_y = qMin(min_y, y); - max_x = qMax(max_x, x); - max_y = qMax(max_y, y); - } - buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y)); - } -} - -void QPaintBufferEngine::drawPolygon(const QPointF *pts, int count, PolygonDrawMode mode) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawPolygonF: size:" << count << ", mode:" << mode; -#endif - if (mode == QPaintEngine::OddEvenMode || mode == QPaintEngine::WindingMode) { - QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPolygonF, - (qreal *) pts, 2 * count, count); - cmd->extra = mode; - } else if (mode == QPaintEngine::PolylineMode) { - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPolylineF, (qreal *) pts, 2 * count, count); - } else { - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawConvexPolygonF, (qreal *) pts, 2 * count, count); - } - - if (buffer->calculateBoundingRect) { - qreal min_x = pts[0].x(); - qreal min_y = pts[0].y(); - qreal max_x = pts[0].x(); - qreal max_y = pts[0].y(); - for (int i=1; i<count; ++i) { - qreal x = pts[i].x(); - qreal y = pts[i].y(); - min_x = qMin(min_x, x); - min_y = qMin(min_y, y); - max_x = qMax(max_x, x); - max_y = qMax(max_y, y); - } - buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y)); - } -} - -void QPaintBufferEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawPixmap: src/dest rects " << r << sr; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPixmapRect, QVariant(pm)); - cmd->extra = buffer->addData((qreal *) &r, 4); - buffer->addData((qreal *) &sr, 4); - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(r); -} - -void QPaintBufferEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawPixmap: pos:" << pos; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPixmapPos, QVariant(pm)); - cmd->extra = buffer->addData((qreal *) &pos, 2); - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(QRectF(pos, pm.size())); -} - -static inline QImage qpaintbuffer_storable_image(const QImage &src) -{ - QImageData *d = const_cast<QImage &>(src).data_ptr(); - return d->own_data ? src : src.copy(); -} - -void QPaintBufferEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr, - Qt::ImageConversionFlags /*flags */) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawImage: src/dest rects " << r << sr; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawImageRect, - QVariant(qpaintbuffer_storable_image(image))); - cmd->extra = buffer->addData((qreal *) &r, 4); - buffer->addData((qreal *) &sr, 4); - // ### flags... - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(r); -} - -void QPaintBufferEngine::drawImage(const QPointF &pos, const QImage &image) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawImage: pos:" << pos; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawImagePos, - QVariant(qpaintbuffer_storable_image(image))); - cmd->extra = buffer->addData((qreal *) &pos, 2); - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(QRectF(pos, image.size())); -} - -void QPaintBufferEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &s) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawTiledPixmap: src rect/offset:" << r << s; -#endif - QPaintBufferCommand *cmd = - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawTiledPixmap, QVariant(pm)); - cmd->extra = buffer->addData((qreal *) &r, 4); - buffer->addData((qreal *) &s, 2); - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(r); -} - -void QPaintBufferEngine::drawStaticTextItem(QStaticTextItem *staticTextItem) -{ - if (staticTextItem->usesRawFont) { - QPaintEngineEx::drawStaticTextItem(staticTextItem); // Draw as path - return; - } - - QVariantList variants; - - variants << QVariant(staticTextItem->font); - for (int i=0; i<staticTextItem->numGlyphs; ++i) { - variants.append(staticTextItem->glyphs[i]); - variants.append(staticTextItem->glyphPositions[i].toPointF()); - } - - buffer->addCommand(QPaintBufferPrivate::Cmd_DrawStaticText, QVariant(variants)); -} - -void QPaintBufferEngine::drawTextItem(const QPointF &pos, const QTextItem &ti) -{ -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: drawTextItem: pos:" << pos << ti.text(); -#endif - if (m_stream_raw_text_items) { - QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_DrawTextItem, QVariant::fromValue<void *>(new QTextItemIntCopy(ti))); - - QFont font(ti.font()); - font.setUnderline(false); - font.setStrikeOut(false); - font.setOverline(false); - - const QTextItemInt &si = static_cast<const QTextItemInt &>(ti); - qreal justificationWidth = 0; - if (si.justified) - justificationWidth = si.width.toReal(); - int renderFlags = ti.renderFlags(); - qreal scaleFactor = font.d->dpi/qreal(qt_defaultDpiY()); - - buffer->addData(QVariant(font)); - cmd->extra = buffer->addData((qreal *) &pos, 2); - buffer->addData((qreal *) &justificationWidth, 1); - buffer->addData((qreal *) &scaleFactor, 1); - cmd->offset2 = buffer->addData((int *) &renderFlags, 1); - } else { - QList<QVariant> variants; - variants << QVariant(ti.font()) << QVariant(ti.text()); - QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_DrawText, QVariant(variants)); - cmd->extra = buffer->addData((qreal *) &pos, 2); - } - - if (buffer->calculateBoundingRect) - buffer->updateBoundingRect(QRectF(pos, QSize(ti.width(), ti.ascent() + ti.descent() + 1))); -} - - -void QPaintBufferEngine::setState(QPainterState *s) -{ - Q_D(QPaintBufferEngine); - if (m_begin_detected) { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: setState: begin, ignoring."; -#endif - m_begin_detected = false; - } else if (m_save_detected) { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: setState: save."; -#endif - m_save_detected = false; - buffer->addCommand(QPaintBufferPrivate::Cmd_Save); - } else { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << "QPaintBufferEngine: setState: restore."; -#endif - buffer->addCommand(QPaintBufferPrivate::Cmd_Restore); - } - - d->last = s->matrix; - - QPaintEngineEx::setState(s); -} - - -/*********************************************************************** - * - * class QPaintBufferPlayback_Painter - * - */ - -// QFakeDevice is used to create fonts with a custom DPI -// -class QFakeDevice : public QPaintDevice -{ -public: - QFakeDevice() { dpi_x = qt_defaultDpiX(); dpi_y = qt_defaultDpiY(); } - void setDpiX(int dpi) { dpi_x = dpi; } - void setDpiY(int dpi) { dpi_y = dpi; } - QPaintEngine *paintEngine() const { return 0; } - int metric(PaintDeviceMetric m) const - { - switch(m) { - case PdmPhysicalDpiX: - case PdmDpiX: - return dpi_x; - case PdmPhysicalDpiY: - case PdmDpiY: - return dpi_y; - default: - return QPaintDevice::metric(m); - } - } - -private: - int dpi_x; - int dpi_y; -}; - - -void QPainterReplayer::setupTransform(QPainter *_painter) -{ - painter = _painter; - m_world_matrix = painter->transform(); - m_world_matrix.scale(qreal(painter->device()->logicalDpiX()) / qreal(qt_defaultDpiX()), - qreal(painter->device()->logicalDpiY()) / qreal(qt_defaultDpiY())); - painter->setTransform(m_world_matrix); -} - -void QPainterReplayer::processCommands(const QPaintBuffer &buffer, QPainter *p, int begin, int end) -{ - d = buffer.d_ptr; - painter = p; - - for (int cmdIndex = begin; cmdIndex < end; ++cmdIndex) { - const QPaintBufferCommand &cmd = d->commands.at(cmdIndex); - process(cmd); - } -} - -void QPaintBuffer::beginNewFrame() -{ - if (!d_ptr->commands.isEmpty()) - d_ptr->frames << d_ptr->commands.size(); -} - -int QPaintBuffer::numFrames() const -{ - return d_ptr->frames.size() + 1; -} - -void QPainterReplayer::process(const QPaintBufferCommand &cmd) -{ - switch (cmd.id) { - case QPaintBufferPrivate::Cmd_Save: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_Save"; -#endif - painter->save(); - break; } - - case QPaintBufferPrivate::Cmd_Restore: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_Restore"; -#endif - painter->restore(); - break; } - - case QPaintBufferPrivate::Cmd_SetPen: { - QPen pen = qvariant_cast<QPen>(d->variants.at(cmd.offset)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_SetPen: " << pen; -#endif - painter->setPen(pen); - break; } - - case QPaintBufferPrivate::Cmd_SetBrush: { - QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.offset)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_SetBrush: " << brush; -#endif - painter->setBrush(brush); - break; } - - case QPaintBufferPrivate::Cmd_SetBrushOrigin: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_SetBrushOrigin: " << d->variants.at(cmd.offset).toPointF(); -#endif - painter->setBrushOrigin(d->variants.at(cmd.offset).toPointF()); - break; } - - case QPaintBufferPrivate::Cmd_SetTransform: { - QTransform xform = qvariant_cast<QTransform>(d->variants.at(cmd.offset)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_SetTransform, offset: " << cmd.offset << xform; -#endif - painter->setTransform(xform * m_world_matrix); - break; } - - case QPaintBufferPrivate::Cmd_Translate: { - QPointF delta(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_Translate, offset: " << cmd.offset << delta; -#endif - painter->translate(delta.x(), delta.y()); - return; - } - - case QPaintBufferPrivate::Cmd_SetCompositionMode: { - QPainter::CompositionMode mode = (QPainter::CompositionMode) cmd.extra; -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_SetCompositionMode, mode: " << mode; -#endif - painter->setCompositionMode(mode); - break; } - - case QPaintBufferPrivate::Cmd_SetRenderHints: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_SetRenderHints, hints: " << cmd.extra; -#endif - QPainter::RenderHints ph = painter->renderHints(); - QPainter::RenderHints nh = (QPainter::RenderHints) cmd.extra; - QPainter::RenderHints xored = ph ^ nh; - if (xored & QPainter::Antialiasing) - painter->setRenderHint(QPainter::Antialiasing, nh & QPainter::Antialiasing); - if (xored & QPainter::HighQualityAntialiasing) - painter->setRenderHint(QPainter::HighQualityAntialiasing, nh & QPainter::HighQualityAntialiasing); - if (xored & QPainter::TextAntialiasing) - painter->setRenderHint(QPainter::TextAntialiasing, nh & QPainter::TextAntialiasing); - if (xored & QPainter::SmoothPixmapTransform) - painter->setRenderHint(QPainter::SmoothPixmapTransform, nh & QPainter::SmoothPixmapTransform); - if (xored & QPainter::NonCosmeticDefaultPen) - painter->setRenderHint(QPainter::NonCosmeticDefaultPen, nh & QPainter::NonCosmeticDefaultPen); - if (xored & QPainter::Qt4CompatiblePainting) - painter->setRenderHint(QPainter::Qt4CompatiblePainting, nh & QPainter::Qt4CompatiblePainting); - break; } - - case QPaintBufferPrivate::Cmd_SetOpacity: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_SetOpacity: " << d->variants.at(cmd.offset).toDouble(); -#endif - painter->setOpacity(d->variants.at(cmd.offset).toDouble()); - break; } - - case QPaintBufferPrivate::Cmd_SetBackgroundMode: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_SetBackgroundMode: " << cmd.extra; -#endif - painter->setBackgroundMode((Qt::BGMode)cmd.extra); - break; } - - case QPaintBufferPrivate::Cmd_DrawVectorPath: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawVectorPath: size: " << cmd.size -// << ", hints:" << d->ints[cmd.offset2+cmd.size] - << "pts/elms:" << cmd.offset << cmd.offset2; -#endif - QVectorPathCmd path(d, cmd); - painter->drawPath(path().convertToPainterPath()); - break; } - - case QPaintBufferPrivate::Cmd_StrokeVectorPath: { - QPen pen = qvariant_cast<QPen>(d->variants.at(cmd.extra)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_StrokeVectorPath: size: " << cmd.size -// << ", hints:" << d->ints[cmd.offset2+cmd.size] - << "pts/elms:" << cmd.offset << cmd.offset2; -#endif - QVectorPathCmd path(d, cmd); - painter->strokePath(path().convertToPainterPath(), pen); - break; } - - case QPaintBufferPrivate::Cmd_FillVectorPath: { - QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.extra)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_FillVectorPath: size: " << cmd.size -// << ", hints:" << d->ints[cmd.offset2+cmd.size] - << "pts/elms:" << cmd.offset << cmd.offset2 << brush; -#endif - QVectorPathCmd path(d, cmd); - painter->fillPath(path().convertToPainterPath(), brush); - break; } - - case QPaintBufferPrivate::Cmd_DrawPolygonF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawPolygonF, offset: " << cmd.offset << " size: " << cmd.size - << " mode: " << cmd.extra - << d->floats.at(cmd.offset) - << d->floats.at(cmd.offset+1); -#endif - Qt::FillRule fill = (QPaintEngine::PolygonDrawMode) cmd.extra == QPaintEngine::OddEvenMode - ? Qt::OddEvenFill : Qt::WindingFill; - painter->drawPolygon((QPointF *) (d->floats.constData() + cmd.offset), cmd.size, fill); - break; } - - case QPaintBufferPrivate::Cmd_DrawPolygonI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawPolygonI, offset: " << cmd.offset << " size: " << cmd.size - << " mode: " << cmd.extra - << d->ints.at(cmd.offset) - << d->ints.at(cmd.offset+1); -#endif - Qt::FillRule fill = (QPaintEngine::PolygonDrawMode) cmd.extra == QPaintEngine::OddEvenMode - ? Qt::OddEvenFill : Qt::WindingFill; - painter->drawPolygon((QPoint *) (d->ints.constData() + cmd.offset), cmd.size, fill); - break; } - - case QPaintBufferPrivate::Cmd_DrawPolylineF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawPolylineF, offset: " << cmd.offset << " size: " << cmd.size; -#endif - painter->drawPolyline((QPointF *) (d->floats.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawPolylineI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawPolylineI, offset: " << cmd.offset << " size: " << cmd.size; -#endif - painter->drawPolyline((QPoint *) (d->ints.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawConvexPolygonF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawConvexPolygonF, offset: " << cmd.offset << " size: " << cmd.size; -#endif - painter->drawConvexPolygon((QPointF *) (d->floats.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawConvexPolygonI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawConvexPolygonI, offset: " << cmd.offset << " size: " << cmd.size; -#endif - painter->drawConvexPolygon((QPoint *) (d->ints.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawEllipseF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawEllipseF, offset: " << cmd.offset; -#endif - painter->drawEllipse(*(QRectF *)(d->floats.constData() + cmd.offset)); - break; } - - case QPaintBufferPrivate::Cmd_DrawEllipseI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawEllipseI, offset: " << cmd.offset; -#endif - painter->drawEllipse(*(QRect *)(d->ints.constData() + cmd.offset)); - break; } - - case QPaintBufferPrivate::Cmd_DrawLineF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawLineF, offset: " << cmd.offset << " size: " << cmd.size; -#endif - painter->drawLines((QLineF *)(d->floats.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawLineI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawLineI, offset: " << cmd.offset << " size: " << cmd.size; -#endif - painter->drawLines((QLine *)(d->ints.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawPointsF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawPointsF, offset: " << cmd.offset << " size: " << cmd.size; -#endif - painter->drawPoints((QPointF *)(d->floats.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawPointsI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawPointsI, offset: " << cmd.offset << " size: " << cmd.size; -#endif - painter->drawPoints((QPoint *)(d->ints.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawPixmapRect: { - QPixmap pm(d->variants.at(cmd.offset).value<QPixmap>()); - QRectF r(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1), - d->floats.at(cmd.extra+2), d->floats.at(cmd.extra+3)); - - QRectF sr(d->floats.at(cmd.extra+4), d->floats.at(cmd.extra+5), - d->floats.at(cmd.extra+6), d->floats.at(cmd.extra+7)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawPixmapRect:" << r << sr; -#endif - painter->drawPixmap(r, pm, sr); - break; } - - case QPaintBufferPrivate::Cmd_DrawPixmapPos: { - QPixmap pm(d->variants.at(cmd.offset).value<QPixmap>()); - QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawPixmapPos:" << pos; -#endif - painter->drawPixmap(pos, pm); - break; } - - case QPaintBufferPrivate::Cmd_DrawTiledPixmap: { - QPixmap pm(d->variants.at(cmd.offset).value<QPixmap>()); - QRectF r(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1), - d->floats.at(cmd.extra+2), d->floats.at(cmd.extra+3)); - - QPointF offset(d->floats.at(cmd.extra+4), d->floats.at(cmd.extra+5)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawTiledPixmap:" << r << offset; -#endif - painter->drawTiledPixmap(r, pm, offset); - break; } - - case QPaintBufferPrivate::Cmd_DrawImageRect: { - QImage image(d->variants.at(cmd.offset).value<QImage>()); - QRectF r(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1), - d->floats.at(cmd.extra+2), d->floats.at(cmd.extra+3)); - QRectF sr(d->floats.at(cmd.extra+4), d->floats.at(cmd.extra+5), - d->floats.at(cmd.extra+6), d->floats.at(cmd.extra+7)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawImageRect:" << r << sr; -#endif - painter->drawImage(r, image, sr); - break; } - - case QPaintBufferPrivate::Cmd_DrawImagePos: { - QImage image(d->variants.at(cmd.offset).value<QImage>()); - QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawImagePos:" << pos; -#endif - painter->drawImage(pos, image); - break; } - - case QPaintBufferPrivate::Cmd_DrawRectF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawRectF, offset: " << cmd.offset; -#endif - painter->drawRects((QRectF *)(d->floats.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawRectI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawRectI, offset: " << cmd.offset; -#endif - painter->drawRects((QRect *)(d->ints.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_FillRectBrush: { - QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.extra)); - QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " brush: " << brush; -#endif - painter->fillRect(*rect, brush); - break; } - - case QPaintBufferPrivate::Cmd_FillRectColor: { - QColor color = qvariant_cast<QColor>(d->variants.at(cmd.extra)); - QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " color: " << color; -#endif - painter->fillRect(*rect, color); - break; } - - case QPaintBufferPrivate::Cmd_SetClipEnabled: { - bool clipEnabled = d->variants.at(cmd.offset).toBool(); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_SetClipEnabled:" << clipEnabled; -#endif - painter->setClipping(clipEnabled); - break; } - - case QPaintBufferPrivate::Cmd_ClipVectorPath: { - QVectorPathCmd path(d, cmd); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_ClipVectorPath:" << path().elementCount(); -#endif - painter->setClipPath(path().convertToPainterPath(), Qt::ClipOperation(cmd.extra)); - break; } - - - case QPaintBufferPrivate::Cmd_ClipRect: { - QRect rect(QPoint(d->ints.at(cmd.offset), d->ints.at(cmd.offset + 1)), - QPoint(d->ints.at(cmd.offset + 2), d->ints.at(cmd.offset + 3))); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_ClipRect:" << rect << cmd.extra; -#endif - painter->setClipRect(rect, Qt::ClipOperation(cmd.extra)); - break; } - - case QPaintBufferPrivate::Cmd_ClipRegion: { - QRegion region(d->variants.at(cmd.offset).value<QRegion>()); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_ClipRegion:" << region.boundingRect() << cmd.extra; -#endif - painter->setClipRegion(region, Qt::ClipOperation(cmd.extra)); - break; } - -#if !defined(QT_NO_RAWFONT) - case QPaintBufferPrivate::Cmd_DrawStaticText: { - - QVariantList variants(d->variants.at(cmd.offset).value<QVariantList>()); - - QFont font = variants.at(0).value<QFont>(); - - QVector<quint32> glyphIndexes; - QVector<QPointF> positions; - - for (int i=0; i<(variants.size() - 1) / 2; ++i) { - glyphIndexes.append(variants.at(i*2 + 1).toUInt()); - positions.append(variants.at(i*2 + 2).toPointF()); - } - - painter->setFont(font); - - QGlyphRun glyphs; - glyphs.setRawFont(QRawFont::fromFont(font, QFontDatabase::Any)); - glyphs.setGlyphIndexes(glyphIndexes); - glyphs.setPositions(positions); - - painter->drawGlyphRun(QPointF(), glyphs); - break; - } -#endif - - case QPaintBufferPrivate::Cmd_DrawText: { - QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1)); - QList<QVariant> variants(d->variants.at(cmd.offset).value<QList<QVariant> >()); - - QFont font(variants.at(0).value<QFont>()); - QString text(variants.at(1).value<QString>()); - - painter->setFont(font); - painter->drawText(pos, text); - break; } - - case QPaintBufferPrivate::Cmd_DrawTextItem: { - QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1)); - QTextItemIntCopy *tiCopy = reinterpret_cast<QTextItemIntCopy *>(qvariant_cast<void *>(d->variants.at(cmd.offset))); - QTextItemInt &ti = (*tiCopy)(); - QString text(ti.text()); - - QFont font(ti.font()); - font.setUnderline(false); - font.setStrikeOut(false); - font.setOverline(false); - - const QTextItemInt &si = static_cast<const QTextItemInt &>(ti); - qreal justificationWidth = 0; - if (si.justified) - justificationWidth = si.width.toReal(); - qreal scaleFactor = font.d->dpi/qreal(qt_defaultDpiY()); - -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_DrawTextItem:" << pos << " " << text << " " << scaleFactor; -#endif - - if (scaleFactor != 1.0) { - QFont fnt(font); - QFakeDevice fake; - fake.setDpiX(qRound(scaleFactor*qt_defaultDpiX())); - fake.setDpiY(qRound(scaleFactor*qt_defaultDpiY())); - font = QFont(fnt, &fake); - } - - int flags = Qt::TextSingleLine | Qt::TextDontClip | Qt::TextForceLeftToRight; - QSizeF size(1, 1); - if (justificationWidth > 0) { - size.setWidth(justificationWidth); - flags |= Qt::TextJustificationForced; - flags |= Qt::AlignJustify; - } - - QFontMetrics fm(font); - QPointF pt(pos.x(), pos.y() - fm.ascent()); - qt_format_text(font, QRectF(pt, size), flags, /*opt*/0, - text, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter); - break; } - case QPaintBufferPrivate::Cmd_SystemStateChanged: { - QRegion systemClip(d->variants.at(cmd.offset).value<QRegion>()); - -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> Cmd_SystemStateChanged:" << systemClip; -#endif - - painter->paintEngine()->setSystemClip(systemClip); - painter->paintEngine()->d_ptr->systemStateChanged(); - break; } - } -} - -void QPaintEngineExReplayer::process(const QPaintBufferCommand &cmd) -{ - Q_ASSERT(painter->paintEngine()->isExtended()); - QPaintEngineEx *xengine = static_cast<QPaintEngineEx *>(painter->paintEngine()); - - switch (cmd.id) { - case QPaintBufferPrivate::Cmd_SetBrushOrigin: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_SetBrushOrigin: " << d->variants.at(cmd.offset).toPointF(); -#endif - xengine->state()->brushOrigin = d->variants.at(cmd.offset).toPointF(); - xengine->brushOriginChanged(); - break; } - - case QPaintBufferPrivate::Cmd_SetCompositionMode: { - QPainter::CompositionMode mode = (QPainter::CompositionMode) cmd.extra; -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_SetCompositionMode, mode: " << mode; -#endif - xengine->state()->composition_mode = mode; - xengine->compositionModeChanged(); - break; } - - case QPaintBufferPrivate::Cmd_SetOpacity: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_SetOpacity: " << d->variants.at(cmd.offset).toDouble(); -#endif - xengine->state()->opacity = d->variants.at(cmd.offset).toDouble(); - xengine->opacityChanged(); - break; } - - case QPaintBufferPrivate::Cmd_DrawVectorPath: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawVectorPath: size: " << cmd.size -// << ", hints:" << d->ints[cmd.offset2+cmd.size] - << "pts/elms:" << cmd.offset << cmd.offset2; -#endif - QVectorPathCmd path(d, cmd); - xengine->draw(path()); - break; } - - case QPaintBufferPrivate::Cmd_StrokeVectorPath: { - QPen pen = qvariant_cast<QPen>(d->variants.at(cmd.extra)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_StrokeVectorPath: size: " << cmd.size -// << ", hints:" << d->ints[cmd.offset2+cmd.size] - << "pts/elms:" << cmd.offset << cmd.offset2; -#endif - QVectorPathCmd path(d, cmd); - xengine->stroke(path(), pen); - break; } - - case QPaintBufferPrivate::Cmd_FillVectorPath: { - QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.extra)); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_FillVectorPath: size: " << cmd.size -// << ", hints:" << d->ints[cmd.offset2+cmd.size] - << "pts/elms:" << cmd.offset << cmd.offset2 << brush; -#endif - QVectorPathCmd path(d, cmd); - xengine->fill(path(), brush); - break; } - - case QPaintBufferPrivate::Cmd_FillRectBrush: { - QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.extra)); - QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " brush: " << brush; -#endif - xengine->fillRect(*rect, brush); - break; } - - case QPaintBufferPrivate::Cmd_FillRectColor: { - QColor color = qvariant_cast<QColor>(d->variants.at(cmd.extra)); - QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " color: " << color; -#endif - xengine->fillRect(*rect, color); - break; } - - case QPaintBufferPrivate::Cmd_DrawPolygonF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawPolygonF, offset: " << cmd.offset << " size: " << cmd.size - << " mode: " << cmd.extra - << d->floats.at(cmd.offset) - << d->floats.at(cmd.offset+1); -#endif - xengine->drawPolygon((QPointF *) (d->floats.constData() + cmd.offset), cmd.size, - (QPaintEngine::PolygonDrawMode) cmd.extra); - break; } - - case QPaintBufferPrivate::Cmd_DrawPolygonI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawPolygonI, offset: " << cmd.offset << " size: " << cmd.size - << " mode: " << cmd.extra - << d->ints.at(cmd.offset) - << d->ints.at(cmd.offset+1); -#endif - xengine->drawPolygon((QPoint *) (d->ints.constData() + cmd.offset), cmd.size, - (QPaintEngine::PolygonDrawMode) cmd.extra); - break; } - - case QPaintBufferPrivate::Cmd_DrawEllipseF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawEllipseF, offset: " << cmd.offset; -#endif - xengine->drawEllipse(*(QRectF *)(d->floats.constData() + cmd.offset)); - break; } - - case QPaintBufferPrivate::Cmd_DrawEllipseI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawEllipseI, offset: " << cmd.offset; -#endif - xengine->drawEllipse(*(QRect *)(d->ints.constData() + cmd.offset)); - break; } - - case QPaintBufferPrivate::Cmd_DrawLineF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawLineF, offset: " << cmd.offset << " size: " << cmd.size; -#endif - xengine->drawLines((QLineF *)(d->floats.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawLineI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawLineI, offset: " << cmd.offset << " size: " << cmd.size; -#endif - xengine->drawLines((QLine *)(d->ints.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawPointsF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawPointsF, offset: " << cmd.offset << " size: " << cmd.size; -#endif - xengine->drawPoints((QPointF *)(d->floats.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawPointsI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawPointsI, offset: " << cmd.offset << " size: " << cmd.size; -#endif - xengine->drawPoints((QPoint *)(d->ints.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawPolylineF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawPolylineF, offset: " << cmd.offset << " size: " << cmd.size; -#endif - xengine->drawPolygon((QPointF *) (d->floats.constData() + cmd.offset), cmd.size, QPaintEngine::PolylineMode); - break; } - - case QPaintBufferPrivate::Cmd_DrawPolylineI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawPolylineI, offset: " << cmd.offset << " size: " << cmd.size; -#endif - xengine->drawPolygon((QPoint *) (d->ints.constData() + cmd.offset), cmd.size, QPaintEngine::PolylineMode); - break; } - - case QPaintBufferPrivate::Cmd_DrawRectF: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawRectF, offset: " << cmd.offset << " size: " << cmd.size; -#endif - xengine->drawRects((QRectF *) (d->floats.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_DrawRectI: { -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_DrawRectI, offset: " << cmd.offset << " size: " << cmd.size; -#endif - xengine->drawRects((QRect *) (d->ints.constData() + cmd.offset), cmd.size); - break; } - - case QPaintBufferPrivate::Cmd_SetClipEnabled: { - bool clipEnabled = d->variants.at(cmd.offset).toBool(); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_SetClipEnabled:" << clipEnabled; -#endif - xengine->state()->clipEnabled = clipEnabled; - xengine->clipEnabledChanged(); - break; } - - case QPaintBufferPrivate::Cmd_ClipVectorPath: { - QVectorPathCmd path(d, cmd); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_ClipVectorPath:" << path().elementCount(); -#endif - xengine->clip(path(), Qt::ClipOperation(cmd.extra)); - break; } - - - case QPaintBufferPrivate::Cmd_ClipRect: { - QRect rect(QPoint(d->ints.at(cmd.offset), d->ints.at(cmd.offset + 1)), - QPoint(d->ints.at(cmd.offset + 2), d->ints.at(cmd.offset + 3))); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_ClipRect:" << rect << cmd.extra; -#endif - xengine->clip(rect, Qt::ClipOperation(cmd.extra)); - break; } - - case QPaintBufferPrivate::Cmd_ClipRegion: { - QRegion region(d->variants.at(cmd.offset).value<QRegion>()); -#ifdef QPAINTBUFFER_DEBUG_DRAW - qDebug() << " -> ExCmd_ClipRegion:" << region.boundingRect() << cmd.extra; -#endif - xengine->clip(region, Qt::ClipOperation(cmd.extra)); - break; } - - default: - QPainterReplayer::process(cmd); - break; - } -} - -QDataStream &operator<<(QDataStream &stream, const QPaintBufferCommand &command) -{ - quint32 id = command.id; - quint32 size = command.size; - stream << id << size; - stream << command.offset << command.offset2 << command.extra; - return stream; -} - -QDataStream &operator>>(QDataStream &stream, QPaintBufferCommand &command) -{ - quint32 id; - quint32 size; - stream >> id >> size; - stream >> command.offset >> command.offset2 >> command.extra; - command.id = id; - command.size = size; - return stream; -} - -struct QPaintBufferCacheEntry -{ - QVariant::Type type; - quint64 cacheKey; -}; - -struct QPaintBufferCacheEntryV2 -{ - enum Type { - ImageKey, - PixmapKey - }; - - struct Flags { - uint type : 8; - uint key : 24; - }; - - union { - Flags flags; - uint bits; - }; -}; - -QT_END_NAMESPACE -Q_DECLARE_METATYPE(QPaintBufferCacheEntry) -Q_DECLARE_METATYPE(QPaintBufferCacheEntryV2) -QT_BEGIN_NAMESPACE - -QDataStream &operator<<(QDataStream &stream, const QPaintBufferCacheEntry &entry) -{ - return stream << entry.type << entry.cacheKey; -} - -QDataStream &operator>>(QDataStream &stream, QPaintBufferCacheEntry &entry) -{ - return stream >> entry.type >> entry.cacheKey; -} - -QDataStream &operator<<(QDataStream &stream, const QPaintBufferCacheEntryV2 &entry) -{ - return stream << entry.bits; -} - -QDataStream &operator>>(QDataStream &stream, QPaintBufferCacheEntryV2 &entry) -{ - return stream >> entry.bits; -} - -static void qRegisterPaintBufferMetaTypes() -{ - qRegisterMetaTypeStreamOperators<QPaintBufferCacheEntry>(); - qRegisterMetaTypeStreamOperators<QPaintBufferCacheEntryV2>(); -} - -Q_CONSTRUCTOR_FUNCTION(qRegisterPaintBufferMetaTypes) - -QDataStream &operator<<(QDataStream &stream, const QPaintBuffer &buffer) -{ - QHash<qint64, uint> pixmapKeys; - QHash<qint64, uint> imageKeys; - - QHash<qint64, QPixmap> pixmaps; - QHash<qint64, QImage> images; - - QVector<QVariant> variants = buffer.d_ptr->variants; - for (int i = 0; i < variants.size(); ++i) { - const QVariant &v = variants.at(i); - if (v.type() == QVariant::Image) { - const QImage image(v.value<QImage>()); - - QPaintBufferCacheEntryV2 entry; - entry.flags.type = QPaintBufferCacheEntryV2::ImageKey; - - QHash<qint64, uint>::iterator it = imageKeys.find(image.cacheKey()); - if (it != imageKeys.end()) { - entry.flags.key = *it; - } else { - imageKeys[image.cacheKey()] = entry.flags.key = images.size(); - images[images.size()] = image; - } - - variants[i] = QVariant::fromValue(entry); - } else if (v.type() == QVariant::Pixmap) { - const QPixmap pixmap(v.value<QPixmap>()); - - QPaintBufferCacheEntryV2 entry; - entry.flags.type = QPaintBufferCacheEntryV2::PixmapKey; - - QHash<qint64, uint>::iterator it = pixmapKeys.find(pixmap.cacheKey()); - if (it != pixmapKeys.end()) { - entry.flags.key = *it; - } else { - pixmapKeys[pixmap.cacheKey()] = entry.flags.key = pixmaps.size(); - pixmaps[pixmaps.size()] = pixmap; - } - - variants[i] = QVariant::fromValue(entry); - } - } - - stream << pixmaps; - stream << images; - - stream << buffer.d_ptr->ints; - stream << buffer.d_ptr->floats; - stream << variants; - stream << buffer.d_ptr->commands; - stream << buffer.d_ptr->boundingRect; - stream << buffer.d_ptr->frames; - - return stream; -} - -QDataStream &operator>>(QDataStream &stream, QPaintBuffer &buffer) -{ - QHash<qint64, QPixmap> pixmaps; - QHash<qint64, QImage> images; - - stream >> pixmaps; - stream >> images; - - stream >> buffer.d_ptr->ints; - stream >> buffer.d_ptr->floats; - stream >> buffer.d_ptr->variants; - stream >> buffer.d_ptr->commands; - stream >> buffer.d_ptr->boundingRect; - stream >> buffer.d_ptr->frames; - - QVector<QVariant> &variants = buffer.d_ptr->variants; - for (int i = 0; i < variants.size(); ++i) { - const QVariant &v = variants.at(i); - if (v.canConvert<QPaintBufferCacheEntry>()) { - QPaintBufferCacheEntry entry = v.value<QPaintBufferCacheEntry>(); - if (entry.type == QVariant::Image) - variants[i] = QVariant(images.value(entry.cacheKey)); - else - variants[i] = QVariant(pixmaps.value(entry.cacheKey)); - } else if (v.canConvert<QPaintBufferCacheEntryV2>()) { - QPaintBufferCacheEntryV2 entry = v.value<QPaintBufferCacheEntryV2>(); - - if (entry.flags.type == QPaintBufferCacheEntryV2::ImageKey) - variants[i] = QVariant(images.value(entry.flags.key)); - else if (entry.flags.type == QPaintBufferCacheEntryV2::PixmapKey) - variants[i] = QVariant(pixmaps.value(entry.flags.key)); - else - qWarning() << "operator<<(QDataStream &stream, QPaintBuffer &buffer): unrecognized cache entry type:" << entry.flags.type; - } - } - - return stream; -} - -QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h deleted file mode 100644 index 27add76a98..0000000000 --- a/src/gui/painting/qpaintbuffer_p.h +++ /dev/null @@ -1,418 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPAINTBUFFER_P_H -#define QPAINTBUFFER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qpaintdevice.h> - -#include <private/qpaintengineex_p.h> -#include <private/qtextengine_p.h> -#include <QDebug> - -QT_BEGIN_NAMESPACE - -class QPaintBufferPrivate; -class QPaintBufferPlayback; - -class Q_GUI_EXPORT QPaintBuffer : public QPaintDevice -{ - Q_DECLARE_PRIVATE(QPaintBuffer) -public: - QPaintBuffer(); - QPaintBuffer(const QPaintBuffer &other); - ~QPaintBuffer(); - - bool isEmpty() const; - - void beginNewFrame(); - int numFrames() const; - - void draw(QPainter *painter, int frame = 0) const; - - int frameStartIndex(int frame) const; - int frameEndIndex(int frame) const; - int processCommands(QPainter *painter, int begin, int end) const; -#ifndef QT_NO_DEBUG_STREAM - QString commandDescription(int command) const; -#endif - - void setBoundingRect(const QRectF &rect); - QRectF boundingRect() const; - - virtual QPaintEngine *paintEngine() const; - virtual int metric(PaintDeviceMetric m) const; - virtual int devType() const; - - QPaintBuffer &operator=(const QPaintBuffer &other); - -private: - friend class QPainterReplayer; - friend class QOpenGLReplayer; - - friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPaintBuffer &buffer); - friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPaintBuffer &buffer); - - QPaintBufferPrivate *d_ptr; -}; - -Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPaintBuffer &buffer); -Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPaintBuffer &buffer); - -class QPaintBufferEngine; - -class QTextItemIntCopy -{ -public: - QTextItemIntCopy(const QTextItem &item); - ~QTextItemIntCopy(); - QTextItemInt &operator () () {return m_item;} -private: - QTextItemInt m_item; - QFont m_font; -}; - -struct QPaintBufferCommand -{ - uint id : 8; - uint size : 24; - - int offset; - int offset2; - int extra; -}; - -QDataStream &operator<<(QDataStream &stream, const QPaintBufferCommand &command); -QDataStream &operator>>(QDataStream &stream, QPaintBufferCommand &command); - -Q_DECLARE_TYPEINFO(QPaintBufferCommand, Q_MOVABLE_TYPE); - -class QPaintBufferPrivate -{ -public: - enum Command { - Cmd_Save, - Cmd_Restore, - - Cmd_SetBrush, - Cmd_SetBrushOrigin, - Cmd_SetClipEnabled, - Cmd_SetCompositionMode, - Cmd_SetOpacity, - Cmd_SetPen, - Cmd_SetRenderHints, - Cmd_SetTransform, - Cmd_SetBackgroundMode, - - Cmd_ClipPath, - Cmd_ClipRect, - Cmd_ClipRegion, - Cmd_ClipVectorPath, - - Cmd_DrawVectorPath, - Cmd_FillVectorPath, - Cmd_StrokeVectorPath, - - Cmd_DrawConvexPolygonF, - Cmd_DrawConvexPolygonI, - Cmd_DrawEllipseF, - Cmd_DrawEllipseI, - Cmd_DrawLineF, - Cmd_DrawLineI, - Cmd_DrawPath, - Cmd_DrawPointsF, - Cmd_DrawPointsI, - Cmd_DrawPolygonF, - Cmd_DrawPolygonI, - Cmd_DrawPolylineF, - Cmd_DrawPolylineI, - Cmd_DrawRectF, - Cmd_DrawRectI, - - Cmd_FillRectBrush, - Cmd_FillRectColor, - - Cmd_DrawText, - Cmd_DrawTextItem, - - Cmd_DrawImagePos, - Cmd_DrawImageRect, - Cmd_DrawPixmapPos, - Cmd_DrawPixmapRect, - Cmd_DrawTiledPixmap, - - Cmd_SystemStateChanged, - Cmd_Translate, - Cmd_DrawStaticText, - - // new commands must be added above this line - - Cmd_LastCommand - }; - - QPaintBufferPrivate(); - ~QPaintBufferPrivate(); - - int addData(const int *data, int count) { - if (count <= 0) - return 0; - int pos = ints.size(); - ints.resize(pos + count); - memcpy(ints.data() + pos, data, count * sizeof(int)); - return pos; - } - - int addData(const qreal *data, int count) { - if (count <= 0) - return 0; - int pos = floats.size(); - floats.resize(pos + count); - memcpy(floats.data() + pos, data, count * sizeof(qreal)); - return pos; - } - - int addData(const QVariant &var) { - variants << var; - return variants.size() - 1; - } - - QPaintBufferCommand *addCommand(Command command) { - QPaintBufferCommand cmd; - cmd.id = command; - cmd.size = cmd.offset = cmd.offset2 = cmd.extra = 0; - commands << cmd; - return &commands.last(); - } - - QPaintBufferCommand *addCommand(Command command, const QVariant &var) { - QPaintBufferCommand cmd; - cmd.id = command; - cmd.offset = addData(var); - cmd.size = cmd.offset2 = cmd.extra = 0; - commands << cmd; - return &commands.last(); - } - - QPaintBufferCommand *addCommand(Command command, const QVectorPath &path) { - QPaintBufferCommand cmd; - cmd.id = command; - cmd.offset = addData(path.points(), path.elementCount() * 2); - cmd.offset2 = ints.size(); - ints << path.hints(); - // The absence of path elements is indicated by setting the highest bit in 'cmd.offset2'. - if (path.elements()) - addData((const int *) path.elements(), path.elementCount()); - else - cmd.offset2 |= 0x80000000; - cmd.size = path.elementCount(); - cmd.extra = 0; - commands << cmd; - return &commands.last(); - } - - QPaintBufferCommand *addCommand(Command command , const qreal *pts, int arrayLength, int elementCount) { - QPaintBufferCommand cmd; - cmd.id = command; - cmd.offset = addData(pts, arrayLength); - cmd.size = elementCount; - cmd.offset2 = cmd.extra = 0; - commands << cmd; - return &commands.last(); - } - - QPaintBufferCommand *addCommand(Command command , const int *pts, int arrayLength, int elementCount) { - QPaintBufferCommand cmd; - cmd.id = command; - cmd.offset = addData(pts, arrayLength); - cmd.size = elementCount; - cmd.offset2 = cmd.extra = 0; - commands << cmd; - return &commands.last(); - } - - inline void updateBoundingRect(const QRectF &rect); - - QAtomicInt ref; - - QVector<int> ints; - QVector<qreal> floats; - QVector<QVariant> variants; - - QVector<QPaintBufferCommand> commands; - QList<int> frames; - - QPaintBufferEngine *engine; - QRectF boundingRect; - qreal penWidthAdjustment; - uint calculateBoundingRect : 1; - - void *cache; -}; - - -struct QVectorPathCmd -{ - // The absence of path elements is indicated by setting the highest bit in 'cmd.offset2'. - QVectorPathCmd(QPaintBufferPrivate *d, const QPaintBufferCommand &cmd) - : vectorPath(d->floats.constData() + cmd.offset, - cmd.size, - cmd.offset2 & 0x80000000 - ? 0 - : (const QPainterPath::ElementType *) (d->ints.constData() + cmd.offset2 + 1), - *(d->ints.constData() + (cmd.offset2 & 0x7fffffff))) {} - - inline const QVectorPath &operator()() const { return vectorPath; } - - QVectorPath vectorPath; -}; - - -class Q_GUI_EXPORT QPainterReplayer -{ -public: - QPainterReplayer() { } - - virtual ~QPainterReplayer() { } - - void setupTransform(QPainter *painter); - virtual void process(const QPaintBufferCommand &cmd); - void processCommands(const QPaintBuffer &buffer, QPainter *painter, int begin, int end); - -protected: - QPaintBufferPrivate *d; - QTransform m_world_matrix; - - QPainter *painter; -}; - -class Q_GUI_EXPORT QPaintEngineExReplayer : public QPainterReplayer -{ -public: - QPaintEngineExReplayer() { } - - virtual void process(const QPaintBufferCommand &cmd); -}; - -class QPaintBufferEnginePrivate; - -class QPaintBufferEngine : public QPaintEngineEx -{ - Q_DECLARE_PRIVATE(QPaintBufferEngine) -public: - QPaintBufferEngine(QPaintBufferPrivate *buffer); - - virtual bool begin(QPaintDevice *device); - virtual bool end(); - - virtual Type type() const { return QPaintEngine::PaintBuffer; } - - virtual QPainterState *createState(QPainterState *orig) const; - - virtual void draw(const QVectorPath &path); - virtual void fill(const QVectorPath &path, const QBrush &brush); - virtual void stroke(const QVectorPath &path, const QPen &pen); - - virtual void clip(const QVectorPath &path, Qt::ClipOperation op); - virtual void clip(const QRect &rect, Qt::ClipOperation op); - virtual void clip(const QRegion ®ion, Qt::ClipOperation op); - virtual void clip(const QPainterPath &path, Qt::ClipOperation op); - - virtual void clipEnabledChanged(); - virtual void penChanged(); - virtual void brushChanged(); - virtual void brushOriginChanged(); - virtual void opacityChanged(); - virtual void compositionModeChanged(); - virtual void renderHintsChanged(); - virtual void transformChanged(); - virtual void backgroundModeChanged(); - - virtual void fillRect(const QRectF &rect, const QBrush &brush); - virtual void fillRect(const QRectF &rect, const QColor &color); - - virtual void drawRects(const QRect *rects, int rectCount); - virtual void drawRects(const QRectF *rects, int rectCount); - - virtual void drawLines(const QLine *lines, int lineCount); - virtual void drawLines(const QLineF *lines, int lineCount); - - virtual void drawEllipse(const QRectF &r); - virtual void drawEllipse(const QRect &r); - - virtual void drawPath(const QPainterPath &path); - - virtual void drawPoints(const QPointF *points, int pointCount); - virtual void drawPoints(const QPoint *points, int pointCount); - - virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); - virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode); - - virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); - virtual void drawPixmap(const QPointF &pos, const QPixmap &pm); - - virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, - Qt::ImageConversionFlags flags = Qt::AutoColor); - virtual void drawImage(const QPointF &pos, const QImage &image); - - virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); - - virtual void drawTextItem(const QPointF &pos, const QTextItem &ti); - virtual void drawStaticTextItem(QStaticTextItem *staticTextItem); - - virtual void setState(QPainterState *s); - virtual uint flags() const {return QPaintEngineEx::DoNotEmulate;} - - QPaintBufferPrivate *buffer; - - mutable int m_begin_detected : 1; - mutable int m_save_detected : 1; - mutable int m_stream_raw_text_items : 1; - mutable int m_unused : 29; - - mutable QPainterState *m_created_state; -}; - -QT_END_NAMESPACE - -#endif // QPAINTBUFFER_P_H diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp index a4daa9841a..36e0bbe223 100644 --- a/src/gui/painting/qpaintdevice.cpp +++ b/src/gui/painting/qpaintdevice.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h index bec89dc379..7c756c66de 100644 --- a/src/gui/painting/qpaintdevice.h +++ b/src/gui/painting/qpaintdevice.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc index 150ba10955..8db65af18e 100644 --- a/src/gui/painting/qpaintdevice.qdoc +++ b/src/gui/painting/qpaintdevice.qdoc @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** @@ -10,15 +10,15 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure +** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: http://www.gnu.org/copyleft/fdl.html. ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index 4e705648f1..6271c8f9e6 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index b56e4eb48c..eeca87ce16 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -212,7 +212,7 @@ public: inline void setDirty(DirtyFlags df); inline void clearDirty(DirtyFlags df); - bool hasFeature(PaintEngineFeatures feature) const { return (gccaps & feature) != 0; } + bool hasFeature(PaintEngineFeatures feature) const { return gccaps & feature; } QPainter *painter() const; @@ -312,7 +312,7 @@ inline void QPaintEngine::fix_neg_rect(int *x, int *y, int *w, int *h) inline bool QPaintEngine::testDirty(DirtyFlags df) { Q_ASSERT(state); - return ((state->dirtyFlags & df) != 0); + return state->dirtyFlags & df; } inline void QPaintEngine::setDirty(DirtyFlags df) { diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index c5e85cc7c7..7c33dbe266 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -602,12 +602,11 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect); } } else if (clipData->hasRegionClip) { - QVector<QRect> clipRects = clipData->clipRegion.rects(); QRect unclippedTargetRect(x, y, blitWidth, blitHeight); - QRegion intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect); - - for (int i = 0; i < intersectedRects.rects().size(); ++i) { - QRect targetRect = intersectedRects.rects().at(i); + const QVector<QRect> intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect).rects(); + const int intersectedSize = intersectedRects.size(); + for (int i = 0; i < intersectedSize; ++i) { + const QRect &targetRect = intersectedRects.at(i); if (!targetRect.isValid() || targetRect.isEmpty()) continue; int tmpSrcX = srcX + (targetRect.x() - x); diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index e28c5b9b16..ab44851ec7 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h index 312320c2e2..c58662ede4 100644 --- a/src/gui/painting/qpaintengine_p.h +++ b/src/gui/painting/qpaintengine_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 322bff9b57..1a1f63844c 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -48,7 +48,6 @@ // #include <private/qdatabuffer_p.h> // #include <private/qpainter_p.h> -#include <private/qmath_p.h> #include <private/qtextengine_p.h> #include <private/qfontengine_p.h> #include <private/qpixmap_raster_p.h> @@ -4466,7 +4465,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode QPointF center = g->center(); conicalData.center.x = center.x(); conicalData.center.y = center.y(); - conicalData.angle = g->angle() * 2 * Q_PI / 360.0; + conicalData.angle = qDegreesToRadians(g->angle()); } break; diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index cee19ab598..4e6e0b2f73 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index f5e6f7cca6..1de821e1c4 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index b831621a0c..29eea6032e 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -96,36 +96,36 @@ public: virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode); - virtual void drawRects(const QRect *rects, int rectCount); - virtual void drawRects(const QRectF *rects, int rectCount); + virtual void drawRects(const QRect *rects, int rectCount) Q_DECL_OVERRIDE; + virtual void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE; - virtual void drawLines(const QLine *lines, int lineCount); - virtual void drawLines(const QLineF *lines, int lineCount); + virtual void drawLines(const QLine *lines, int lineCount) Q_DECL_OVERRIDE; + virtual void drawLines(const QLineF *lines, int lineCount) Q_DECL_OVERRIDE; - virtual void drawEllipse(const QRectF &r); - virtual void drawEllipse(const QRect &r); + virtual void drawEllipse(const QRectF &r) Q_DECL_OVERRIDE; + virtual void drawEllipse(const QRect &r) Q_DECL_OVERRIDE; - virtual void drawPath(const QPainterPath &path); + virtual void drawPath(const QPainterPath &path) Q_DECL_OVERRIDE; - virtual void drawPoints(const QPointF *points, int pointCount); - virtual void drawPoints(const QPoint *points, int pointCount); + virtual void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE; + virtual void drawPoints(const QPoint *points, int pointCount) Q_DECL_OVERRIDE; - virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); - virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode); + virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE; + virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE; - virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) = 0; + virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE = 0; virtual void drawPixmap(const QPointF &pos, const QPixmap &pm); virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, - Qt::ImageConversionFlags flags = Qt::AutoColor) = 0; + Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE = 0; virtual void drawImage(const QPointF &pos, const QImage &image); - virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); + virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) Q_DECL_OVERRIDE; virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QFlags<QPainter::PixmapFragmentHint> hints); - virtual void updateState(const QPaintEngineState &state); + virtual void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE; virtual void drawStaticTextItem(QStaticTextItem *); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index de37c5635c..bdbb49ff51 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -112,11 +112,14 @@ extern bool qHasPixmapTexture(const QBrush &); static inline bool is_brush_transparent(const QBrush &brush) { Qt::BrushStyle s = brush.style(); - bool brushBitmap = qHasPixmapTexture(brush) - ? brush.texture().isQBitmap() - : (brush.textureImage().depth() == 1); - return ((s >= Qt::Dense1Pattern && s <= Qt::DiagCrossPattern) - || (s == Qt::TexturePattern && brushBitmap)); + if (s != Qt::TexturePattern) + return s >= Qt::Dense1Pattern && s <= Qt::DiagCrossPattern; + if (qHasPixmapTexture(brush)) + return brush.texture().isQBitmap() || brush.texture().hasAlphaChannel(); + else { + const QImage texture = brush.textureImage(); + return texture.hasAlphaChannel() || (texture.depth() == 1 && texture.colorCount() == 0); + } } static inline bool is_pen_transparent(const QPen &pen) { @@ -200,11 +203,8 @@ void QPainterPrivate::checkEmulation() QPainterPrivate::~QPainterPrivate() { delete emulationEngine; - for (int i=0; i<states.size(); ++i) - delete states.at(i); - - if (dummyState) - delete dummyState; + qDeleteAll(states); + delete dummyState; } @@ -456,7 +456,7 @@ void QPainterPrivate::draw_helper(const QPainterPath &originalPath, DrawOperatio p.drawPath(originalPath); #ifndef QT_NO_DEBUG - static bool do_fallback_overlay = qgetenv("QT_PAINT_FALLBACK_OVERLAY").size() > 0; + static bool do_fallback_overlay = !qEnvironmentVariableIsEmpty("QT_PAINT_FALLBACK_OVERLAY"); if (do_fallback_overlay) { QImage block(8, 8, QImage::Format_ARGB32_Premultiplied); QPainter pt(&block); @@ -2720,13 +2720,14 @@ void QPainter::setClipRect(const QRectF &rect, Qt::ClipOperation op) Q_D(QPainter); if (d->extended) { - if ((!d->state->clipEnabled && op != Qt::NoClip)) - op = Qt::ReplaceClip; - if (!d->engine) { qWarning("QPainter::setClipRect: Painter not active"); return; } + bool simplifyClipOp = (paintEngine()->type() != QPaintEngine::Picture); + if (simplifyClipOp && (!d->state->clipEnabled && op != Qt::NoClip)) + op = Qt::ReplaceClip; + qreal right = rect.x() + rect.width(); qreal bottom = rect.y() + rect.height(); qreal pts[] = { rect.x(), rect.y(), @@ -2777,8 +2778,9 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op) qWarning("QPainter::setClipRect: Painter not active"); return; } + bool simplifyClipOp = (paintEngine()->type() != QPaintEngine::Picture); - if ((!d->state->clipEnabled && op != Qt::NoClip)) + if (simplifyClipOp && (!d->state->clipEnabled && op != Qt::NoClip)) op = Qt::ReplaceClip; if (d->extended) { @@ -2791,7 +2793,7 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op) return; } - if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + if (simplifyClipOp && d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) op = Qt::ReplaceClip; d->state->clipRegion = rect; @@ -2835,8 +2837,9 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) qWarning("QPainter::setClipRegion: Painter not active"); return; } + bool simplifyClipOp = (paintEngine()->type() != QPaintEngine::Picture); - if ((!d->state->clipEnabled && op != Qt::NoClip)) + if (simplifyClipOp && (!d->state->clipEnabled && op != Qt::NoClip)) op = Qt::ReplaceClip; if (d->extended) { @@ -2849,7 +2852,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) return; } - if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + if (simplifyClipOp && d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) op = Qt::ReplaceClip; d->state->clipRegion = r; @@ -3432,8 +3435,7 @@ void QPainter::drawPath(const QPainterPath &path) \fn void QPainter::drawLine(int x1, int y1, int x2, int y2) \overload - Draws a line from (\a x1, \a y1) to (\a x2, \a y2) and sets the - current pen position to (\a x2, \a y2). + Draws a line from (\a x1, \a y1) to (\a x2, \a y2). */ /*! @@ -6213,7 +6215,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const pen.setWidthF(fe->lineThickness().toReal()); pen.setCapStyle(Qt::FlatCap); - QLineF line(pos.x(), pos.y(), pos.x() + qFloor(width), pos.y()); + QLineF line(qFloor(pos.x()), pos.y(), qFloor(pos.x() + width), pos.y()); bool wasCompatiblePainting = painter->renderHints() & QPainter::Qt4CompatiblePainting; @@ -7032,7 +7034,7 @@ void QPainter::setRenderHint(RenderHint hint, bool on) #endif #ifndef QT_NO_DEBUG - static const bool antialiasingDisabled = qgetenv("QT_NO_ANTIALIASING").toInt(); + static const bool antialiasingDisabled = qEnvironmentVariableIntValue("QT_NO_ANTIALIASING"); if (hint == QPainter::Antialiasing && antialiasingDisabled) return; #endif diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index b791d3e908..51776a9642 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index f8dcfbf326..dde01d32fa 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 1931bcdf90..e3c6eabbc3 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index 39b65dd1e9..eb32782a96 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index de4f169584..c841a0cf4c 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 39c21a2f47..0798418c17 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h index 5fc8bbaf09..36330052dd 100644 --- a/src/gui/painting/qpathclipper_p.h +++ b/src/gui/painting/qpathclipper_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpathsimplifier.cpp b/src/gui/painting/qpathsimplifier.cpp index c2d95c28d2..974b68d3a8 100644 --- a/src/gui/painting/qpathsimplifier.cpp +++ b/src/gui/painting/qpathsimplifier.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -38,8 +38,6 @@ #include <QtCore/qpoint.h> #include <QtCore/qalgorithms.h> -#include <math.h> - #include <private/qopengl_p.h> #include <private/qrbtree_p.h> diff --git a/src/gui/painting/qpathsimplifier_p.h b/src/gui/painting/qpathsimplifier_p.h index 485bac34a1..7befd5b5fd 100644 --- a/src/gui/painting/qpathsimplifier_p.h +++ b/src/gui/painting/qpathsimplifier_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 9aca4040a5..cc1ad02eee 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -2269,9 +2269,9 @@ int QPdfEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyColor, if (pattern.isEmpty()) { if (brush.style() != Qt::TexturePattern) return 0; - QImage image = brush.texture().toImage(); + QImage image = brush.textureImage(); bool bitmap = true; - imageObject = addImage(image, &bitmap, brush.texture().cacheKey()); + imageObject = addImage(image, &bitmap, image.cacheKey()); if (imageObject != -1) { QImage::Format f = image.format(); if (f != QImage::Format_MonoLSB && f != QImage::Format_Mono) { @@ -2322,6 +2322,14 @@ int QPdfEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyColor, return patternObj; } +static inline bool is_monochrome(const QVector<QRgb> &colorTable) +{ + return colorTable.size() == 2 + && colorTable.at(0) == QColor(Qt::black).rgba() + && colorTable.at(1) == QColor(Qt::white).rgba() + ; +} + /*! * Adds an image to the pdf and return the pdf-object id. Returns -1 if adding the image failed. */ @@ -2336,10 +2344,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n QImage image = img; QImage::Format format = image.format(); - if (image.depth() == 1 && *bitmap && img.colorTable().size() == 2 - && img.colorTable().at(0) == QColor(Qt::black).rgba() - && img.colorTable().at(1) == QColor(Qt::white).rgba()) - { + if (image.depth() == 1 && *bitmap && is_monochrome(img.colorTable())) { if (format == QImage::Format_MonoLSB) image = image.convertToFormat(QImage::Format_Mono); format = QImage::Format_Mono; diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 0fffa608ac..e7ff09cd3b 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -177,26 +177,26 @@ public: int resolution() const; // reimplementations QPaintEngine - bool begin(QPaintDevice *pdev); - bool end(); + bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE; + bool end() Q_DECL_OVERRIDE; - void drawPoints(const QPointF *points, int pointCount); - void drawLines(const QLineF *lines, int lineCount); - void drawRects(const QRectF *rects, int rectCount); - void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); - void drawPath (const QPainterPath & path); + void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE; + void drawLines(const QLineF *lines, int lineCount) Q_DECL_OVERRIDE; + void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE; + void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE; + void drawPath (const QPainterPath & path) Q_DECL_OVERRIDE; - void drawTextItem(const QPointF &p, const QTextItem &textItem); + void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE; - void drawPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QRectF & sr); + void drawPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QRectF & sr) Q_DECL_OVERRIDE; void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, - Qt::ImageConversionFlags flags = Qt::AutoColor); - void drawTiledPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QPointF & point); + Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE; + void drawTiledPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QPointF & point) Q_DECL_OVERRIDE; - void updateState(const QPaintEngineState &state); + void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE; int metric(QPaintDevice::PaintDeviceMetric metricType) const; - Type type() const; + Type type() const Q_DECL_OVERRIDE; // end reimplementations QPaintEngine // Printer stuff... diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index 877a1368b7..ca411ebe08 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h index 97bf3b5bd3..4367d595bf 100644 --- a/src/gui/painting/qpdfwriter.h +++ b/src/gui/painting/qpdfwriter.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index c3bc7964a3..4796d2c0ad 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -316,7 +316,7 @@ QPen::QPen(const QBrush &brush, qreal width, Qt::PenStyle s, Qt::PenCapStyle c, Constructs a pen that is a copy of the given \a pen. */ -QPen::QPen(const QPen &p) +QPen::QPen(const QPen &p) Q_DECL_NOTHROW { d = p.d; if (d) @@ -375,7 +375,7 @@ void QPen::detach() this pen. */ -QPen &QPen::operator=(const QPen &p) +QPen &QPen::operator=(const QPen &p) Q_DECL_NOTHROW { QPen(p).swap(*this); return *this; diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h index 30f55cd4ce..6ce50ae1d0 100644 --- a/src/gui/painting/qpen.h +++ b/src/gui/painting/qpen.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -58,18 +58,18 @@ public: QPen(const QColor &color); QPen(const QBrush &brush, qreal width, Qt::PenStyle s = Qt::SolidLine, Qt::PenCapStyle c = Qt::SquareCap, Qt::PenJoinStyle j = Qt::BevelJoin); - QPen(const QPen &pen); + QPen(const QPen &pen) Q_DECL_NOTHROW; ~QPen(); - QPen &operator=(const QPen &pen); + QPen &operator=(const QPen &pen) Q_DECL_NOTHROW; #ifdef Q_COMPILER_RVALUE_REFS - inline QPen(QPen &&other) + QPen(QPen &&other) Q_DECL_NOTHROW : d(other.d) { other.d = 0; } - inline QPen &operator=(QPen &&other) + QPen &operator=(QPen &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif - inline void swap(QPen &other) { qSwap(d, other.d); } + void swap(QPen &other) Q_DECL_NOTHROW { qSwap(d, other.d); } Qt::PenStyle style() const; void setStyle(Qt::PenStyle); diff --git a/src/gui/painting/qpen_p.h b/src/gui/painting/qpen_p.h index 902e0c493c..7e4586af06 100644 --- a/src/gui/painting/qpen_p.h +++ b/src/gui/painting/qpen_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 76269f6e65..24ea3f4cdd 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -45,6 +45,8 @@ #ifndef QT_NO_OPENGL #include <QtGui/private/qopengltextureblitter_p.h> #endif +#include <qpa/qplatformgraphicsbuffer.h> +#include <qpa/qplatformgraphicsbufferhelper.h> QT_BEGIN_NAMESPACE @@ -69,7 +71,6 @@ public: #endif } QWindow *window; - QSize size; #ifndef QT_NO_OPENGL mutable GLuint textureId; mutable QSize textureSize; @@ -236,7 +237,11 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i { Q_UNUSED(offset); - context->makeCurrent(window); + if (!context->makeCurrent(window)) { + qWarning("composeAndFlush: makeCurrent() failed"); + return; + } + QOpenGLFunctions *funcs = context->functions(); funcs->glViewport(0, 0, window->width() * window->devicePixelRatio(), window->height() * window->devicePixelRatio()); funcs->glClearColor(0, 0, 0, translucentBackground ? 0 : 1); @@ -267,13 +272,50 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i // semi-transparency even when it is not wanted. funcs->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); - // Backingstore texture with the normal widgets. - GLuint textureId = toTexture(deviceRegion(region, window), &d_ptr->textureSize, &d_ptr->needsSwizzle); + GLuint textureId = 0; + QOpenGLTextureBlitter::Origin origin = QOpenGLTextureBlitter::OriginTopLeft; + if (QPlatformGraphicsBuffer *graphicsBuffer = this->graphicsBuffer()) { + if (graphicsBuffer->size() != d_ptr->textureSize) { + if (d_ptr->textureId) + funcs->glDeleteTextures(1, &d_ptr->textureId); + funcs->glGenTextures(1, &d_ptr->textureId); + funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); +#ifndef QT_OPENGL_ES_2 + if (!QOpenGLContext::currentContext()->isOpenGLES()) { + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); + } +#endif + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + if (QPlatformGraphicsBufferHelper::lockAndBindToTexture(graphicsBuffer, &d_ptr->needsSwizzle)) { + d_ptr->textureSize = graphicsBuffer->size(); + } else { + d_ptr->textureSize = QSize(0,0); + } + + graphicsBuffer->unlock(); + } else if (!region.isEmpty()){ + funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); + QPlatformGraphicsBufferHelper::lockAndBindToTexture(graphicsBuffer, &d_ptr->needsSwizzle); + } + + if (graphicsBuffer->origin() == QPlatformGraphicsBuffer::OriginBottomLeft) + origin = QOpenGLTextureBlitter::OriginBottomLeft; + textureId = d_ptr->textureId; + } else { + // Backingstore texture with the normal widgets. + textureId = toTexture(deviceRegion(region, window), &d_ptr->textureSize, &d_ptr->needsSwizzle); + } + if (textureId) { QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(QRect(QPoint(), d_ptr->textureSize), windowRect); if (d_ptr->needsSwizzle) d_ptr->blitter->setSwizzleRB(true); - d_ptr->blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft); + d_ptr->blitter->blit(textureId, target, origin); if (d_ptr->needsSwizzle) d_ptr->blitter->setSwizzleRB(false); } @@ -463,6 +505,14 @@ void QPlatformBackingStore::endPaint() } /*! + Accessor for a backingstores graphics buffer abstraction +*/ +QPlatformGraphicsBuffer *QPlatformBackingStore::graphicsBuffer() const +{ + return Q_NULLPTR; +} + +/*! Scrolls the given \a area \a dx pixels to the right and \a dy downward; both \a dx and \a dy may be negative. diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h index c69612ca44..df98ebf51b 100644 --- a/src/gui/painting/qplatformbackingstore.h +++ b/src/gui/painting/qplatformbackingstore.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -62,6 +62,7 @@ class QPlatformWindow; class QPlatformTextureList; class QPlatformTextureListPrivate; class QOpenGLContext; +class QPlatformGraphicsBuffer; #ifndef QT_NO_OPENGL class Q_GUI_EXPORT QPlatformTextureList : public QObject @@ -116,6 +117,8 @@ public: virtual GLuint toTexture(const QRegion &dirtyRegion, QSize *textureSize, bool *needsSwizzle) const; #endif + virtual QPlatformGraphicsBuffer *graphicsBuffer() const; + virtual void resize(const QSize &size, const QRegion &staticContents) = 0; virtual bool scroll(const QRegion &area, int dx, int dy); diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 75b96d0915..511af49787 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h index 3c004878ba..ee7d4d31ad 100644 --- a/src/gui/painting/qpolygon.h +++ b/src/gui/painting/qpolygon.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qpolygonclipper_p.h b/src/gui/painting/qpolygonclipper_p.h index 1277252df5..082add6d85 100644 --- a/src/gui/painting/qpolygonclipper_p.h +++ b/src/gui/painting/qpolygonclipper_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qrasterdefs_p.h b/src/gui/painting/qrasterdefs_p.h index f7ff9aaa67..fbfe0572af 100644 --- a/src/gui/painting/qrasterdefs_p.h +++ b/src/gui/painting/qrasterdefs_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index a86fcfd977..75bf31cde1 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -712,20 +712,10 @@ static inline bool q26Dot6Compare(qreal p1, qreal p2) return int((p2 - p1) * 64.) == 0; } -static inline qreal qFloorF(qreal v) -{ -#ifdef QT_USE_MATH_H_FLOATS - if (sizeof(qreal) == sizeof(float)) - return floorf(v); - else -#endif - return floor(v); -} - static inline QPointF snapTo26Dot6Grid(const QPointF &p) { - return QPointF(qFloorF(p.x() * 64) * (1 / qreal(64)), - qFloorF(p.y() * 64) * (1 / qreal(64))); + return QPointF(std::floor(p.x() * 64) * (1 / qreal(64)), + std::floor(p.y() * 64) * (1 / qreal(64))); } /* @@ -832,7 +822,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, return; // adjust width which is given relative to |b - a| - width *= sqrt(w0 / w); + width *= qSqrt(w0 / w); } QSpanBuffer buffer(d->blend, d->data, d->clipRect); diff --git a/src/gui/painting/qrasterizer_p.h b/src/gui/painting/qrasterizer_p.h index 2801eef6ea..6f6dd994ab 100644 --- a/src/gui/painting/qrasterizer_p.h +++ b/src/gui/painting/qrasterizer_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index c556edd4c0..19314ef84f 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index 79a715d9e9..bab07b5a5d 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h index 6b0516e557..f7f2185bef 100644 --- a/src/gui/painting/qrgb.h +++ b/src/gui/painting/qrgb.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -72,18 +72,7 @@ inline Q_DECL_CONSTEXPR int qGray(QRgb rgb) // convert RGB to gra inline Q_DECL_CONSTEXPR bool qIsGray(QRgb rgb) { return qRed(rgb) == qGreen(rgb) && qRed(rgb) == qBlue(rgb); } - -#if Q_PROCESSOR_WORDSIZE == 8 // 64-bit version -inline QRgb qPremultiply(QRgb x) -{ - const uint a = qAlpha(x); - quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; - t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8; - t &= 0x000000ff00ff00ff; - return (uint(t)) | (uint(t >> 24)) | (a << 24); -} -#else // 32-bit version -inline QRgb qPremultiply(QRgb x) +inline Q_DECL_RELAXED_CONSTEXPR QRgb qPremultiply(QRgb x) { const uint a = qAlpha(x); uint t = (x & 0xff00ff) * a; @@ -93,10 +82,8 @@ inline QRgb qPremultiply(QRgb x) x = ((x >> 8) & 0xff) * a; x = (x + ((x >> 8) & 0xff) + 0x80); x &= 0xff00; - x |= t | (a << 24); - return x; + return x | t | (a << 24); } -#endif Q_GUI_EXPORT extern const uint qt_inv_premul_factor[]; diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index d7a4a2ad91..fc344dc3ac 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -33,7 +33,6 @@ #include "private/qstroker_p.h" #include "private/qbezier_p.h" -#include "private/qmath_p.h" #include "qline.h" #include "qtransform.h" #include <qmath.h> @@ -793,7 +792,7 @@ qreal qt_t_for_arc_angle(qreal angle) if (qFuzzyCompare(angle, qreal(90))) return 1; - qreal radians = Q_PI * angle / 180; + qreal radians = qDegreesToRadians(angle); qreal cosAngle = qCos(radians); qreal sinAngle = qSin(radians); diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h index 756669239c..eda65b8e2f 100644 --- a/src/gui/painting/qstroker_p.h +++ b/src/gui/painting/qstroker_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qt_mips_asm_dsp_p.h b/src/gui/painting/qt_mips_asm_dsp_p.h index 6f9cf0dcda..d1df7e018b 100644 --- a/src/gui/painting/qt_mips_asm_dsp_p.h +++ b/src/gui/painting/qt_mips_asm_dsp_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index be46a0fba3..881fae9afc 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -285,13 +285,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height) m_image = QImage(width, height, QImage::Format_Mono); break; case QFontEngine::Format_A8: { - m_image = QImage(width, height, QImage::Format_Indexed8); - m_image.fill(0); - QVector<QRgb> colors(256); - QRgb *it = colors.data(); - for (int i=0; i<256; ++i, ++it) - *it = 0xff000000 | i | (i<<8) | (i<<16); - m_image.setColorTable(colors); + m_image = QImage(width, height, QImage::Format_Alpha8); break; } case QFontEngine::Format_A32: m_image = QImage(width, height, QImage::Format_RGB32); diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 2d2fcdfc93..c9e7060b0d 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -158,9 +158,9 @@ class Q_GUI_EXPORT QImageTextureGlyphCache : public QTextureGlyphCache public: QImageTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix) : QTextureGlyphCache(format, matrix) { } - virtual void createTextureData(int width, int height); - virtual void resizeTextureData(int width, int height); - virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition); + virtual void createTextureData(int width, int height) Q_DECL_OVERRIDE; + virtual void resizeTextureData(int width, int height) Q_DECL_OVERRIDE; + virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) Q_DECL_OVERRIDE; inline const QImage &image() const { return m_image; } diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 04a97aabcb..4c1aff92ae 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 68c4548644..cf8d4d1970 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h index c005a092e2..44fb2e5647 100644 --- a/src/gui/painting/qvectorpath_p.h +++ b/src/gui/painting/qvectorpath_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ |