Compare commits

...

11 Commits

12 changed files with 46 additions and 33 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.30.0 NO_MODULE) find_package(ECM 5.37.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.5.0) set(REQUIRED_QT_VERSION 5.7.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

@ -337,10 +337,10 @@ QImageIOPlugin::Capabilities EPSPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead | CanWrite); return Capabilities(CanRead | CanWrite);
} }
if (!format.isEmpty()) { if (!format.isEmpty()) {
return 0; return nullptr;
} }
if (!device->isOpen()) { if (!device->isOpen()) {
return 0; return nullptr;
} }
Capabilities cap; Capabilities cap;

View File

@ -218,10 +218,10 @@ QImageIOPlugin::Capabilities EXRPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead); return Capabilities(CanRead);
} }
if (!format.isEmpty()) { if (!format.isEmpty()) {
return 0; return nullptr;
} }
if (!device->isOpen()) { if (!device->isOpen()) {
return 0; return nullptr;
} }
Capabilities cap; Capabilities cap;

View File

@ -66,10 +66,10 @@ QImageIOPlugin::Capabilities KraPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead); return Capabilities(CanRead);
} }
if (!format.isEmpty()) { if (!format.isEmpty()) {
return 0; return nullptr;
} }
if (!device->isOpen()) { if (!device->isOpen()) {
return 0; return nullptr;
} }
Capabilities cap; Capabilities cap;

View File

@ -65,10 +65,10 @@ QImageIOPlugin::Capabilities OraPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead); return Capabilities(CanRead);
} }
if (!format.isEmpty()) { if (!format.isEmpty()) {
return 0; return nullptr;
} }
if (!device->isOpen()) { if (!device->isOpen()) {
return 0; return nullptr;
} }
Capabilities cap; Capabilities cap;

View File

@ -667,10 +667,10 @@ QImageIOPlugin::Capabilities PCXPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead | CanWrite); return Capabilities(CanRead | CanWrite);
} }
if (!format.isEmpty()) { if (!format.isEmpty()) {
return 0; return nullptr;
} }
if (!device->isOpen()) { if (!device->isOpen()) {
return 0; return nullptr;
} }
Capabilities cap; Capabilities cap;

View File

@ -449,10 +449,10 @@ QImageIOPlugin::Capabilities SoftimagePICPlugin::capabilities(QIODevice *device,
return Capabilities(CanRead | CanWrite); return Capabilities(CanRead | CanWrite);
} }
if (!format.isEmpty()) { if (!format.isEmpty()) {
return 0; return nullptr;
} }
if (!device->isOpen()) { if (!device->isOpen()) {
return 0; return nullptr;
} }
Capabilities cap; Capabilities cap;

View File

@ -300,10 +300,10 @@ QImageIOPlugin::Capabilities PSDPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead); return Capabilities(CanRead);
} }
if (!format.isEmpty()) { if (!format.isEmpty()) {
return 0; return nullptr;
} }
if (!device->isOpen()) { if (!device->isOpen()) {
return 0; return nullptr;
} }
Capabilities cap; Capabilities cap;

View File

@ -282,10 +282,10 @@ QImageIOPlugin::Capabilities RASPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead); return Capabilities(CanRead);
} }
if (!format.isEmpty()) { if (!format.isEmpty()) {
return 0; return nullptr;
} }
if (!device->isOpen()) { if (!device->isOpen()) {
return 0; return nullptr;
} }
Capabilities cap; Capabilities cap;

View File

@ -111,8 +111,8 @@ private:
}; };
SGIImage::SGIImage(QIODevice *io) : SGIImage::SGIImage(QIODevice *io) :
_starttab(0), _starttab(nullptr),
_lengthtab(0) _lengthtab(nullptr)
{ {
_dev = io; _dev = io;
_stream.setDevice(_dev); _stream.setDevice(_dev);
@ -714,10 +714,10 @@ QImageIOPlugin::Capabilities RGBPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead | CanWrite); return Capabilities(CanRead | CanWrite);
} }
if (!format.isEmpty()) { if (!format.isEmpty()) {
return 0; return nullptr;
} }
if (!device->isOpen()) { if (!device->isOpen()) {
return 0; return nullptr;
} }
Capabilities cap; Capabilities cap;

View File

@ -145,6 +145,9 @@ 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();
#endif
// no break is intended! // no break is intended!
case TGA_TYPE_INDEXED: case TGA_TYPE_INDEXED:
pal = true; pal = true;
@ -152,6 +155,9 @@ 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();
#endif
// no break is intended! // no break is intended!
case TGA_TYPE_RGB: case TGA_TYPE_RGB:
rgb = true; rgb = true;
@ -159,6 +165,9 @@ 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();
#endif
// no break is intended! // no break is intended!
case TGA_TYPE_GREY: case TGA_TYPE_GREY:
grey = true; grey = true;
@ -414,10 +423,10 @@ QImageIOPlugin::Capabilities TGAPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead | CanWrite); return Capabilities(CanRead | CanWrite);
} }
if (!format.isEmpty()) { if (!format.isEmpty()) {
return 0; return nullptr;
} }
if (!device->isOpen()) { if (!device->isOpen()) {
return 0; return nullptr;
} }
Capabilities cap; Capabilities cap;

View File

@ -107,7 +107,7 @@ private:
//! copied in different ways. //! copied in different ways.
void (*assignBytes)(Layer &layer, uint i, uint j); void (*assignBytes)(Layer &layer, uint i, uint j);
Layer(void) : name(0) {} Layer(void) : name(nullptr) {}
~Layer(void) ~Layer(void)
{ {
delete[] name; delete[] name;
@ -416,7 +416,7 @@ bool XCFImageFormat::loadImageProperties(QDataStream &xcf_io, XCFImage &xcf_imag
property.readBytes(tag, size); property.readBytes(tag, size);
quint32 flags; quint32 flags;
char *data = 0; char *data = nullptr;
property >> flags >> data; property >> flags >> data;
if (tag && strncmp(tag, "gimp-comment", strlen("gimp-comment")) == 0) { if (tag && strncmp(tag, "gimp-comment", strlen("gimp-comment")) == 0) {
@ -474,7 +474,7 @@ bool XCFImageFormat::loadProperty(QDataStream &xcf_io, PropType &type, QByteArra
xcf_io >> foo; xcf_io >> foo;
type = PropType(foo); // TODO urks type = PropType(foo); // TODO urks
char *data = 0; char *data = nullptr;
quint32 size; quint32 size;
// The colormap property size is not the correct number of bytes: // The colormap property size is not the correct number of bytes:
@ -1323,7 +1323,9 @@ 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();
#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()) {
@ -1343,7 +1345,9 @@ 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();
#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()) {
@ -1442,7 +1446,7 @@ void XCFImageFormat::copyLayerToImage(XCFImage &xcf_image)
{ {
Layer &layer(xcf_image.layer); Layer &layer(xcf_image.layer);
QImage &image(xcf_image.image); QImage &image(xcf_image.image);
PixelCopyOperation copy = 0; PixelCopyOperation copy = nullptr;
switch (layer.type) { switch (layer.type) {
case RGB_GIMAGE: case RGB_GIMAGE:
@ -1725,7 +1729,7 @@ void XCFImageFormat::mergeLayerIntoImage(XCFImage &xcf_image)
Layer &layer(xcf_image.layer); Layer &layer(xcf_image.layer);
QImage &image(xcf_image.image); QImage &image(xcf_image.image);
PixelMergeOperation merge = 0; PixelMergeOperation merge = nullptr;
if (!layer.opacity) { if (!layer.opacity) {
return; // don't bother doing anything return; // don't bother doing anything
@ -2686,10 +2690,10 @@ QImageIOPlugin::Capabilities XCFPlugin::capabilities(QIODevice *device, const QB
return Capabilities(CanRead); return Capabilities(CanRead);
} }
if (!format.isEmpty()) { if (!format.isEmpty()) {
return 0; return nullptr;
} }
if (!device->isOpen()) { if (!device->isOpen()) {
return 0; return nullptr;
} }
Capabilities cap; Capabilities cap;