summaryrefslogtreecommitdiffstats
path: root/src/plugins/imageformats
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/imageformats')
-rw-r--r--src/plugins/imageformats/CMakeLists.txt3
-rw-r--r--src/plugins/imageformats/gif/.prev_CMakeLists.txt19
-rw-r--r--src/plugins/imageformats/gif/CMakeLists.txt17
-rw-r--r--src/plugins/imageformats/gif/gif.pro10
-rw-r--r--src/plugins/imageformats/gif/main.cpp55
-rw-r--r--src/plugins/imageformats/gif/main.h62
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp56
-rw-r--r--src/plugins/imageformats/gif/qgifhandler_p.h45
-rw-r--r--src/plugins/imageformats/ico/.prev_CMakeLists.txt20
-rw-r--r--src/plugins/imageformats/ico/CMakeLists.txt13
-rw-r--r--src/plugins/imageformats/ico/ico.pro10
-rw-r--r--src/plugins/imageformats/ico/main.cpp59
-rw-r--r--src/plugins/imageformats/ico/main.h59
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp66
-rw-r--r--src/plugins/imageformats/ico/qicohandler.h42
-rw-r--r--src/plugins/imageformats/imageformats.pro6
-rw-r--r--src/plugins/imageformats/jpeg/.prev_CMakeLists.txt94
-rw-r--r--src/plugins/imageformats/jpeg/CMakeLists.txt99
-rw-r--r--src/plugins/imageformats/jpeg/jpeg.pro18
-rw-r--r--src/plugins/imageformats/jpeg/main.cpp54
-rw-r--r--src/plugins/imageformats/jpeg/main.h58
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp202
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler_p.h40
23 files changed, 235 insertions, 872 deletions
diff --git a/src/plugins/imageformats/CMakeLists.txt b/src/plugins/imageformats/CMakeLists.txt
index 00fefbdc0d..c5ab716d00 100644
--- a/src/plugins/imageformats/CMakeLists.txt
+++ b/src/plugins/imageformats/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from imageformats.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
if(QT_FEATURE_ico)
add_subdirectory(ico)
diff --git a/src/plugins/imageformats/gif/.prev_CMakeLists.txt b/src/plugins/imageformats/gif/.prev_CMakeLists.txt
deleted file mode 100644
index c071c1d785..0000000000
--- a/src/plugins/imageformats/gif/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-# Generated from gif.pro.
-
-#####################################################################
-## QGifPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QGifPlugin
- OUTPUT_NAME qgif
- TYPE imageformats
- SOURCES
- main.cpp main.h
- qgifhandler.cpp qgifhandler_p.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
-)
-
-#### Keys ignored in scope 1:.:.:gif.pro:<TRUE>:
-# OTHER_FILES = "gif.json"
diff --git a/src/plugins/imageformats/gif/CMakeLists.txt b/src/plugins/imageformats/gif/CMakeLists.txt
index 9a9150bccc..b56859a264 100644
--- a/src/plugins/imageformats/gif/CMakeLists.txt
+++ b/src/plugins/imageformats/gif/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from gif.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QGifPlugin Plugin:
@@ -6,15 +7,11 @@
qt_internal_add_plugin(QGifPlugin
OUTPUT_NAME qgif
- TYPE imageformats
+ PLUGIN_TYPE imageformats
SOURCES
- main.cpp main.h
+ main.cpp
qgifhandler.cpp qgifhandler_p.h
- LIBRARIES # special case
- Qt::GuiPrivate # special case
- PUBLIC_LIBRARIES # special case
- Qt::Gui # special case
+ LIBRARIES
+ Qt::Gui
+ Qt::GuiPrivate
)
-
-#### Keys ignored in scope 1:.:.:gif.pro:<TRUE>:
-# OTHER_FILES = "gif.json"
diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro
deleted file mode 100644
index c2625be85a..0000000000
--- a/src/plugins/imageformats/gif/gif.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TARGET = qgif
-
-SOURCES += main.cpp qgifhandler.cpp
-HEADERS += main.h qgifhandler_p.h
-
-OTHER_FILES += gif.json
-
-PLUGIN_TYPE = imageformats
-PLUGIN_CLASS_NAME = QGifPlugin
-load(qt_plugin)
diff --git a/src/plugins/imageformats/gif/main.cpp b/src/plugins/imageformats/gif/main.cpp
index 993871420c..f98b586407 100644
--- a/src/plugins/imageformats/gif/main.cpp
+++ b/src/plugins/imageformats/gif/main.cpp
@@ -1,47 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qimageiohandler.h>
#include <qstringlist.h>
-#include "main.h"
-
#ifdef QT_NO_IMAGEFORMAT_GIF
#undef QT_NO_IMAGEFORMAT_GIF
#endif
@@ -49,6 +11,17 @@
QT_BEGIN_NAMESPACE
+class QGifPlugin : public QImageIOPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "gif.json")
+public:
+ QGifPlugin();
+ ~QGifPlugin();
+
+ Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
+ QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
+};
QGifPlugin::QGifPlugin()
{
@@ -74,3 +47,5 @@ QImageIOHandler *QGifPlugin::create(QIODevice *device, const QByteArray &format)
}
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/imageformats/gif/main.h b/src/plugins/imageformats/gif/main.h
deleted file mode 100644
index 84913a31d7..0000000000
--- a/src/plugins/imageformats/gif/main.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qimageiohandler.h>
-#include <qstringlist.h>
-
-#ifdef QT_NO_IMAGEFORMAT_GIF
-#undef QT_NO_IMAGEFORMAT_GIF
-#endif
-#include <qgifhandler_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGifPlugin : public QImageIOPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "gif.json")
-public:
- QGifPlugin();
- ~QGifPlugin();
-
- Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
- QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
-};
-
-QT_END_NAMESPACE
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index 7ef0d076bb..8ad4ff7510 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -1,55 +1,17 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-** WARNING:
-** A separate license from Unisys may be required to use the gif
-** reader. See http://www.unisys.com/about__unisys/lzw/
-** for information from Unisys
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qgifhandler_p.h"
#include <qimage.h>
#include <qiodevice.h>
+#include <qloggingcategory.h>
#include <qvariant.h>
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcGif, "qt.gui.imageio.gif")
+
#define Q_TRANSPARENT 0x00ffffff
// avoid going through QImage::scanLine() which calls detach
@@ -1121,7 +1083,7 @@ bool QGifHandler::canRead() const
bool QGifHandler::canRead(QIODevice *device)
{
if (!device) {
- qWarning("QGifHandler::canRead() called with no device");
+ qCWarning(lcGif, "QGifHandler::canRead() called with no device");
return false;
}
@@ -1184,9 +1146,9 @@ QVariant QGifHandler::option(ImageOption option) const
}
// before the first frame is read, or we have an empty data stream
if (frameNumber == -1)
- return (imageSizes.count() > 0) ? QVariant(imageSizes.at(0)) : QVariant();
+ return (imageSizes.size() > 0) ? QVariant(imageSizes.at(0)) : QVariant();
// after the last frame has been read, the next size is undefined
- if (frameNumber >= imageSizes.count() - 1)
+ if (frameNumber >= imageSizes.size() - 1)
return QVariant();
// and the last case: the size of the next frame
return imageSizes.at(frameNumber + 1);
@@ -1213,7 +1175,7 @@ int QGifHandler::imageCount() const
QGIFFormat::scan(device(), &imageSizes, &loopCnt);
scanIsCached = true;
}
- return imageSizes.count();
+ return imageSizes.size();
}
int QGifHandler::loopCount() const
diff --git a/src/plugins/imageformats/gif/qgifhandler_p.h b/src/plugins/imageformats/gif/qgifhandler_p.h
index 9508e9ac92..a27acf174d 100644
--- a/src/plugins/imageformats/gif/qgifhandler_p.h
+++ b/src/plugins/imageformats/gif/qgifhandler_p.h
@@ -1,46 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-** WARNING:
-** A separate license from Unisys may be required to use the gif
-** reader. See http://www.unisys.com/about__unisys/lzw/
-** for information from Unisys
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QGIFHANDLER_P_H
#define QGIFHANDLER_P_H
diff --git a/src/plugins/imageformats/ico/.prev_CMakeLists.txt b/src/plugins/imageformats/ico/.prev_CMakeLists.txt
deleted file mode 100644
index 53332f8c35..0000000000
--- a/src/plugins/imageformats/ico/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# Generated from ico.pro.
-
-#####################################################################
-## QICOPlugin Plugin:
-#####################################################################
-
-add_qt_plugin(QICOPlugin
- OUTPUT_NAME qico
- TYPE imageformats
- SOURCES
- main.cpp main.h
- qicohandler.cpp qicohandler.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::CorePrivate
- Qt::Gui
-)
-
-#### Keys ignored in scope 1:.:.:ico.pro:<TRUE>:
-# OTHER_FILES = "ico.json"
diff --git a/src/plugins/imageformats/ico/CMakeLists.txt b/src/plugins/imageformats/ico/CMakeLists.txt
index c5362df3e9..c9cd0f0d40 100644
--- a/src/plugins/imageformats/ico/CMakeLists.txt
+++ b/src/plugins/imageformats/ico/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from ico.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QICOPlugin Plugin:
@@ -6,15 +7,13 @@
qt_internal_add_plugin(QICOPlugin
OUTPUT_NAME qico
- TYPE imageformats
+ PLUGIN_TYPE imageformats
SOURCES
- main.cpp main.h
+ main.cpp
qicohandler.cpp qicohandler.h
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::CorePrivate
Qt::Gui
+ NO_UNITY_BUILD
)
-
-#### Keys ignored in scope 1:.:.:ico.pro:<TRUE>:
-# OTHER_FILES = "ico.json"
diff --git a/src/plugins/imageformats/ico/ico.pro b/src/plugins/imageformats/ico/ico.pro
deleted file mode 100644
index c8bb37eff2..0000000000
--- a/src/plugins/imageformats/ico/ico.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TARGET = qico
-
-HEADERS += main.h qicohandler.h
-SOURCES += main.cpp qicohandler.cpp
-OTHER_FILES += ico.json
-QT += core-private
-
-PLUGIN_TYPE = imageformats
-PLUGIN_CLASS_NAME = QICOPlugin
-load(qt_plugin)
diff --git a/src/plugins/imageformats/ico/main.cpp b/src/plugins/imageformats/ico/main.cpp
index b00d8c7fd3..d5199fa18b 100644
--- a/src/plugins/imageformats/ico/main.cpp
+++ b/src/plugins/imageformats/ico/main.cpp
@@ -1,46 +1,25 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#include "main.h"
+#include <qimageiohandler.h>
+#include <qdebug.h>
+
+#ifdef QT_NO_IMAGEFORMAT_ICO
+#undef QT_NO_IMAGEFORMAT_ICO
+#endif
+#include "qicohandler.h"
QT_BEGIN_NAMESPACE
+class QICOPlugin : public QImageIOPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "ico.json")
+public:
+ Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
+ QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
+};
+
QImageIOPlugin::Capabilities QICOPlugin::capabilities(QIODevice *device, const QByteArray &format) const
{
if (format == "ico" || format == "cur")
@@ -67,3 +46,5 @@ QImageIOHandler *QICOPlugin::create(QIODevice *device, const QByteArray &format)
}
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/imageformats/ico/main.h b/src/plugins/imageformats/ico/main.h
deleted file mode 100644
index b5875183c1..0000000000
--- a/src/plugins/imageformats/ico/main.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qimageiohandler.h>
-#include <qdebug.h>
-
-#ifdef QT_NO_IMAGEFORMAT_ICO
-#undef QT_NO_IMAGEFORMAT_ICO
-#endif
-#include "qicohandler.h"
-
-QT_BEGIN_NAMESPACE
-
-class QICOPlugin : public QImageIOPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "ico.json")
-public:
- Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
- QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
-};
-
-QT_END_NAMESPACE
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index 52e231e5a7..18b39766f5 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*!
\class QtIcoHandler
@@ -50,12 +14,17 @@
#include <QtCore/qendian.h>
#include <private/qendian_p.h>
#include <QtGui/QImage>
-#include <QtCore/QFile>
#include <QtCore/QBuffer>
+#include <QtCore/QFile>
+#include <QtCore/QLoggingCategory>
#include <qvariant.h>
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcIco, "qt.gui.imageio.ico")
+
+namespace {
+
// These next two structs represent how the icon information is stored
// in an ICO file.
typedef struct
@@ -95,6 +64,8 @@ typedef struct { // BMP information header
} BMP_INFOHDR ,*LPBMP_INFOHDR;
#define BMP_INFOHDR_SIZE 40
+}
+
class ICOReader
{
public:
@@ -205,9 +176,7 @@ bool ICOReader::canRead(QIODevice *iodev)
ICONDIR ikonDir;
if (readIconDir(iodev, &ikonDir)) {
- qint64 readBytes = ICONDIR_SIZE;
if (readIconDirEntry(iodev, &ikonDir.idEntries[0])) {
- readBytes += ICONDIRENTRY_SIZE;
// ICO format does not have a magic identifier, so we read 6 different values, which will hopefully be enough to identify the file.
if ( ikonDir.idReserved == 0
&& (ikonDir.idType == 1 || ikonDir.idType == 2)
@@ -465,7 +434,9 @@ QImage ICOReader::iconAt(int index)
static const uchar pngMagicData[] = { 137, 80, 78, 71, 13, 10, 26, 10 };
- iod->seek(iconEntry.dwImageOffset);
+ if (!iod->seek(iconEntry.dwImageOffset)
+ || iconEntry.dwBytesInRes > iod->bytesAvailable())
+ return img;
const QByteArray pngMagic = QByteArray::fromRawData((const char*)pngMagicData, sizeof(pngMagicData));
const bool isPngImage = (iod->read(pngMagic.size()) == pngMagic);
@@ -528,7 +499,7 @@ QImage ICOReader::iconAt(int index)
if (!image.isNull()) {
readBMP(image);
if (!image.isNull()) {
- if (icoAttrib.depth == 32) {
+ if (icoAttrib.nbits == 32) {
img = std::move(image).convertToFormat(QImage::Format_ARGB32_Premultiplied);
} else {
QImage mask(image.width(), image.height(), QImage::Format_Mono);
@@ -594,14 +565,14 @@ bool ICOReader::write(QIODevice *device, const QList<QImage> &images)
{
bool retValue = false;
- if (images.count()) {
+ if (images.size()) {
qint64 origOffset = device->pos();
ICONDIR id;
id.idReserved = 0;
id.idType = 1;
- id.idCount = images.count();
+ id.idCount = images.size();
ICONDIRENTRY * entries = new ICONDIRENTRY[id.idCount];
BMP_INFOHDR * bmpHeaders = new BMP_INFOHDR[id.idCount];
@@ -764,6 +735,8 @@ bool QtIcoHandler::supportsOption(ImageOption option) const
*/
bool QtIcoHandler::canRead() const
{
+ if (knownCanRead)
+ return true;
bool bCanRead = false;
QIODevice *device = QImageIOHandler::device();
if (device) {
@@ -771,8 +744,9 @@ bool QtIcoHandler::canRead() const
if (bCanRead)
setFormat("ico");
} else {
- qWarning("QtIcoHandler::canRead() called with no device");
+ qCWarning(lcIco, "QtIcoHandler::canRead() called with no device");
}
+ knownCanRead = bCanRead;
return bCanRead;
}
diff --git a/src/plugins/imageformats/ico/qicohandler.h b/src/plugins/imageformats/ico/qicohandler.h
index 0d44a67dfc..61c3eea465 100644
--- a/src/plugins/imageformats/ico/qicohandler.h
+++ b/src/plugins/imageformats/ico/qicohandler.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTICOHANDLER_H
#define QTICOHANDLER_H
@@ -66,7 +30,7 @@ public:
private:
int m_currentIconIndex;
ICOReader *m_pICOReader;
-
+ mutable bool knownCanRead = false;
};
QT_END_NAMESPACE
diff --git a/src/plugins/imageformats/imageformats.pro b/src/plugins/imageformats/imageformats.pro
deleted file mode 100644
index 9d1c0c8fdf..0000000000
--- a/src/plugins/imageformats/imageformats.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-TEMPLATE = subdirs
-QT_FOR_CONFIG += gui-private
-
-qtConfig(ico): SUBDIRS += ico
-qtConfig(jpeg): SUBDIRS += jpeg
-qtConfig(gif): SUBDIRS += gif
diff --git a/src/plugins/imageformats/jpeg/.prev_CMakeLists.txt b/src/plugins/imageformats/jpeg/.prev_CMakeLists.txt
deleted file mode 100644
index 95b3aceff5..0000000000
--- a/src/plugins/imageformats/jpeg/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-# Generated from jpeg.pro.
-
-#####################################################################
-## QJpegPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QJpegPlugin
- OUTPUT_NAME qjpeg
- TYPE imageformats
- SOURCES
- main.cpp main.h
- qjpeghandler.cpp qjpeghandler_p.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
-)
-
-#### Keys ignored in scope 1:.:.:jpeg.pro:<TRUE>:
-# OTHER_FILES = "jpeg.json"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(QJpegPlugin CONDITION QT_FEATURE_system_jpeg
- PUBLIC_LIBRARIES
- JPEG::JPEG
-)
-
-qt_extend_target(QJpegPlugin CONDITION NOT QT_FEATURE_system_jpeg
- SOURCES
- ../../../3rdparty/libjpeg/src/jaricom.c
- ../../../3rdparty/libjpeg/src/jcapimin.c
- ../../../3rdparty/libjpeg/src/jcapistd.c
- ../../../3rdparty/libjpeg/src/jcarith.c
- ../../../3rdparty/libjpeg/src/jccoefct.c
- ../../../3rdparty/libjpeg/src/jccolor.c
- ../../../3rdparty/libjpeg/src/jcdctmgr.c
- ../../../3rdparty/libjpeg/src/jchuff.c
- ../../../3rdparty/libjpeg/src/jcinit.c
- ../../../3rdparty/libjpeg/src/jcmainct.c
- ../../../3rdparty/libjpeg/src/jcmarker.c
- ../../../3rdparty/libjpeg/src/jcmaster.c
- ../../../3rdparty/libjpeg/src/jcomapi.c
- ../../../3rdparty/libjpeg/src/jcparam.c
- ../../../3rdparty/libjpeg/src/jcphuff.c
- ../../../3rdparty/libjpeg/src/jcprepct.c
- ../../../3rdparty/libjpeg/src/jcsample.c
- ../../../3rdparty/libjpeg/src/jctrans.c
- ../../../3rdparty/libjpeg/src/jdapimin.c
- ../../../3rdparty/libjpeg/src/jdapistd.c
- ../../../3rdparty/libjpeg/src/jdarith.c
- ../../../3rdparty/libjpeg/src/jdatadst.c
- ../../../3rdparty/libjpeg/src/jdatasrc.c
- ../../../3rdparty/libjpeg/src/jdcoefct.c
- ../../../3rdparty/libjpeg/src/jdcolor.c
- ../../../3rdparty/libjpeg/src/jddctmgr.c
- ../../../3rdparty/libjpeg/src/jdhuff.c
- ../../../3rdparty/libjpeg/src/jdinput.c
- ../../../3rdparty/libjpeg/src/jdmainct.c
- ../../../3rdparty/libjpeg/src/jdmarker.c
- ../../../3rdparty/libjpeg/src/jdmaster.c
- ../../../3rdparty/libjpeg/src/jdmerge.c
- ../../../3rdparty/libjpeg/src/jdphuff.c
- ../../../3rdparty/libjpeg/src/jdpostct.c
- ../../../3rdparty/libjpeg/src/jdsample.c
- ../../../3rdparty/libjpeg/src/jdtrans.c
- ../../../3rdparty/libjpeg/src/jerror.c
- ../../../3rdparty/libjpeg/src/jfdctflt.c
- ../../../3rdparty/libjpeg/src/jfdctfst.c
- ../../../3rdparty/libjpeg/src/jfdctint.c
- ../../../3rdparty/libjpeg/src/jidctflt.c
- ../../../3rdparty/libjpeg/src/jidctfst.c
- ../../../3rdparty/libjpeg/src/jidctint.c
- ../../../3rdparty/libjpeg/src/jidctred.c
- ../../../3rdparty/libjpeg/src/jmemmgr.c
- ../../../3rdparty/libjpeg/src/jmemnobs.c
- ../../../3rdparty/libjpeg/src/jquant1.c
- ../../../3rdparty/libjpeg/src/jquant2.c
- ../../../3rdparty/libjpeg/src/jsimd_none.c
- ../../../3rdparty/libjpeg/src/jutils.c
- INCLUDE_DIRECTORIES
- ../../../3rdparty/libjpeg
- ../../../3rdparty/libjpeg/src
-)
-
-#### Keys ignored in scope 5:.:../../../3rdparty:../../../3rdparty/libjpeg.pri:GCC:
-# QMAKE_CFLAGS_WARN_ON = "-Wno-unused-parameter" "-Wno-main"
-
-qt_extend_target(QJpegPlugin CONDITION MSVC AND NOT QT_FEATURE_system_jpeg
- DEFINES
- _CRT_SECURE_NO_WARNINGS
-)
diff --git a/src/plugins/imageformats/jpeg/CMakeLists.txt b/src/plugins/imageformats/jpeg/CMakeLists.txt
index 52c3aa6911..6b077a7647 100644
--- a/src/plugins/imageformats/jpeg/CMakeLists.txt
+++ b/src/plugins/imageformats/jpeg/CMakeLists.txt
@@ -1,6 +1,7 @@
-# Generated from jpeg.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
-qt_find_package(JPEG) # special case
+qt_find_package(WrapJpeg PROVIDED_TARGETS WrapJpeg::WrapJpeg)
#####################################################################
## QJpegPlugin Plugin:
@@ -8,97 +9,21 @@ qt_find_package(JPEG) # special case
qt_internal_add_plugin(QJpegPlugin
OUTPUT_NAME qjpeg
- TYPE imageformats
+ PLUGIN_TYPE imageformats
SOURCES
- main.cpp main.h
+ main.cpp
qjpeghandler.cpp qjpeghandler_p.h
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::CorePrivate
Qt::Gui
Qt::GuiPrivate
+ WrapJpeg::WrapJpeg
)
-#### Keys ignored in scope 1:.:.:jpeg.pro:<TRUE>:
-# OTHER_FILES = "jpeg.json"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(QJpegPlugin CONDITION QT_FEATURE_system_jpeg
- PUBLIC_LIBRARIES
- JPEG::JPEG
-)
-
-qt_extend_target(QJpegPlugin CONDITION NOT QT_FEATURE_system_jpeg
- SOURCES
- ../../../3rdparty/libjpeg/src/jaricom.c
- ../../../3rdparty/libjpeg/src/jcapimin.c
- ../../../3rdparty/libjpeg/src/jcapistd.c
- ../../../3rdparty/libjpeg/src/jcarith.c
- ../../../3rdparty/libjpeg/src/jccoefct.c
- ../../../3rdparty/libjpeg/src/jccolor.c
- ../../../3rdparty/libjpeg/src/jcdctmgr.c
- ../../../3rdparty/libjpeg/src/jchuff.c
- ../../../3rdparty/libjpeg/src/jcinit.c
- ../../../3rdparty/libjpeg/src/jcmainct.c
- ../../../3rdparty/libjpeg/src/jcmarker.c
- ../../../3rdparty/libjpeg/src/jcmaster.c
- ../../../3rdparty/libjpeg/src/jcomapi.c
- ../../../3rdparty/libjpeg/src/jcparam.c
- ../../../3rdparty/libjpeg/src/jcphuff.c
- ../../../3rdparty/libjpeg/src/jcprepct.c
- ../../../3rdparty/libjpeg/src/jcsample.c
- ../../../3rdparty/libjpeg/src/jctrans.c
- ../../../3rdparty/libjpeg/src/jdapimin.c
- ../../../3rdparty/libjpeg/src/jdapistd.c
- ../../../3rdparty/libjpeg/src/jdarith.c
- ../../../3rdparty/libjpeg/src/jdatadst.c
- ../../../3rdparty/libjpeg/src/jdatasrc.c
- ../../../3rdparty/libjpeg/src/jdcoefct.c
- ../../../3rdparty/libjpeg/src/jdcolor.c
- ../../../3rdparty/libjpeg/src/jddctmgr.c
- ../../../3rdparty/libjpeg/src/jdhuff.c
- ../../../3rdparty/libjpeg/src/jdinput.c
- ../../../3rdparty/libjpeg/src/jdmainct.c
- ../../../3rdparty/libjpeg/src/jdmarker.c
- ../../../3rdparty/libjpeg/src/jdmaster.c
- ../../../3rdparty/libjpeg/src/jdmerge.c
- ../../../3rdparty/libjpeg/src/jdphuff.c
- ../../../3rdparty/libjpeg/src/jdpostct.c
- ../../../3rdparty/libjpeg/src/jdsample.c
- ../../../3rdparty/libjpeg/src/jdtrans.c
- ../../../3rdparty/libjpeg/src/jerror.c
- ../../../3rdparty/libjpeg/src/jfdctflt.c
- ../../../3rdparty/libjpeg/src/jfdctfst.c
- ../../../3rdparty/libjpeg/src/jfdctint.c
- ../../../3rdparty/libjpeg/src/jidctflt.c
- ../../../3rdparty/libjpeg/src/jidctfst.c
- ../../../3rdparty/libjpeg/src/jidctint.c
- ../../../3rdparty/libjpeg/src/jidctred.c
- ../../../3rdparty/libjpeg/src/jmemmgr.c
- ../../../3rdparty/libjpeg/src/jmemnobs.c
- ../../../3rdparty/libjpeg/src/jquant1.c
- ../../../3rdparty/libjpeg/src/jquant2.c
- ../../../3rdparty/libjpeg/src/jsimd_none.c
- ../../../3rdparty/libjpeg/src/jutils.c
- INCLUDE_DIRECTORIES
- ../../../3rdparty/libjpeg
- ../../../3rdparty/libjpeg/src
-)
-
-# special case begin
-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"
- OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
- OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
- target_compile_options(QJpegPlugin PRIVATE "-Wno-unused-parameter")
+# Fails to build on Windows with a static Qt, PCH enabled and
+# the vendored libjpeg sources, due to 'boolean'
+# redefinition in jmorecfg.h and rpcndr.h.
+if(WIN32 AND NOT BUILD_SHARED_LIBS)
+ qt_update_ignore_pch_source(QJpegPlugin "qjpeghandler.cpp")
endif()
-# special case end
-
-#### Keys ignored in scope 5:.:../../../3rdparty:../../../3rdparty/libjpeg.pri:GCC:
-# QMAKE_CFLAGS_WARN_ON = "-Wno-unused-parameter" "-Wno-main"
-
-qt_extend_target(QJpegPlugin CONDITION MSVC AND NOT QT_FEATURE_system_jpeg
- DEFINES
- _CRT_SECURE_NO_WARNINGS
-)
diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
deleted file mode 100644
index 89476e62f5..0000000000
--- a/src/plugins/imageformats/jpeg/jpeg.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-TARGET = qjpeg
-
-QT += core-private gui-private
-
-SOURCES += main.cpp qjpeghandler.cpp
-HEADERS += main.h qjpeghandler_p.h
-
-qtConfig(system-jpeg) {
- QMAKE_USE += libjpeg
-} else {
- include($$PWD/../../../3rdparty/libjpeg.pri)
-}
-
-OTHER_FILES += jpeg.json
-
-PLUGIN_TYPE = imageformats
-PLUGIN_CLASS_NAME = QJpegPlugin
-load(qt_plugin)
diff --git a/src/plugins/imageformats/jpeg/main.cpp b/src/plugins/imageformats/jpeg/main.cpp
index 83f13c4a9d..c869d07650 100644
--- a/src/plugins/imageformats/jpeg/main.cpp
+++ b/src/plugins/imageformats/jpeg/main.cpp
@@ -1,43 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-#include "main.h"
+#include <qimageiohandler.h>
+#include <qstringlist.h>
#ifdef QT_NO_IMAGEFORMAT_JPEG
#undef QT_NO_IMAGEFORMAT_JPEG
@@ -46,6 +11,15 @@
QT_BEGIN_NAMESPACE
+class QJpegPlugin : public QImageIOPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "jpeg.json")
+public:
+ Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
+ QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
+};
+
QImageIOPlugin::Capabilities QJpegPlugin::capabilities(QIODevice *device, const QByteArray &format) const
{
if (format == "jpeg" || format == "jpg")
@@ -72,3 +46,5 @@ QImageIOHandler *QJpegPlugin::create(QIODevice *device, const QByteArray &format
}
QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/imageformats/jpeg/main.h b/src/plugins/imageformats/jpeg/main.h
deleted file mode 100644
index 1845c8c124..0000000000
--- a/src/plugins/imageformats/jpeg/main.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qimageiohandler.h>
-#include <qstringlist.h>
-
-#ifdef QT_NO_IMAGEFORMAT_JPEG
-#undef QT_NO_IMAGEFORMAT_JPEG
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QJpegPlugin : public QImageIOPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "jpeg.json")
-public:
- Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
- QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
-};
-
-QT_END_NAMESPACE
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 72d932445e..59b73587c5 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qjpeghandler_p.h"
@@ -45,6 +9,7 @@
#include <qdebug.h>
#include <qimage.h>
#include <qlist.h>
+#include <qloggingcategory.h>
#include <qmath.h>
#include <qvariant.h>
#include <private/qicc_p.h>
@@ -60,13 +25,6 @@
// including jpeglib.h seems to be a little messy
extern "C" {
-// jpeglib.h->jmorecfg.h tries to typedef int boolean; but this conflicts with
-// some Windows headers that may or may not have been included
-#ifdef HAVE_BOOLEAN
-# undef HAVE_BOOLEAN
-#endif
-#define boolean jboolean
-
#define XMD_H // shut JPEGlib up
#include <jpeglib.h>
#ifdef const
@@ -75,6 +33,9 @@ extern "C" {
}
QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(lcJpeg, "qt.gui.imageio.jpeg")
+
QT_WARNING_DISABLE_GCC("-Wclobbered")
Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32(quint32 *dst, const uchar *src, int len);
@@ -88,10 +49,8 @@ extern "C" {
static void my_error_exit (j_common_ptr cinfo)
{
+ (*cinfo->err->output_message)(cinfo);
my_error_mgr* myerr = (my_error_mgr*) cinfo->err;
- char buffer[JMSG_LENGTH_MAX];
- (*cinfo->err->format_message)(cinfo, buffer);
- qWarning("%s", buffer);
longjmp(myerr->setjmp_buffer, 1);
}
@@ -99,7 +58,7 @@ static void my_output_message(j_common_ptr cinfo)
{
char buffer[JMSG_LENGTH_MAX];
(*cinfo->err->format_message)(cinfo, buffer);
- qWarning("%s", buffer);
+ qCWarning(lcJpeg,"%s", buffer);
}
}
@@ -213,9 +172,14 @@ inline static bool read_jpeg_format(QImage::Format &format, j_decompress_ptr cin
format = QImage::Format_Grayscale8;
break;
case 3:
- case 4:
format = QImage::Format_RGB32;
break;
+ case 4:
+ if (cinfo->out_color_space == JCS_CMYK)
+ format = QImage::Format_CMYK8888;
+ else
+ format = QImage::Format_RGB32;
+ break;
default:
result = false;
break;
@@ -233,9 +197,14 @@ static bool ensureValidImage(QImage *dest, struct jpeg_decompress_struct *info,
format = QImage::Format_Grayscale8;
break;
case 3:
- case 4:
format = QImage::Format_RGB32;
break;
+ case 4:
+ if (info->out_color_space == JCS_CMYK)
+ format = QImage::Format_CMYK8888;
+ else
+ format = QImage::Format_RGB32;
+ break;
default:
return false; // unsupported format
}
@@ -247,7 +216,7 @@ static bool read_jpeg_image(QImage *outImage,
QSize scaledSize, QRect scaledClipRect,
QRect clipRect, int quality,
Rgb888ToRgb32Converter converter,
- j_decompress_ptr info, struct my_error_mgr* err )
+ j_decompress_ptr info, struct my_error_mgr* err, bool invertCMYK)
{
if (!setjmp(err->setjmp_buffer)) {
// -1 means default quality.
@@ -330,7 +299,7 @@ static bool read_jpeg_image(QImage *outImage,
}
// If high quality not required, use fast decompression
- if( quality < HIGH_QUALITY_THRESHOLD ) {
+ if ( quality < HIGH_QUALITY_THRESHOLD ) {
info->dct_method = JDCT_IFAST;
info->do_fancy_upsampling = FALSE;
}
@@ -356,7 +325,7 @@ static bool read_jpeg_image(QImage *outImage,
// Allocate memory for the clipped QImage.
if (!ensureValidImage(outImage, info, clip.size()))
- longjmp(err->setjmp_buffer, 1);
+ return false;
// Avoid memcpy() overhead if grayscale with no clipping.
bool quickGray = (info->output_components == 1 &&
@@ -389,14 +358,15 @@ static bool read_jpeg_image(QImage *outImage,
QRgb *out = (QRgb*)outImage->scanLine(y);
converter(out, in, clip.width());
} else if (info->out_color_space == JCS_CMYK) {
- // Convert CMYK->RGB.
uchar *in = rows[0] + clip.x() * 4;
- QRgb *out = (QRgb*)outImage->scanLine(y);
- for (int i = 0; i < clip.width(); ++i) {
- int k = in[3];
- *out++ = qRgb(k * in[0] / 255, k * in[1] / 255,
- k * in[2] / 255);
- in += 4;
+ quint32 *out = (quint32*)outImage->scanLine(y);
+ if (invertCMYK) {
+ for (int i = 0; i < clip.width(); ++i) {
+ *out++ = 0xffffffffu - (in[0] | in[1] << 8 | in[2] << 16 | in[3] << 24);
+ in += 4;
+ }
+ } else {
+ memcpy(out, in, clip.width() * 4);
}
} else if (info->output_components == 1) {
// Grayscale.
@@ -432,8 +402,10 @@ static bool read_jpeg_image(QImage *outImage,
*outImage = outImage->copy(scaledClipRect);
return !outImage->isNull();
}
- else
+ else {
+ my_output_message(j_common_ptr(info));
return false;
+ }
}
struct my_jpeg_destination_mgr : public jpeg_destination_mgr {
@@ -498,7 +470,7 @@ static inline void set_text(const QImage &image, j_compress_ptr cinfo, const QSt
if (!comment.isEmpty())
comment += ": ";
comment += it.value().toUtf8();
- if (comment.length() > maxMarkerSize)
+ if (comment.size() > maxMarkerSize)
comment.truncate(maxMarkerSize);
jpeg_write_marker(cinfo, JPEG_COM, (const JOCTET *)comment.constData(), comment.size());
}
@@ -532,7 +504,8 @@ static bool do_write_jpeg_image(struct jpeg_compress_struct &cinfo,
int sourceQuality,
const QString &description,
bool optimize,
- bool progressive)
+ bool progressive,
+ bool invertCMYK)
{
bool success = false;
const QList<QRgb> cmap = image.colorTable();
@@ -572,10 +545,15 @@ static bool do_write_jpeg_image(struct jpeg_compress_struct &cinfo,
cinfo.in_color_space = gray ? JCS_GRAYSCALE : JCS_RGB;
break;
case QImage::Format_Grayscale8:
+ case QImage::Format_Grayscale16:
gray = true;
cinfo.input_components = 1;
cinfo.in_color_space = JCS_GRAYSCALE;
break;
+ case QImage::Format_CMYK8888:
+ cinfo.input_components = 4;
+ cinfo.in_color_space = JCS_CMYK;
+ break;
default:
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;
@@ -608,7 +586,7 @@ static bool do_write_jpeg_image(struct jpeg_compress_struct &cinfo,
jpeg_start_compress(&cinfo, TRUE);
set_text(image, &cinfo, description);
- if (cinfo.in_color_space == JCS_RGB)
+ if (cinfo.in_color_space == JCS_RGB || cinfo.in_color_space == JCS_CMYK)
write_icc_profile(image, &cinfo);
row_pointer[0] = new uchar[cinfo.image_width*cinfo.input_components];
@@ -670,6 +648,12 @@ static bool do_write_jpeg_image(struct jpeg_compress_struct &cinfo,
case QImage::Format_Grayscale8:
memcpy(row, image.constScanLine(cinfo.next_scanline), w);
break;
+ case QImage::Format_Grayscale16:
+ {
+ QImage rowImg = image.copy(0, cinfo.next_scanline, w, 1).convertToFormat(QImage::Format_Grayscale8);
+ memcpy(row, rowImg.constScanLine(0), w);
+ }
+ break;
case QImage::Format_RGB888:
memcpy(row, image.constScanLine(cinfo.next_scanline), w * 3);
break;
@@ -686,6 +670,17 @@ static bool do_write_jpeg_image(struct jpeg_compress_struct &cinfo,
}
}
break;
+ case QImage::Format_CMYK8888: {
+ auto *cmykIn = reinterpret_cast<const quint32 *>(image.constScanLine(cinfo.next_scanline));
+ auto *cmykOut = reinterpret_cast<quint32 *>(row);
+ if (invertCMYK) {
+ for (int i = 0; i < w; ++i)
+ cmykOut[i] = 0xffffffffu - cmykIn[i];
+ } else {
+ memcpy(cmykOut, cmykIn, w * 4);
+ }
+ break;
+ }
default:
{
// (Testing shows that this way is actually faster than converting to RGB888 + memcpy)
@@ -707,6 +702,7 @@ static bool do_write_jpeg_image(struct jpeg_compress_struct &cinfo,
jpeg_destroy_compress(&cinfo);
success = true;
} else {
+ my_output_message(j_common_ptr(&cinfo));
jpeg_destroy_compress(&cinfo);
success = false;
}
@@ -720,7 +716,8 @@ static bool write_jpeg_image(const QImage &image,
int sourceQuality,
const QString &description,
bool optimize,
- bool progressive)
+ bool progressive,
+ bool invertCMYK)
{
// protect these objects from the setjmp/longjmp pair inside
// do_write_jpeg_image (by making them non-local).
@@ -731,7 +728,7 @@ static bool write_jpeg_image(const QImage &image,
const bool success = do_write_jpeg_image(cinfo, row_pointer,
image, device,
sourceQuality, description,
- optimize, progressive);
+ optimize, progressive, invertCMYK);
delete [] row_pointer[0];
return success;
@@ -754,7 +751,7 @@ public:
~QJpegHandlerPrivate()
{
- if(iod_src)
+ if (iod_src)
{
jpeg_destroy_decompress(&info);
delete iod_src;
@@ -776,6 +773,21 @@ public:
QStringList readTexts;
QByteArray iccProfile;
+ // Photoshop historically invertes the quantities in CMYK JPEG files:
+ // 0 means 100% ink, 255 means no ink. Every reader does the same,
+ // for compatibility reasons.
+ // Use such an interpretation by default, but also offer the alternative
+ // of not inverting the channels.
+ // This is just a "fancy" API; it could be reduced to a boolean setting
+ // for CMYK files.
+ enum class SubType {
+ Automatic,
+ Inverted_CMYK,
+ CMYK,
+ NSubTypes
+ };
+ SubType subType = SubType::Automatic;
+
struct jpeg_decompress_struct info;
struct my_jpeg_source_mgr * iod_src;
struct my_error_mgr err;
@@ -790,6 +802,14 @@ public:
QJpegHandler *q;
};
+static const char SupportedJPEGSubtypes[][14] = {
+ "Automatic",
+ "Inverted_CMYK",
+ "CMYK"
+};
+
+static_assert(std::size(SupportedJPEGSubtypes) == size_t(QJpegHandlerPrivate::SubType::NSubTypes));
+
static bool readExifHeader(QDataStream &stream)
{
char prefix[6];
@@ -913,7 +933,7 @@ static QImageIOHandler::Transformations exif2Qt(int exifOrientation)
case 8: // rotate 270 CW
return QImageIOHandler::TransformationRotate270;
}
- qWarning("Invalid EXIF orientation");
+ qCWarning(lcJpeg, "Invalid EXIF orientation");
return QImageIOHandler::TransformationNone;
}
@@ -922,7 +942,7 @@ static QImageIOHandler::Transformations exif2Qt(int exifOrientation)
*/
bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device)
{
- if(state == Ready)
+ if (state == Ready)
{
state = Error;
iod_src = new my_jpeg_source_mgr(device);
@@ -989,24 +1009,25 @@ bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device)
state = ReadHeader;
return true;
}
- else
- {
+ else {
+ my_output_message(j_common_ptr(&info));
return false;
}
}
- else if(state == Error)
+ else if (state == Error)
return false;
return true;
}
bool QJpegHandlerPrivate::read(QImage *image)
{
- if(state == Ready)
+ if (state == Ready)
readJpegHeader(q->device());
- if(state == ReadHeader)
+ if (state == ReadHeader)
{
- bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, rgb888ToRgb32ConverterPtr, &info, &err);
+ const bool invertCMYK = subType != QJpegHandlerPrivate::SubType::CMYK;
+ bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, rgb888ToRgb32ConverterPtr, &info, &err, invertCMYK);
if (success) {
for (int i = 0; i < readTexts.size()-1; i+=2)
image->setText(readTexts.at(i), readTexts.at(i+1));
@@ -1057,7 +1078,7 @@ QJpegHandler::~QJpegHandler()
bool QJpegHandler::canRead() const
{
- if(d->state == QJpegHandlerPrivate::Ready && !canRead(device()))
+ if (d->state == QJpegHandlerPrivate::Ready && !canRead(device()))
return false;
if (d->state != QJpegHandlerPrivate::Error && d->state != QJpegHandlerPrivate::ReadingEnd) {
@@ -1071,7 +1092,7 @@ bool QJpegHandler::canRead() const
bool QJpegHandler::canRead(QIODevice *device)
{
if (!device) {
- qWarning("QJpegHandler::canRead() called with no device");
+ qCWarning(lcJpeg, "QJpegHandler::canRead() called with no device");
return false;
}
@@ -1092,13 +1113,14 @@ extern void qt_imageTransform(QImage &src, QImageIOHandler::Transformations orie
bool QJpegHandler::write(const QImage &image)
{
+ const bool invertCMYK = d->subType != QJpegHandlerPrivate::SubType::CMYK;
if (d->transformation != QImageIOHandler::TransformationNone) {
// We don't support writing EXIF headers so apply the transform to the data.
QImage img = image;
qt_imageTransform(img, d->transformation);
- return write_jpeg_image(img, device(), d->quality, d->description, d->optimize, d->progressive);
+ return write_jpeg_image(img, device(), d->quality, d->description, d->optimize, d->progressive, invertCMYK);
}
- return write_jpeg_image(image, device(), d->quality, d->description, d->optimize, d->progressive);
+ return write_jpeg_image(image, device(), d->quality, d->description, d->optimize, d->progressive, invertCMYK);
}
bool QJpegHandler::supportsOption(ImageOption option) const
@@ -1109,6 +1131,8 @@ bool QJpegHandler::supportsOption(ImageOption option) const
|| option == ClipRect
|| option == Description
|| option == Size
+ || option == SubType
+ || option == SupportedSubTypes
|| option == ImageFormat
|| option == OptimizedWrite
|| option == ProgressiveScanWrite
@@ -1132,6 +1156,13 @@ QVariant QJpegHandler::option(ImageOption option) const
case Size:
d->readJpegHeader(device());
return d->size;
+ case SubType:
+ return QByteArray(SupportedJPEGSubtypes[int(d->subType)]);
+ case SupportedSubTypes: {
+ QByteArrayList list(std::begin(SupportedJPEGSubtypes),
+ std::end(SupportedJPEGSubtypes));
+ return QVariant::fromValue(list);
+ }
case ImageFormat:
d->readJpegHeader(device());
return d->format;
@@ -1167,6 +1198,16 @@ void QJpegHandler::setOption(ImageOption option, const QVariant &value)
case Description:
d->description = value.toString();
break;
+ case SubType: {
+ const QByteArray subType = value.toByteArray();
+ for (size_t i = 0; i < std::size(SupportedJPEGSubtypes); ++i) {
+ if (subType == SupportedJPEGSubtypes[i]) {
+ d->subType = QJpegHandlerPrivate::SubType(i);
+ break;
+ }
+ }
+ break;
+ }
case OptimizedWrite:
d->optimize = value.toBool();
break;
@@ -1177,6 +1218,7 @@ void QJpegHandler::setOption(ImageOption option, const QVariant &value)
int transformation = value.toInt();
if (transformation > 0 && transformation < 8)
d->transformation = QImageIOHandler::Transformations(transformation);
+ break;
}
default:
break;
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler_p.h b/src/plugins/imageformats/jpeg/qjpeghandler_p.h
index 43ca17317a..e246f7a6e1 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler_p.h
+++ b/src/plugins/imageformats/jpeg/qjpeghandler_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QJPEGHANDLER_P_H
#define QJPEGHANDLER_P_H