Compare commits

...

17 Commits

Author SHA1 Message Date
4c0c6c8d60 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.51.0 release. 2018-10-07 10:07:12 +00:00
f485719012 kimg_rgb: optimize away QRegExp and QString::fromLocal8Bit.
Summary:
The code is even simpler this way.

Found by using heaptrack.

Test Plan: the unittest for rgb still passes.

Reviewers: cfeck

Reviewed By: cfeck

Subscribers: jtamate, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15890
2018-10-03 00:51:29 +02:00
1db1b94657 [EPS] qWarning -> qCWarning 2018-09-17 11:56:58 +02:00
98c65a438d [EPS] Fix crash at app shutdown (being tried to persist clipboard image)
Summary:
Deny any capabilities when there is no QApp instance.

BUG: 397040

Test Plan:
Untested, as I do not experience the bug on my system and had no time to
invest into trying to.

Reviewers: zccrs, dfaure, pino

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15405
2018-09-17 11:54:18 +02:00
167967a145 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.50.0 release. 2018-08-31 22:22:12 +00:00
17239a7ea6 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.49.0 release. 2018-08-04 08:43:39 +00:00
118d262bec GIT_SILENT Upgrade ECM and KF5 version requirements for 5.48.0 release. 2018-07-07 21:52:47 +00:00
67a84f459d Use override 2018-06-12 07:01:11 +02:00
de2b942b33 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.47.0 release. 2018-06-02 16:28:21 +00:00
813a7bdddb Remove duplicated mime types from json files
Qt expects a bijection between keys and mime types.
2018-05-25 14:32:11 +03:00
a4d1f4db1d Use override 2018-05-23 08:06:50 +02:00
29d090f078 GIT_SILENT Upgrade ECM and KF5 version requirements for 5.46.0 release. 2018-05-05 12:39:09 +00:00
19f33239e7 [XCF/GIMP loader] Raise maximimum allowed image size to 32767x32767 on 64 bit platforms
The GIMP image loader had a limit to 16K x 16K pixels, because this would
already exhaust the 2 GByte address space limit of 32 bit systems.

Remove this limit on 64 bit systems to allow the full 32K x 32K size.

BUG: 391970

Differential Revision: https://phabricator.kde.org/D12557
2018-05-02 02:10:26 +02:00
4668fbbcdc GIT_SILENT Upgrade ECM and KF5 version requirements for 5.45.0 release. 2018-04-07 07:47:44 +00:00
698ba297d3 We depend against 5.8.0 now 2018-03-27 08:01:04 +02:00
3a9bafdbbe GIT_SILENT Upgrade Qt5 version requirement to 5.8.0. 2018-03-24 13:34:11 +00:00
e5b226e804 Remove not necessary QtCore and co 2018-03-11 13:49:26 +01:00
21 changed files with 88 additions and 92 deletions

View File

@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.0)
project(KImageFormats) project(KImageFormats)
include(FeatureSummary) include(FeatureSummary)
find_package(ECM 5.44.0 NO_MODULE) find_package(ECM 5.51.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules")
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
@ -17,7 +17,7 @@ include(KDECMakeSettings)
include(CheckIncludeFiles) include(CheckIncludeFiles)
set(REQUIRED_QT_VERSION 5.7.0) set(REQUIRED_QT_VERSION 5.8.0)
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
find_package(KF5Archive) find_package(KF5Archive)

View File

@ -14,6 +14,7 @@
#include <QPrinter> #include <QPrinter>
#include <QProcess> #include <QProcess>
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QCoreApplication>
// logging category for this framework, default: log stuff >= warning // logging category for this framework, default: log stuff >= warning
Q_LOGGING_CATEGORY(EPSPLUGIN, "epsplugin", QtWarningMsg) Q_LOGGING_CATEGORY(EPSPLUGIN, "epsplugin", QtWarningMsg)
@ -156,7 +157,7 @@ bool EPSHandler::read(QImage *image)
QTemporaryFile tmpFile; QTemporaryFile tmpFile;
if (!tmpFile.open()) { if (!tmpFile.open()) {
qWarning() << "Could not create the temporary file" << tmpFile.fileName(); qCWarning(EPSPLUGIN) << "Could not create the temporary file" << tmpFile.fileName();
return false; return false;
} }
qCDebug(EPSPLUGIN) << "temporary file:" << tmpFile.fileName(); qCDebug(EPSPLUGIN) << "temporary file:" << tmpFile.fileName();
@ -198,7 +199,7 @@ bool EPSHandler::read(QImage *image)
converter.setProcessChannelMode(QProcess::ForwardedErrorChannel); converter.setProcessChannelMode(QProcess::ForwardedErrorChannel);
converter.start(QStringLiteral("gs"), gsArgs); converter.start(QStringLiteral("gs"), gsArgs);
if (!converter.waitForStarted(3000)) { if (!converter.waitForStarted(3000)) {
qWarning() << "Reading EPS files requires gs (from GhostScript)"; qCWarning(EPSPLUGIN) << "Reading EPS files requires gs (from GhostScript)";
return false; return false;
} }
@ -297,7 +298,7 @@ bool EPSHandler::write(const QImage &image)
converter.start(QStringLiteral("gs"), gsArgs); converter.start(QStringLiteral("gs"), gsArgs);
if (!converter.waitForStarted(3000)) { if (!converter.waitForStarted(3000)) {
qWarning() << "Creating EPS files requires pdftops (from Poppler) or gs (from GhostScript)"; qCWarning(EPSPLUGIN) << "Creating EPS files requires pdftops (from Poppler) or gs (from GhostScript)";
return false; return false;
} }
} }
@ -312,7 +313,7 @@ bool EPSHandler::write(const QImage &image)
bool EPSHandler::canRead(QIODevice *device) bool EPSHandler::canRead(QIODevice *device)
{ {
if (!device) { if (!device) {
qWarning("EPSHandler::canRead() called with no device"); qCWarning(EPSPLUGIN) << "EPSHandler::canRead() called with no device";
return false; return false;
} }
@ -333,6 +334,15 @@ bool EPSHandler::canRead(QIODevice *device)
QImageIOPlugin::Capabilities EPSPlugin::capabilities(QIODevice *device, const QByteArray &format) const QImageIOPlugin::Capabilities EPSPlugin::capabilities(QIODevice *device, const QByteArray &format) const
{ {
// prevent bug #397040: when on app shutdown the clipboard content is to be copied to survive end of the app,
// QXcbIntegration looks for some QImageIOHandler to apply, querying the capabilities and picking any first.
// At that point this plugin no longer has its requirements e.g. to run the external process, so we have to deny.
// The capabilities seem to be queried on demand in Qt code and not cached, so it's fine to report based
// in current dynamic state
if (!QCoreApplication::instance()) {
return {};
}
if (format == "eps" || format == "epsi" || format == "epsf") { if (format == "eps" || format == "epsi" || format == "epsf") {
return Capabilities(CanRead | CanWrite); return Capabilities(CanRead | CanWrite);
} }

View File

@ -15,9 +15,9 @@ class EPSHandler : public QImageIOHandler
public: public:
EPSHandler(); EPSHandler();
bool canRead() const Q_DECL_OVERRIDE; bool canRead() const override;
bool read(QImage *image) Q_DECL_OVERRIDE; bool read(QImage *image) override;
bool write(const QImage &image) Q_DECL_OVERRIDE; bool write(const QImage &image) override;
static bool canRead(QIODevice *device); static bool canRead(QIODevice *device);
}; };
@ -28,8 +28,8 @@ class EPSPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "eps.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "eps.json")
public: public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE; Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE; QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
}; };
Q_DECLARE_LOGGING_CATEGORY(EPSPLUGIN) Q_DECLARE_LOGGING_CATEGORY(EPSPLUGIN)

View File

@ -41,10 +41,10 @@ public:
{ {
} }
bool read(char c[], int n) Q_DECL_OVERRIDE; bool read(char c[], int n) override;
Imf::Int64 tellg() Q_DECL_OVERRIDE; Imf::Int64 tellg() override;
void seekg(Imf::Int64 pos) Q_DECL_OVERRIDE; void seekg(Imf::Int64 pos) override;
void clear() Q_DECL_OVERRIDE; void clear() override;
private: private:
QIODevice *m_dev; QIODevice *m_dev;

View File

@ -18,8 +18,8 @@ class EXRHandler : public QImageIOHandler
public: public:
EXRHandler(); EXRHandler();
bool canRead() const Q_DECL_OVERRIDE; bool canRead() const override;
bool read(QImage *outImage) Q_DECL_OVERRIDE; bool read(QImage *outImage) override;
static bool canRead(QIODevice *device); static bool canRead(QIODevice *device);
}; };
@ -30,8 +30,8 @@ class EXRPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "exr.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "exr.json")
public: public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE; Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE; QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
}; };
#endif // KIMG_EXR_H #endif // KIMG_EXR_H

View File

@ -11,7 +11,7 @@
#include "hdr_p.h" #include "hdr_p.h"
#include <QImage> #include <QImage>
#include <QtCore/QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>

View File

@ -17,8 +17,8 @@ class KraHandler : public QImageIOHandler
public: public:
KraHandler(); KraHandler();
bool canRead() const Q_DECL_OVERRIDE; bool canRead() const override;
bool read(QImage *image) Q_DECL_OVERRIDE; bool read(QImage *image) override;
static bool canRead(QIODevice *device); static bool canRead(QIODevice *device);
}; };
@ -29,8 +29,8 @@ class KraPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "kra.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "kra.json")
public: public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE; Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE; QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
}; };

View File

@ -1,5 +1,4 @@
{ {
"Keys": [ "kra" ], "Keys": [ "kra" ],
"MimeTypes": [ "application/x-krita", "application/x-krita" ] "MimeTypes": [ "application/x-krita" ]
} }

View File

@ -17,8 +17,8 @@ class OraHandler : public QImageIOHandler
public: public:
OraHandler(); OraHandler();
bool canRead() const Q_DECL_OVERRIDE; bool canRead() const override;
bool read(QImage *image) Q_DECL_OVERRIDE; bool read(QImage *image) override;
static bool canRead(QIODevice *device); static bool canRead(QIODevice *device);
}; };
@ -29,8 +29,8 @@ class OraPlugin : public QImageIOPlugin
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "ora.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "ora.json")
public: public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE; Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE; QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
}; };

View File

@ -1,5 +1,4 @@
{ {
"Keys": [ "ora" ], "Keys": [ "ora" ],
"MimeTypes": [ "image/openraster", "image/openraster" ] "MimeTypes": [ "image/openraster" ]
} }

View File

@ -17,9 +17,9 @@ class PCXHandler : public QImageIOHandler
public: public:
PCXHandler(); PCXHandler();
bool canRead() const Q_DECL_OVERRIDE; bool canRead() const override;
bool read(QImage *image) Q_DECL_OVERRIDE; bool read(QImage *image) override;
bool write(const QImage &image) Q_DECL_OVERRIDE; bool write(const QImage &image) override;
static bool canRead(QIODevice *device); static bool canRead(QIODevice *device);
}; };
@ -30,8 +30,8 @@ class PCXPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "pcx.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "pcx.json")
public: public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE; Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE; QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
}; };
#endif // KIMG_PCX_H #endif // KIMG_PCX_H

View File

@ -154,13 +154,13 @@ struct PicChannel {
class SoftimagePICHandler : public QImageIOHandler class SoftimagePICHandler : public QImageIOHandler
{ {
public: public:
bool canRead() const Q_DECL_OVERRIDE; bool canRead() const override;
bool read(QImage *image) Q_DECL_OVERRIDE; bool read(QImage *image) override;
bool write(const QImage &) Q_DECL_OVERRIDE; bool write(const QImage &) override;
QVariant option(ImageOption option) const Q_DECL_OVERRIDE; QVariant option(ImageOption option) const override;
void setOption(ImageOption option, const QVariant &value) Q_DECL_OVERRIDE; void setOption(ImageOption option, const QVariant &value) override;
bool supportsOption(ImageOption option) const Q_DECL_OVERRIDE; bool supportsOption(ImageOption option) const override;
static bool canRead(QIODevice *device); static bool canRead(QIODevice *device);
@ -195,8 +195,8 @@ class SoftimagePICPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "pic.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "pic.json")
public: public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE; Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE; QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
}; };
#endif // KIMG_PIC_H #endif // KIMG_PIC_H

View File

@ -17,8 +17,8 @@ class PSDHandler : public QImageIOHandler
public: public:
PSDHandler(); PSDHandler();
bool canRead() const Q_DECL_OVERRIDE; bool canRead() const override;
bool read(QImage *image) Q_DECL_OVERRIDE; bool read(QImage *image) override;
static bool canRead(QIODevice *device); static bool canRead(QIODevice *device);
}; };
@ -29,8 +29,8 @@ class PSDPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "psd.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "psd.json")
public: public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE; Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE; QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
}; };
#endif // KIMG_PSD_H #endif // KIMG_PSD_H

View File

@ -12,7 +12,7 @@
#include "ras_p.h" #include "ras_p.h"
#include <QImage> #include <QImage>
#include <QtCore/QDataStream> #include <QDataStream>
// #include <QDebug> // #include <QDebug>
namespace // Private. namespace // Private.

View File

@ -18,8 +18,8 @@ class RASHandler : public QImageIOHandler
public: public:
RASHandler(); RASHandler();
bool canRead() const Q_DECL_OVERRIDE; bool canRead() const override;
bool read(QImage *image) Q_DECL_OVERRIDE; bool read(QImage *image) override;
static bool canRead(QIODevice *device); static bool canRead(QIODevice *device);
}; };
@ -30,8 +30,8 @@ class RASPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "ras.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "ras.json")
public: public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE; Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE; QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
}; };
#endif // KIMG_RAS_H #endif // KIMG_RAS_H

View File

@ -23,8 +23,8 @@
#include "rgb_p.h" #include "rgb_p.h"
#include <QtCore/QMap> #include <QMap>
#include <QtCore/QVector> #include <QVector>
#include <QImage> #include <QImage>
// #include <QDebug> // #include <QDebug>
@ -686,8 +686,8 @@ bool RGBHandler::canRead(QIODevice *device)
return false; return false;
} }
qint64 oldPos = device->pos(); const qint64 oldPos = device->pos();
QByteArray head = device->readLine(64); const QByteArray head = device->readLine(64);
int readBytes = head.size(); int readBytes = head.size();
if (device->isSequential()) { if (device->isSequential()) {
@ -699,10 +699,7 @@ bool RGBHandler::canRead(QIODevice *device)
device->seek(oldPos); device->seek(oldPos);
} }
const QRegExp regexp(QLatin1String("^\x01\xda\x01[\x01\x02]")); return head.size() >= 4 && head.startsWith("\x01\xda\x01") && (head[3] == 1 || head[3] == 2);
QString data(QString::fromLocal8Bit(head));
return data.contains(regexp);
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -17,9 +17,9 @@ class RGBHandler : public QImageIOHandler
public: public:
RGBHandler(); RGBHandler();
bool canRead() const Q_DECL_OVERRIDE; bool canRead() const override;
bool read(QImage *image) Q_DECL_OVERRIDE; bool read(QImage *image) override;
bool write(const QImage &image) Q_DECL_OVERRIDE; bool write(const QImage &image) override;
static bool canRead(QIODevice *device); static bool canRead(QIODevice *device);
}; };
@ -30,8 +30,8 @@ class RGBPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "rgb.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "rgb.json")
public: public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE; Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE; QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
}; };
#endif // KIMG_RGB_H #endif // KIMG_RGB_H

View File

@ -23,7 +23,7 @@
#include <assert.h> #include <assert.h>
#include <QImage> #include <QImage>
#include <QtCore/QDataStream> #include <QDataStream>
// #include <QDebug> // #include <QDebug>
typedef quint32 uint; typedef quint32 uint;
@ -145,9 +145,7 @@ struct TgaHeaderInfo {
switch (tga.image_type) { switch (tga.image_type) {
case TGA_TYPE_RLE_INDEXED: case TGA_TYPE_RLE_INDEXED:
rle = true; rle = true;
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
// no break is intended! // no break is intended!
case TGA_TYPE_INDEXED: case TGA_TYPE_INDEXED:
pal = true; pal = true;
@ -155,9 +153,7 @@ struct TgaHeaderInfo {
case TGA_TYPE_RLE_RGB: case TGA_TYPE_RLE_RGB:
rle = true; rle = true;
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
// no break is intended! // no break is intended!
case TGA_TYPE_RGB: case TGA_TYPE_RGB:
rgb = true; rgb = true;
@ -165,9 +161,7 @@ struct TgaHeaderInfo {
case TGA_TYPE_RLE_GREY: case TGA_TYPE_RLE_GREY:
rle = true; rle = true;
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
// no break is intended! // no break is intended!
case TGA_TYPE_GREY: case TGA_TYPE_GREY:
grey = true; grey = true;

View File

@ -17,9 +17,9 @@ class TGAHandler : public QImageIOHandler
public: public:
TGAHandler(); TGAHandler();
bool canRead() const Q_DECL_OVERRIDE; bool canRead() const override;
bool read(QImage *image) Q_DECL_OVERRIDE; bool read(QImage *image) override;
bool write(const QImage &image) Q_DECL_OVERRIDE; bool write(const QImage &image) override;
static bool canRead(QIODevice *device); static bool canRead(QIODevice *device);
}; };
@ -30,8 +30,8 @@ class TGAPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "tga.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "tga.json")
public: public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE; Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE; QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
}; };
#endif // KIMG_TGA_H #endif // KIMG_TGA_H

View File

@ -24,9 +24,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <QImage> #include <QImage>
#include <QPainter> #include <QPainter>
#include <QtCore/QIODevice> #include <QIODevice>
#include <QtCore/QStack> #include <QStack>
#include <QtCore/QVector> #include <QVector>
// #include <QDebug> // #include <QDebug>
#include "gimp_p.h" #include "gimp_p.h"
@ -713,7 +713,8 @@ bool XCFImageFormat::composeTiles(XCFImage &xcf_image)
// SANITY CHECK: Catch corrupted XCF image file where the width or height // SANITY CHECK: Catch corrupted XCF image file where the width or height
// of a tile is reported are bogus. See Bug# 234030. // of a tile is reported are bogus. See Bug# 234030.
if (layer.width > 32767 || layer.height > 32767 || layer.width * layer.height > 16384 * 16384) { if (layer.width > 32767 || layer.height > 32767
|| (sizeof(void *) == 4 && layer.width * layer.height > 16384 * 16384)) {
return false; return false;
} }
@ -1323,9 +1324,7 @@ bool XCFImageFormat::initializeImage(XCFImage &xcf_image)
image.fill(qRgb(255, 255, 255)); image.fill(qRgb(255, 255, 255));
break; break;
} // else, fall through to 32-bit representation } // else, fall through to 32-bit representation
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
case RGBA_GIMAGE: case RGBA_GIMAGE:
image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32); image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32);
if (image.isNull()) { if (image.isNull()) {
@ -1345,9 +1344,7 @@ bool XCFImageFormat::initializeImage(XCFImage &xcf_image)
image.fill(255); image.fill(255);
break; break;
} // else, fall through to 32-bit representation } // else, fall through to 32-bit representation
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
Q_FALLTHROUGH(); Q_FALLTHROUGH();
#endif
case GRAYA_GIMAGE: case GRAYA_GIMAGE:
image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32); image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32);
if (image.isNull()) { if (image.isNull()) {

View File

@ -29,9 +29,9 @@ class XCFHandler : public QImageIOHandler
public: public:
XCFHandler(); XCFHandler();
bool canRead() const Q_DECL_OVERRIDE; bool canRead() const override;
bool read(QImage *image) Q_DECL_OVERRIDE; bool read(QImage *image) override;
bool write(const QImage &image) Q_DECL_OVERRIDE; bool write(const QImage &image) override;
static bool canRead(QIODevice *device); static bool canRead(QIODevice *device);
}; };
@ -42,8 +42,8 @@ class XCFPlugin : public QImageIOPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "xcf.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "xcf.json")
public: public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE; Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE; QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
}; };
#endif // KIMG_XCF_H #endif // KIMG_XCF_H