/src/qtbase/src/plugins/imageformats/gif/main.cpp
Line | Count | Source |
1 | | // Copyright (C) 2016 The Qt Company Ltd. |
2 | | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | | // Qt-Security score:significant reason:default |
4 | | |
5 | | #include <qimageiohandler.h> |
6 | | #include <qstringlist.h> |
7 | | |
8 | | #ifdef QT_NO_IMAGEFORMAT_GIF |
9 | | #undef QT_NO_IMAGEFORMAT_GIF |
10 | | #endif |
11 | | #include <qgifhandler_p.h> |
12 | | |
13 | | QT_BEGIN_NAMESPACE |
14 | | |
15 | | class QGifPlugin : public QImageIOPlugin |
16 | | { |
17 | 0 | Q_OBJECT |
18 | 0 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "gif.json") |
19 | 0 | public: |
20 | 0 | QGifPlugin(); |
21 | 0 | ~QGifPlugin(); |
22 | 0 |
|
23 | 0 | Capabilities capabilities(QIODevice *device, const QByteArray &format) const override; |
24 | 0 | QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override; |
25 | 0 | }; |
26 | 0 |
|
27 | 0 | QGifPlugin::QGifPlugin() |
28 | 0 | { |
29 | 0 | } |
30 | | |
31 | | QGifPlugin::~QGifPlugin() |
32 | 0 | { |
33 | 0 | } |
34 | | |
35 | | QImageIOPlugin::Capabilities QGifPlugin::capabilities(QIODevice *device, const QByteArray &format) const |
36 | 0 | { |
37 | 0 | if (format == "gif" || (device && device->isReadable() && QGifHandler::canRead(device))) |
38 | 0 | return Capabilities(CanRead); |
39 | 0 | return { }; |
40 | 0 | } |
41 | | |
42 | | QImageIOHandler *QGifPlugin::create(QIODevice *device, const QByteArray &format) const |
43 | 0 | { |
44 | 0 | QImageIOHandler *handler = new QGifHandler; |
45 | 0 | handler->setDevice(device); |
46 | 0 | handler->setFormat(format); |
47 | 0 | return handler; |
48 | 0 | } |
49 | | |
50 | | QT_END_NAMESPACE |
51 | | |
52 | | #include "main.moc" |