mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-07-15 11:14:18 -04:00
Compare commits
24 Commits
v5.41.0-rc
...
v5.51.0
Author | SHA1 | Date | |
---|---|---|---|
4c0c6c8d60 | |||
f485719012 | |||
1db1b94657 | |||
98c65a438d | |||
167967a145 | |||
17239a7ea6 | |||
118d262bec | |||
67a84f459d | |||
de2b942b33 | |||
813a7bdddb | |||
a4d1f4db1d | |||
29d090f078 | |||
19f33239e7 | |||
4668fbbcdc | |||
698ba297d3 | |||
3a9bafdbbe | |||
e5b226e804 | |||
871d0f976f | |||
7aa5333a3f | |||
aeabd92eea | |||
64e719f329 | |||
eef855b146 | |||
04e2ee01cb | |||
7f2c44add4 |
@ -1,5 +0,0 @@
|
||||
REVIEWBOARD_URL = "https://git.reviewboard.kde.org"
|
||||
REPOSITORY = 'git://anongit.kde.org/kimageformats'
|
||||
BRANCH = 'master'
|
||||
TARGET_GROUPS = 'kdeframeworks'
|
||||
TARGET_PEOPLE = 'alexmerry'
|
@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.0)
|
||||
project(KImageFormats)
|
||||
|
||||
include(FeatureSummary)
|
||||
find_package(ECM 5.41.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")
|
||||
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
@ -17,7 +17,7 @@ include(KDECMakeSettings)
|
||||
|
||||
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(KF5Archive)
|
||||
|
@ -2,107 +2,100 @@
|
||||
|
||||
##################################
|
||||
|
||||
function(kimageformats_add_plugin plugin)
|
||||
set(options)
|
||||
set(oneValueArgs JSON)
|
||||
set(multiValueArgs SOURCES)
|
||||
cmake_parse_arguments(KIF_ADD_PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if(NOT KIF_ADD_PLUGIN_SOURCES)
|
||||
message(FATAL_ERROR "kimageformats_add_plugin called without SOURCES parameter")
|
||||
endif()
|
||||
get_filename_component(json "${KIF_ADD_PLUGIN_JSON}" REALPATH)
|
||||
if(NOT KIF_ADD_PLUGIN_JSON OR NOT EXISTS ${json})
|
||||
message(FATAL_ERROR "JSON file doesn't exist: ${json}")
|
||||
endif()
|
||||
|
||||
add_library(${plugin} MODULE ${KIF_ADD_PLUGIN_SOURCES})
|
||||
set_property(TARGET ${plugin} APPEND PROPERTY AUTOGEN_TARGET_DEPENDS ${json})
|
||||
set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/imageformats")
|
||||
target_link_libraries(${plugin} Qt5::Gui)
|
||||
install(TARGETS ${plugin} DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats)
|
||||
endfunction()
|
||||
|
||||
##################################
|
||||
|
||||
install(FILES dds-qt.desktop RENAME dds.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
|
||||
##################################
|
||||
|
||||
if (BUILD_EPS_PLUGIN)
|
||||
if (Qt5PrintSupport_FOUND)
|
||||
add_library(kimg_eps MODULE eps.cpp)
|
||||
target_link_libraries(kimg_eps Qt5::Gui Qt5::PrintSupport)
|
||||
|
||||
install(TARGETS kimg_eps DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
|
||||
kimageformats_add_plugin(kimg_eps JSON "eps.json" SOURCES eps.cpp)
|
||||
target_link_libraries(kimg_eps Qt5::PrintSupport)
|
||||
install(FILES eps.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
|
||||
# need this for Qt's version of the plugin
|
||||
install(FILES jp2.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
|
||||
##################################
|
||||
|
||||
if(OpenEXR_FOUND)
|
||||
add_library(kimg_exr MODULE exr.cpp)
|
||||
target_link_libraries(kimg_exr Qt5::Gui OpenEXR::IlmImf)
|
||||
kimageformats_add_plugin(kimg_exr JSON "exr.json" SOURCES exr.cpp)
|
||||
target_link_libraries(kimg_exr OpenEXR::IlmImf)
|
||||
kde_target_enable_exceptions(kimg_exr PRIVATE)
|
||||
|
||||
install(TARGETS kimg_exr DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
|
||||
install(FILES exr.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
add_library(kimg_pcx MODULE pcx.cpp)
|
||||
target_link_libraries(kimg_pcx Qt5::Gui)
|
||||
|
||||
install(TARGETS kimg_pcx DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
|
||||
kimageformats_add_plugin(kimg_pcx JSON "pcx.json" SOURCES pcx.cpp)
|
||||
install(FILES pcx.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
|
||||
##################################
|
||||
|
||||
add_library(kimg_pic MODULE pic.cpp)
|
||||
target_link_libraries(kimg_pic Qt5::Gui)
|
||||
|
||||
install(TARGETS kimg_pic DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
|
||||
kimageformats_add_plugin(kimg_pic JSON "pic.json" SOURCES pic.cpp)
|
||||
install(FILES pic.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
|
||||
##################################
|
||||
|
||||
add_library(kimg_psd MODULE psd.cpp)
|
||||
target_link_libraries(kimg_psd Qt5::Gui)
|
||||
|
||||
install(TARGETS kimg_psd DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
|
||||
kimageformats_add_plugin(kimg_psd JSON "psd.json" SOURCES psd.cpp)
|
||||
install(FILES psd.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
|
||||
##################################
|
||||
|
||||
add_library(kimg_ras MODULE ras.cpp)
|
||||
target_link_libraries(kimg_ras Qt5::Gui)
|
||||
|
||||
install(TARGETS kimg_ras DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
|
||||
kimageformats_add_plugin(kimg_ras JSON "ras.json" SOURCES ras.cpp)
|
||||
install(FILES ras.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
|
||||
##################################
|
||||
|
||||
add_library(kimg_rgb MODULE rgb.cpp)
|
||||
target_link_libraries(kimg_rgb Qt5::Gui)
|
||||
|
||||
install(TARGETS kimg_rgb DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
|
||||
kimageformats_add_plugin(kimg_rgb JSON "rgb.json" SOURCES rgb.cpp)
|
||||
install(FILES rgb.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
|
||||
##################################
|
||||
|
||||
add_library(kimg_tga MODULE tga.cpp)
|
||||
target_link_libraries(kimg_tga Qt5::Gui)
|
||||
|
||||
install(TARGETS kimg_tga DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
|
||||
kimageformats_add_plugin(kimg_tga JSON "tga.json" SOURCES tga.cpp)
|
||||
install(FILES tga.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
|
||||
##################################
|
||||
|
||||
add_library(kimg_xcf MODULE xcf.cpp)
|
||||
target_link_libraries(kimg_xcf Qt5::Gui)
|
||||
|
||||
install(TARGETS kimg_xcf DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
|
||||
kimageformats_add_plugin(kimg_xcf JSON "xcf.json" SOURCES xcf.cpp)
|
||||
install(FILES xcf.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
|
||||
##################################
|
||||
|
||||
if (KF5Archive_FOUND)
|
||||
|
||||
add_library(kimg_kra MODULE kra.cpp)
|
||||
target_link_libraries(kimg_kra Qt5::Gui KF5::Archive)
|
||||
|
||||
install(TARGETS kimg_kra DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
|
||||
kimageformats_add_plugin(kimg_kra JSON "kra.json" SOURCES kra.cpp)
|
||||
target_link_libraries(kimg_kra KF5::Archive)
|
||||
install(FILES kra.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
|
||||
add_library(kimg_ora MODULE ora.cpp)
|
||||
target_link_libraries(kimg_ora Qt5::Gui KF5::Archive)
|
||||
|
||||
install(TARGETS kimg_ora DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
|
||||
kimageformats_add_plugin(kimg_ora JSON "ora.json" SOURCES ora.cpp)
|
||||
target_link_libraries(kimg_ora KF5::Archive)
|
||||
install(FILES ora.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
|
||||
|
||||
endif()
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <QPrinter>
|
||||
#include <QProcess>
|
||||
#include <QTemporaryFile>
|
||||
#include <QCoreApplication>
|
||||
|
||||
// logging category for this framework, default: log stuff >= warning
|
||||
Q_LOGGING_CATEGORY(EPSPLUGIN, "epsplugin", QtWarningMsg)
|
||||
@ -156,7 +157,7 @@ bool EPSHandler::read(QImage *image)
|
||||
|
||||
QTemporaryFile tmpFile;
|
||||
if (!tmpFile.open()) {
|
||||
qWarning() << "Could not create the temporary file" << tmpFile.fileName();
|
||||
qCWarning(EPSPLUGIN) << "Could not create the temporary file" << tmpFile.fileName();
|
||||
return false;
|
||||
}
|
||||
qCDebug(EPSPLUGIN) << "temporary file:" << tmpFile.fileName();
|
||||
@ -198,7 +199,7 @@ bool EPSHandler::read(QImage *image)
|
||||
converter.setProcessChannelMode(QProcess::ForwardedErrorChannel);
|
||||
converter.start(QStringLiteral("gs"), gsArgs);
|
||||
if (!converter.waitForStarted(3000)) {
|
||||
qWarning() << "Reading EPS files requires gs (from GhostScript)";
|
||||
qCWarning(EPSPLUGIN) << "Reading EPS files requires gs (from GhostScript)";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -297,7 +298,7 @@ bool EPSHandler::write(const QImage &image)
|
||||
converter.start(QStringLiteral("gs"), gsArgs);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -312,7 +313,7 @@ bool EPSHandler::write(const QImage &image)
|
||||
bool EPSHandler::canRead(QIODevice *device)
|
||||
{
|
||||
if (!device) {
|
||||
qWarning("EPSHandler::canRead() called with no device");
|
||||
qCWarning(EPSPLUGIN) << "EPSHandler::canRead() called with no device";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -333,14 +334,23 @@ bool EPSHandler::canRead(QIODevice *device)
|
||||
|
||||
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") {
|
||||
return Capabilities(CanRead | CanWrite);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
|
@ -15,9 +15,9 @@ class EPSHandler : public QImageIOHandler
|
||||
public:
|
||||
EPSHandler();
|
||||
|
||||
bool canRead() const Q_DECL_OVERRIDE;
|
||||
bool read(QImage *image) Q_DECL_OVERRIDE;
|
||||
bool write(const QImage &image) Q_DECL_OVERRIDE;
|
||||
bool canRead() const override;
|
||||
bool read(QImage *image) override;
|
||||
bool write(const QImage &image) override;
|
||||
|
||||
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")
|
||||
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(EPSPLUGIN)
|
||||
|
@ -41,10 +41,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
bool read(char c[], int n) Q_DECL_OVERRIDE;
|
||||
Imf::Int64 tellg() Q_DECL_OVERRIDE;
|
||||
void seekg(Imf::Int64 pos) Q_DECL_OVERRIDE;
|
||||
void clear() Q_DECL_OVERRIDE;
|
||||
bool read(char c[], int n) override;
|
||||
Imf::Int64 tellg() override;
|
||||
void seekg(Imf::Int64 pos) override;
|
||||
void clear() override;
|
||||
|
||||
private:
|
||||
QIODevice *m_dev;
|
||||
@ -218,10 +218,10 @@ QImageIOPlugin::Capabilities EXRPlugin::capabilities(QIODevice *device, const QB
|
||||
return Capabilities(CanRead);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
|
@ -18,8 +18,8 @@ class EXRHandler : public QImageIOHandler
|
||||
public:
|
||||
EXRHandler();
|
||||
|
||||
bool canRead() const Q_DECL_OVERRIDE;
|
||||
bool read(QImage *outImage) Q_DECL_OVERRIDE;
|
||||
bool canRead() const override;
|
||||
bool read(QImage *outImage) override;
|
||||
|
||||
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")
|
||||
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
#endif // KIMG_EXR_H
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "hdr_p.h"
|
||||
|
||||
#include <QImage>
|
||||
#include <QtCore/QDataStream>
|
||||
#include <QDataStream>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
@ -66,10 +66,10 @@ QImageIOPlugin::Capabilities KraPlugin::capabilities(QIODevice *device, const QB
|
||||
return Capabilities(CanRead);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
|
@ -17,8 +17,8 @@ class KraHandler : public QImageIOHandler
|
||||
public:
|
||||
KraHandler();
|
||||
|
||||
bool canRead() const Q_DECL_OVERRIDE;
|
||||
bool read(QImage *image) Q_DECL_OVERRIDE;
|
||||
bool canRead() const override;
|
||||
bool read(QImage *image) override;
|
||||
|
||||
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")
|
||||
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
{
|
||||
"Keys": [ "kra" ],
|
||||
"MimeTypes": [ "application/x-krita", "application/x-krita" ]
|
||||
"MimeTypes": [ "application/x-krita" ]
|
||||
}
|
||||
|
||||
|
@ -65,10 +65,10 @@ QImageIOPlugin::Capabilities OraPlugin::capabilities(QIODevice *device, const QB
|
||||
return Capabilities(CanRead);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
|
@ -17,8 +17,8 @@ class OraHandler : public QImageIOHandler
|
||||
public:
|
||||
OraHandler();
|
||||
|
||||
bool canRead() const Q_DECL_OVERRIDE;
|
||||
bool read(QImage *image) Q_DECL_OVERRIDE;
|
||||
bool canRead() const override;
|
||||
bool read(QImage *image) override;
|
||||
|
||||
static bool canRead(QIODevice *device);
|
||||
};
|
||||
@ -29,8 +29,8 @@ class OraPlugin : public QImageIOPlugin
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "ora.json")
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
{
|
||||
"Keys": [ "ora" ],
|
||||
"MimeTypes": [ "image/openraster", "image/openraster" ]
|
||||
"MimeTypes": [ "image/openraster" ]
|
||||
}
|
||||
|
||||
|
@ -667,10 +667,10 @@ QImageIOPlugin::Capabilities PCXPlugin::capabilities(QIODevice *device, const QB
|
||||
return Capabilities(CanRead | CanWrite);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
|
@ -17,9 +17,9 @@ class PCXHandler : public QImageIOHandler
|
||||
public:
|
||||
PCXHandler();
|
||||
|
||||
bool canRead() const Q_DECL_OVERRIDE;
|
||||
bool read(QImage *image) Q_DECL_OVERRIDE;
|
||||
bool write(const QImage &image) Q_DECL_OVERRIDE;
|
||||
bool canRead() const override;
|
||||
bool read(QImage *image) override;
|
||||
bool write(const QImage &image) override;
|
||||
|
||||
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")
|
||||
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
#endif // KIMG_PCX_H
|
||||
|
@ -449,10 +449,10 @@ QImageIOPlugin::Capabilities SoftimagePICPlugin::capabilities(QIODevice *device,
|
||||
return Capabilities(CanRead | CanWrite);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
|
@ -154,13 +154,13 @@ struct PicChannel {
|
||||
class SoftimagePICHandler : public QImageIOHandler
|
||||
{
|
||||
public:
|
||||
bool canRead() const Q_DECL_OVERRIDE;
|
||||
bool read(QImage *image) Q_DECL_OVERRIDE;
|
||||
bool write(const QImage &) Q_DECL_OVERRIDE;
|
||||
bool canRead() const override;
|
||||
bool read(QImage *image) override;
|
||||
bool write(const QImage &) override;
|
||||
|
||||
QVariant option(ImageOption option) const Q_DECL_OVERRIDE;
|
||||
void setOption(ImageOption option, const QVariant &value) Q_DECL_OVERRIDE;
|
||||
bool supportsOption(ImageOption option) const Q_DECL_OVERRIDE;
|
||||
QVariant option(ImageOption option) const override;
|
||||
void setOption(ImageOption option, const QVariant &value) override;
|
||||
bool supportsOption(ImageOption option) const override;
|
||||
|
||||
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")
|
||||
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
#endif // KIMG_PIC_H
|
||||
|
@ -300,10 +300,10 @@ QImageIOPlugin::Capabilities PSDPlugin::capabilities(QIODevice *device, const QB
|
||||
return Capabilities(CanRead);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
|
@ -17,8 +17,8 @@ class PSDHandler : public QImageIOHandler
|
||||
public:
|
||||
PSDHandler();
|
||||
|
||||
bool canRead() const Q_DECL_OVERRIDE;
|
||||
bool read(QImage *image) Q_DECL_OVERRIDE;
|
||||
bool canRead() const override;
|
||||
bool read(QImage *image) override;
|
||||
|
||||
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")
|
||||
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
#endif // KIMG_PSD_H
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "ras_p.h"
|
||||
|
||||
#include <QImage>
|
||||
#include <QtCore/QDataStream>
|
||||
#include <QDataStream>
|
||||
// #include <QDebug>
|
||||
|
||||
namespace // Private.
|
||||
@ -282,10 +282,10 @@ QImageIOPlugin::Capabilities RASPlugin::capabilities(QIODevice *device, const QB
|
||||
return Capabilities(CanRead);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
|
@ -18,8 +18,8 @@ class RASHandler : public QImageIOHandler
|
||||
public:
|
||||
RASHandler();
|
||||
|
||||
bool canRead() const Q_DECL_OVERRIDE;
|
||||
bool read(QImage *image) Q_DECL_OVERRIDE;
|
||||
bool canRead() const override;
|
||||
bool read(QImage *image) override;
|
||||
|
||||
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")
|
||||
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
#endif // KIMG_RAS_H
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
#include "rgb_p.h"
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QVector>
|
||||
#include <QMap>
|
||||
#include <QVector>
|
||||
|
||||
#include <QImage>
|
||||
// #include <QDebug>
|
||||
@ -686,8 +686,8 @@ bool RGBHandler::canRead(QIODevice *device)
|
||||
return false;
|
||||
}
|
||||
|
||||
qint64 oldPos = device->pos();
|
||||
QByteArray head = device->readLine(64);
|
||||
const qint64 oldPos = device->pos();
|
||||
const QByteArray head = device->readLine(64);
|
||||
int readBytes = head.size();
|
||||
|
||||
if (device->isSequential()) {
|
||||
@ -699,10 +699,7 @@ bool RGBHandler::canRead(QIODevice *device)
|
||||
device->seek(oldPos);
|
||||
}
|
||||
|
||||
const QRegExp regexp(QLatin1String("^\x01\xda\x01[\x01\x02]"));
|
||||
QString data(QString::fromLocal8Bit(head));
|
||||
|
||||
return data.contains(regexp);
|
||||
return head.size() >= 4 && head.startsWith("\x01\xda\x01") && (head[3] == 1 || head[3] == 2);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -714,10 +711,10 @@ QImageIOPlugin::Capabilities RGBPlugin::capabilities(QIODevice *device, const QB
|
||||
return Capabilities(CanRead | CanWrite);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
|
@ -17,9 +17,9 @@ class RGBHandler : public QImageIOHandler
|
||||
public:
|
||||
RGBHandler();
|
||||
|
||||
bool canRead() const Q_DECL_OVERRIDE;
|
||||
bool read(QImage *image) Q_DECL_OVERRIDE;
|
||||
bool write(const QImage &image) Q_DECL_OVERRIDE;
|
||||
bool canRead() const override;
|
||||
bool read(QImage *image) override;
|
||||
bool write(const QImage &image) override;
|
||||
|
||||
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")
|
||||
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
#endif // KIMG_RGB_H
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include <QImage>
|
||||
#include <QtCore/QDataStream>
|
||||
#include <QDataStream>
|
||||
// #include <QDebug>
|
||||
|
||||
typedef quint32 uint;
|
||||
@ -145,9 +145,7 @@ struct TgaHeaderInfo {
|
||||
switch (tga.image_type) {
|
||||
case TGA_TYPE_RLE_INDEXED:
|
||||
rle = true;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
|
||||
Q_FALLTHROUGH();
|
||||
#endif
|
||||
// no break is intended!
|
||||
case TGA_TYPE_INDEXED:
|
||||
pal = true;
|
||||
@ -155,9 +153,7 @@ struct TgaHeaderInfo {
|
||||
|
||||
case TGA_TYPE_RLE_RGB:
|
||||
rle = true;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
|
||||
Q_FALLTHROUGH();
|
||||
#endif
|
||||
// no break is intended!
|
||||
case TGA_TYPE_RGB:
|
||||
rgb = true;
|
||||
@ -165,9 +161,7 @@ struct TgaHeaderInfo {
|
||||
|
||||
case TGA_TYPE_RLE_GREY:
|
||||
rle = true;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
|
||||
Q_FALLTHROUGH();
|
||||
#endif
|
||||
// no break is intended!
|
||||
case TGA_TYPE_GREY:
|
||||
grey = true;
|
||||
@ -423,10 +417,10 @@ QImageIOPlugin::Capabilities TGAPlugin::capabilities(QIODevice *device, const QB
|
||||
return Capabilities(CanRead | CanWrite);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
|
@ -17,9 +17,9 @@ class TGAHandler : public QImageIOHandler
|
||||
public:
|
||||
TGAHandler();
|
||||
|
||||
bool canRead() const Q_DECL_OVERRIDE;
|
||||
bool read(QImage *image) Q_DECL_OVERRIDE;
|
||||
bool write(const QImage &image) Q_DECL_OVERRIDE;
|
||||
bool canRead() const override;
|
||||
bool read(QImage *image) override;
|
||||
bool write(const QImage &image) override;
|
||||
|
||||
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")
|
||||
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
#endif // KIMG_TGA_H
|
||||
|
@ -24,9 +24,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <QImage>
|
||||
#include <QPainter>
|
||||
#include <QtCore/QIODevice>
|
||||
#include <QtCore/QStack>
|
||||
#include <QtCore/QVector>
|
||||
#include <QIODevice>
|
||||
#include <QStack>
|
||||
#include <QVector>
|
||||
// #include <QDebug>
|
||||
|
||||
#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
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -1323,9 +1324,7 @@ bool XCFImageFormat::initializeImage(XCFImage &xcf_image)
|
||||
image.fill(qRgb(255, 255, 255));
|
||||
break;
|
||||
} // else, fall through to 32-bit representation
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
|
||||
Q_FALLTHROUGH();
|
||||
#endif
|
||||
case RGBA_GIMAGE:
|
||||
image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32);
|
||||
if (image.isNull()) {
|
||||
@ -1345,9 +1344,7 @@ bool XCFImageFormat::initializeImage(XCFImage &xcf_image)
|
||||
image.fill(255);
|
||||
break;
|
||||
} // else, fall through to 32-bit representation
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
|
||||
Q_FALLTHROUGH();
|
||||
#endif
|
||||
case GRAYA_GIMAGE:
|
||||
image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32);
|
||||
if (image.isNull()) {
|
||||
@ -2690,10 +2687,10 @@ QImageIOPlugin::Capabilities XCFPlugin::capabilities(QIODevice *device, const QB
|
||||
return Capabilities(CanRead);
|
||||
}
|
||||
if (!format.isEmpty()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
if (!device->isOpen()) {
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
Capabilities cap;
|
||||
|
@ -29,9 +29,9 @@ class XCFHandler : public QImageIOHandler
|
||||
public:
|
||||
XCFHandler();
|
||||
|
||||
bool canRead() const Q_DECL_OVERRIDE;
|
||||
bool read(QImage *image) Q_DECL_OVERRIDE;
|
||||
bool write(const QImage &image) Q_DECL_OVERRIDE;
|
||||
bool canRead() const override;
|
||||
bool read(QImage *image) override;
|
||||
bool write(const QImage &image) override;
|
||||
|
||||
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")
|
||||
|
||||
public:
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
|
||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
|
||||
};
|
||||
|
||||
#endif // KIMG_XCF_H
|
||||
|
Reference in New Issue
Block a user