qimagereader.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/image/qimagereader.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13namespace { namespace Q_QGS_loader { typedef QFactoryLoader Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ("org.qt-project.Qt.QImageIOHandlerFactoryInterface", QLatin1String("/imageformats")))) : value ("org.qt-project.Qt.QImageIOHandlerFactoryInterface", QLatin1String("/imageformats")) { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<QFactoryLoader, Q_QGS_loader::innerFunction, Q_QGS_loader::guard> loader;
0
14-
15-
16-
17enum _qt_BuiltInFormatType {-
18-
19 _qt_PngFormat,-
20 _qt_BmpFormat,-
21-
22-
23 _qt_PpmFormat,-
24 _qt_PgmFormat,-
25 _qt_PbmFormat,-
26-
27-
28 _qt_XbmFormat,-
29-
30-
31 _qt_XpmFormat,-
32-
33 _qt_NumFormats,-
34 _qt_NoFormat = -1-
35};-
36-
37struct _qt_BuiltInFormatStruct-
38{-
39 const char *extension;-
40 const char *mimeType;-
41};-
42-
43static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {-
44-
45 {"png", "image/png"},-
46 {"bmp", "image/bmp"},-
47-
48-
49 {"ppm", "image/x-portable-pixmap"},-
50 {"pgm", "image/x-portable-graymap"},-
51 {"pbm", "image/x-portable-bitmap"},-
52-
53-
54 {"xbm", "image/x-xbitmap"},-
55-
56-
57 {"xpm", "image/x-xpixmap"},-
58-
59 {"", ""}-
60};-
61-
62static QImageIOHandler *createReadHandlerHelper(QIODevice *device,-
63 const QByteArray &format,-
64 bool autoDetectImageFormat,-
65 bool ignoresFormatAndExtension)-
66{-
67 if (!autoDetectImageFormat
!autoDetectImageFormatDescription
TRUEnever evaluated
FALSEnever evaluated
&& format.isEmpty()
format.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
68 return
never executed: return 0;
0;
never executed: return 0;
0
69-
70 QByteArray form = format.toLower();-
71 QImageIOHandler *handler = 0;-
72 QByteArray suffix;-
73-
74-
75 static QMutex mutex;-
76 QMutexLocker locker(&mutex);-
77-
78 typedef QMultiMap<int, QString> PluginKeyMap;-
79-
80-
81 QFactoryLoader *l = loader();-
82 const PluginKeyMap keyMap = l->keyMap();-
83-
84-
85-
86-
87-
88-
89 int suffixPluginIndex = -1;-
90-
91-
92 if (device
deviceDescription
TRUEnever evaluated
FALSEnever evaluated
&& format.isEmpty()
format.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& autoDetectImageFormat
autoDetectImageFormatDescription
TRUEnever evaluated
FALSEnever evaluated
&& !ignoresFormatAndExtension
!ignoresFormatAndExtensionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
93-
94-
95-
96 if (QFile *file = qobject_cast<QFile *>(device)
QFile *file = ...ile *>(device)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
97-
98-
99-
100 if (!(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()
!(suffix = QFi...1()).isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
101-
102 const int index = keyMap.key(QString::fromLatin1(suffix), -1);-
103 if (index != -1
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
104-
105-
106-
107-
108 suffixPluginIndex = index;-
109 }
never executed: end of block
0
110-
111 }
never executed: end of block
0
112 }
never executed: end of block
0
113 }
never executed: end of block
0
114-
115 QByteArray testFormat = !form.isEmpty()
!form.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
? form : suffix;
0
116-
117 if (ignoresFormatAndExtension
ignoresFormatAndExtensionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
118 testFormat = QByteArray();
never executed: testFormat = QByteArray();
0
119-
120-
121 if (suffixPluginIndex != -1
suffixPluginIndex != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
122-
123-
124 const qint64 pos = device
deviceDescription
TRUEnever evaluated
FALSEnever evaluated
? device->pos() : 0;
0
125 const int index = keyMap.key(QString::fromLatin1(suffix), -1);-
126 if (index != -1
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
127 QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(index));-
128 if (plugin
pluginDescription
TRUEnever evaluated
FALSEnever evaluated
&& plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead
plugin->capabi...lugin::CanReadDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
129 handler = plugin->create(device, testFormat);-
130-
131-
132-
133-
134 }
never executed: end of block
0
135 }
never executed: end of block
0
136 if (device
deviceDescription
TRUEnever evaluated
FALSEnever evaluated
&& !device->isSequential()
!device->isSequential()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
137 device->seek(pos);
never executed: device->seek(pos);
0
138 }
never executed: end of block
0
139-
140 if (!handler
!handlerDescription
TRUEnever evaluated
FALSEnever evaluated
&& !testFormat.isEmpty()
!testFormat.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& !ignoresFormatAndExtension
!ignoresFormatAndExtensionDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
141-
142-
143 const qint64 pos = device
deviceDescription
TRUEnever evaluated
FALSEnever evaluated
? device->pos() : 0;
0
144-
145 if (autoDetectImageFormat
autoDetectImageFormatDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
146 const int keyCount = keyMap.size();-
147 for (int i = 0; i < keyCount
i < keyCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
148 if (i != suffixPluginIndex
i != suffixPluginIndexDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
149 QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(i));-
150 if (plugin
pluginDescription
TRUEnever evaluated
FALSEnever evaluated
&& plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead
plugin->capabi...lugin::CanReadDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
151-
152-
153-
154 handler = plugin->create(device, testFormat);-
155 break;
never executed: break;
0
156 }-
157 }
never executed: end of block
0
158 }
never executed: end of block
0
159 }
never executed: end of block
else {
0
160 const int testIndex = keyMap.key(QLatin1String(testFormat), -1);-
161 if (testIndex != -1
testIndex != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
162 QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(testIndex));-
163 if (plugin
pluginDescription
TRUEnever evaluated
FALSEnever evaluated
&& plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead
plugin->capabi...lugin::CanReadDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
164-
165-
166-
167 handler = plugin->create(device, testFormat);-
168 }
never executed: end of block
0
169 }
never executed: end of block
0
170 }
never executed: end of block
0
171 if (device
deviceDescription
TRUEnever evaluated
FALSEnever evaluated
&& !device->isSequential()
!device->isSequential()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
172 device->seek(pos);
never executed: device->seek(pos);
0
173 }
never executed: end of block
0
174-
175-
176-
177-
178-
179 if (!handler
!handlerDescription
TRUEnever evaluated
FALSEnever evaluated
&& !testFormat.isEmpty()
!testFormat.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
180 if (false) {
dead code: { }
-
181-
182 }
dead code: { }
else if (testFormat == "png"
testFormat == "png"Description
TRUEnever evaluated
FALSEnever evaluated
) {
-
183 handler = new QPngHandler;-
184 }
never executed: end of block
else if (testFormat == "bmp"
testFormat == "bmp"Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
185 handler = new QBmpHandler;-
186 }
never executed: end of block
else if (testFormat == "dib"
testFormat == "dib"Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
187 handler = new QBmpHandler(QBmpHandler::DibFormat);-
188-
189-
190 }
never executed: end of block
else if (testFormat == "xpm"
testFormat == "xpm"Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
191 handler = new QXpmHandler;-
192-
193-
194 }
never executed: end of block
else if (testFormat == "xbm"
testFormat == "xbm"Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
195 handler = new QXbmHandler;-
196 handler->setOption(QImageIOHandler::SubType, testFormat);-
197-
198-
199 }
never executed: end of block
else if (testFormat == "pbm"
testFormat == "pbm"Description
TRUEnever evaluated
FALSEnever evaluated
|| testFormat == "pbmraw"
testFormat == "pbmraw"Description
TRUEnever evaluated
FALSEnever evaluated
|| testFormat == "pgm"
testFormat == "pgm"Description
TRUEnever evaluated
FALSEnever evaluated
0
200 || testFormat == "pgmraw"
testFormat == "pgmraw"Description
TRUEnever evaluated
FALSEnever evaluated
|| testFormat == "ppm"
testFormat == "ppm"Description
TRUEnever evaluated
FALSEnever evaluated
|| testFormat == "ppmraw"
testFormat == "ppmraw"Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
201 handler = new QPpmHandler;-
202 handler->setOption(QImageIOHandler::SubType, testFormat);-
203-
204 }
never executed: end of block
0
205-
206-
207-
208-
209-
210 }
never executed: end of block
0
211-
212-
213 if (!handler
!handlerDescription
TRUEnever evaluated
FALSEnever evaluated
&& (autoDetectImageFormat
autoDetectImageFormatDescription
TRUEnever evaluated
FALSEnever evaluated
|| ignoresFormatAndExtension
ignoresFormatAndExtensionDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
214-
215 const qint64 pos = device
deviceDescription
TRUEnever evaluated
FALSEnever evaluated
? device->pos() : 0;
0
216 const int keyCount = keyMap.size();-
217 for (int i = 0; i < keyCount
i < keyCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
218 if (i != suffixPluginIndex
i != suffixPluginIndexDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
219 QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(i));-
220 if (plugin
pluginDescription
TRUEnever evaluated
FALSEnever evaluated
&& plugin->capabilities(device, QByteArray()) & QImageIOPlugin::CanRead
plugin->capabi...lugin::CanReadDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
221 handler = plugin->create(device, testFormat);-
222-
223-
224-
225 break;
never executed: break;
0
226 }-
227 }
never executed: end of block
0
228 }
never executed: end of block
0
229 if (device
deviceDescription
TRUEnever evaluated
FALSEnever evaluated
&& !device->isSequential()
!device->isSequential()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
230 device->seek(pos);
never executed: device->seek(pos);
0
231 }
never executed: end of block
0
232-
233-
234 if (!handler
!handlerDescription
TRUEnever evaluated
FALSEnever evaluated
&& (autoDetectImageFormat
autoDetectImageFormatDescription
TRUEnever evaluated
FALSEnever evaluated
|| ignoresFormatAndExtension
ignoresFormatAndExtensionDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
235-
236-
237 int currentFormat = 0;-
238 if (!suffix.isEmpty()
!suffix.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
239-
240-
241 for (int i = 0; i < _qt_NumFormats
i < _qt_NumFormatsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
242 if (_qt_BuiltInFormats[i].extension == suffix
_qt_BuiltInFor...sion == suffixDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
243 currentFormat = i;-
244 break;
never executed: break;
0
245 }-
246 }
never executed: end of block
0
247 }
never executed: end of block
0
248-
249 QByteArray subType;-
250 int numFormats = _qt_NumFormats;-
251 while (device
deviceDescription
TRUEnever evaluated
FALSEnever evaluated
&& numFormats >= 0
numFormats >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
252 const qint64 pos = device->pos();-
253 switch (currentFormat) {-
254-
255 case
never executed: case _qt_PngFormat:
_qt_PngFormat:
never executed: case _qt_PngFormat:
0
256 if (QPngHandler::canRead(device)
QPngHandler::canRead(device)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
257 handler = new QPngHandler;
never executed: handler = new QPngHandler;
0
258 break;
never executed: break;
0
259 case
never executed: case _qt_BmpFormat:
_qt_BmpFormat:
never executed: case _qt_BmpFormat:
0
260 if (QBmpHandler::canRead(device)
QBmpHandler::canRead(device)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
261 handler = new QBmpHandler;
never executed: handler = new QBmpHandler;
0
262 break;
never executed: break;
0
263-
264-
265 case
never executed: case _qt_XpmFormat:
_qt_XpmFormat:
never executed: case _qt_XpmFormat:
0
266 if (QXpmHandler::canRead(device)
QXpmHandler::canRead(device)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
267 handler = new QXpmHandler;
never executed: handler = new QXpmHandler;
0
268 break;
never executed: break;
0
269-
270-
271 case
never executed: case _qt_PbmFormat:
_qt_PbmFormat:
never executed: case _qt_PbmFormat:
0
272 case
never executed: case _qt_PgmFormat:
_qt_PgmFormat:
never executed: case _qt_PgmFormat:
0
273 case
never executed: case _qt_PpmFormat:
_qt_PpmFormat:
never executed: case _qt_PpmFormat:
0
274 if (QPpmHandler::canRead(device, &subType)
QPpmHandler::c...ice, &subType)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
275 handler = new QPpmHandler;-
276 handler->setOption(QImageIOHandler::SubType, subType);-
277 }
never executed: end of block
0
278 break;
never executed: break;
0
279-
280-
281 case
never executed: case _qt_XbmFormat:
_qt_XbmFormat:
never executed: case _qt_XbmFormat:
0
282 if (QXbmHandler::canRead(device)
QXbmHandler::canRead(device)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
283 handler = new QXbmHandler;
never executed: handler = new QXbmHandler;
0
284 break;
never executed: break;
0
285-
286 default
never executed: default:
:
never executed: default:
0
287 break;
never executed: break;
0
288 }-
289 if (!device->isSequential()
!device->isSequential()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
290 device->seek(pos);
never executed: device->seek(pos);
0
291-
292 if (handler
handlerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
293-
294-
295-
296-
297 break;
never executed: break;
0
298 }-
299-
300 --numFormats;-
301 ++currentFormat;-
302 currentFormat %= _qt_NumFormats;-
303 }
never executed: end of block
0
304 }
never executed: end of block
0
305-
306 if (!handler
!handlerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
307-
308-
309-
310-
311 return
never executed: return 0;
0;
never executed: return 0;
0
312 }-
313-
314 handler->setDevice(device);-
315 if (!form.isEmpty()
!form.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
316 handler->setFormat(form);
never executed: handler->setFormat(form);
0
317 return
never executed: return handler;
handler;
never executed: return handler;
0
318}-
319-
320class QImageReaderPrivate-
321{-
322public:-
323 QImageReaderPrivate(QImageReader *qq);-
324 ~QImageReaderPrivate();-
325-
326-
327 QByteArray format;-
328 bool autoDetectImageFormat;-
329 bool ignoresFormatAndExtension;-
330 QIODevice *device;-
331 bool deleteDevice;-
332 QImageIOHandler *handler;-
333 bool initHandler();-
334-
335-
336 QRect clipRect;-
337 QSize scaledSize;-
338 QRect scaledClipRect;-
339 int quality;-
340 QMap<QString, QString> text;-
341 void getText();-
342 enum {-
343 UsePluginDefault,-
344 ApplyTransform,-
345 DoNotApplyTransform-
346 } autoTransform;-
347-
348-
349 QImageReader::ImageReaderError imageReaderError;-
350 QString errorString;-
351-
352 QImageReader *q;-
353};-
354-
355-
356-
357-
358QImageReaderPrivate::QImageReaderPrivate(QImageReader *qq)-
359 : autoDetectImageFormat(true), ignoresFormatAndExtension(false)-
360{-
361 device = 0;-
362 deleteDevice = false;-
363 handler = 0;-
364 quality = -1;-
365 imageReaderError = QImageReader::UnknownError;-
366 autoTransform = UsePluginDefault;-
367-
368 q = qq;-
369}
never executed: end of block
0
370-
371-
372-
373-
374QImageReaderPrivate::~QImageReaderPrivate()-
375{-
376 if (deleteDevice
deleteDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
377 delete device;
never executed: delete device;
0
378 delete handler;-
379}
never executed: end of block
0
380-
381-
382-
383-
384bool QImageReaderPrivate::initHandler()-
385{-
386-
387 if (!device
!deviceDescription
TRUEnever evaluated
FALSEnever evaluated
|| (!deleteDevice
!deleteDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
&& !device->isOpen()
!device->isOpen()Description
TRUEnever evaluated
FALSEnever evaluated
&& !device->open(QIODevice::ReadOnly)
!device->open(...ice::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
388 imageReaderError = QImageReader::DeviceError;-
389 errorString = QImageReader::tr("Invalid device");-
390 return
never executed: return false;
false;
never executed: return false;
0
391 }-
392-
393-
394 if (deleteDevice
deleteDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
&& !device->isOpen()
!device->isOpen()Description
TRUEnever evaluated
FALSEnever evaluated
&& !device->open(QIODevice::ReadOnly)
!device->open(...ice::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
&& autoDetectImageFormat
autoDetectImageFormatDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
395 QList<QByteArray> extensions = QImageReader::supportedImageFormats();-
396 if (!format.isEmpty()
!format.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
397-
398 int currentFormatIndex = extensions.indexOf(format.toLower());-
399 if (currentFormatIndex > 0
currentFormatIndex > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
400 extensions.swap(0, currentFormatIndex);
never executed: extensions.swap(0, currentFormatIndex);
0
401 }
never executed: end of block
0
402-
403 int currentExtension = 0;-
404-
405 QFile *file = static_cast<QFile *>(device);-
406 QString fileName = file->fileName();-
407-
408 do {-
409 file->setFileName(fileName + QLatin1Char('.')-
410 + QString::fromLatin1(extensions.at(currentExtension++).constData()));-
411 file->open(QIODevice::ReadOnly);-
412 }
never executed: end of block
while (!file->isOpen()
!file->isOpen()Description
TRUEnever evaluated
FALSEnever evaluated
&& currentExtension < extensions.size()
currentExtensi...ensions.size()Description
TRUEnever evaluated
FALSEnever evaluated
);
0
413-
414 if (!device->isOpen()
!device->isOpen()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
415 imageReaderError = QImageReader::FileNotFoundError;-
416 errorString = QImageReader::tr("File not found");-
417 file->setFileName(fileName);-
418 return
never executed: return false;
false;
never executed: return false;
0
419 }-
420 }
never executed: end of block
0
421-
422-
423 if (!handler
!handlerDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(handler = cre...tension)) == 0Description
TRUEnever evaluated
FALSEnever evaluated
handler = createReadHandlerHelper(device, format, autoDetectImageFormat, ignoresFormatAndExtension)) == 0
(handler = cre...tension)) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
424 imageReaderError = QImageReader::UnsupportedFormatError;-
425 errorString = QImageReader::tr("Unsupported image format");-
426 return
never executed: return false;
false;
never executed: return false;
0
427 }-
428 return
never executed: return true;
true;
never executed: return true;
0
429}-
430-
431-
432-
433-
434void QImageReaderPrivate::getText()-
435{-
436 if (!text.isEmpty()
!text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| (!handler
!handlerDescription
TRUEnever evaluated
FALSEnever evaluated
&& !initHandler()
!initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
) || !handler->supportsOption(QImageIOHandler::Description)
!handler->supp...::Description)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
437 return;
never executed: return;
0
438 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(handler->option(QImageIOHandler::Description).toString().split( QLatin1String("\n\n")))>::type> _container_((handler->option(QImageIOHandler::Description).toString().split( QLatin1String("\n\n")))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &pair = *_container_.i; _container_.control; _container_.control = 0)-
439 {-
440 int index = pair.indexOf(QLatin1Char(':'));-
441 if (index >= 0
index >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& pair.indexOf(QLatin1Char(' ')) < index
pair.indexOf(Q...(' ')) < indexDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
442 text.insert(QLatin1String("Description"), pair.simplified());-
443 }
never executed: end of block
else {
0
444 QString key = pair.left(index);-
445 text.insert(key, pair.mid(index + 2).simplified());-
446 }
never executed: end of block
0
447 }-
448}
never executed: end of block
0
449-
450-
451-
452-
453-
454QImageReader::QImageReader()-
455 : d(new QImageReaderPrivate(this))-
456{-
457}
never executed: end of block
0
458-
459-
460-
461-
462-
463QImageReader::QImageReader(QIODevice *device, const QByteArray &format)-
464 : d(new QImageReaderPrivate(this))-
465{-
466 d->device = device;-
467 d->format = format;-
468}
never executed: end of block
0
469-
470-
471-
472-
473-
474-
475-
476QImageReader::QImageReader(const QString &fileName, const QByteArray &format)-
477 : d(new QImageReaderPrivate(this))-
478{-
479 QFile *file = new QFile(fileName);-
480 d->device = file;-
481 d->deleteDevice = true;-
482 d->format = format;-
483}
never executed: end of block
0
484-
485-
486-
487-
488QImageReader::~QImageReader()-
489{-
490 delete d;-
491}
never executed: end of block
0
492void QImageReader::setFormat(const QByteArray &format)-
493{-
494 d->format = format;-
495}
never executed: end of block
0
496QByteArray QImageReader::format() const-
497{-
498 if (d->format.isEmpty()
d->format.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
499 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
500 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
501 return
never executed: return d->handler->canRead() ? d->handler->format() : QByteArray();
d->handler->canRead() ? d->handler->format() : QByteArray();
never executed: return d->handler->canRead() ? d->handler->format() : QByteArray();
0
502 }-
503-
504 return
never executed: return d->format;
d->format;
never executed: return d->format;
0
505}-
506void QImageReader::setAutoDetectImageFormat(bool enabled)-
507{-
508 d->autoDetectImageFormat = enabled;-
509}
never executed: end of block
0
510-
511-
512-
513-
514-
515-
516-
517bool QImageReader::autoDetectImageFormat() const-
518{-
519 return
never executed: return d->autoDetectImageFormat;
d->autoDetectImageFormat;
never executed: return d->autoDetectImageFormat;
0
520}-
521void QImageReader::setDecideFormatFromContent(bool ignored)-
522{-
523 d->ignoresFormatAndExtension = ignored;-
524}
never executed: end of block
0
525bool QImageReader::decideFormatFromContent() const-
526{-
527 return
never executed: return d->ignoresFormatAndExtension;
d->ignoresFormatAndExtension;
never executed: return d->ignoresFormatAndExtension;
0
528}-
529void QImageReader::setDevice(QIODevice *device)-
530{-
531 if (d->device
d->deviceDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->deleteDevice
d->deleteDeviceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
532 delete d->device;
never executed: delete d->device;
0
533 d->device = device;-
534 d->deleteDevice = false;-
535 delete d->handler;-
536 d->handler = 0;-
537 d->text.clear();-
538}
never executed: end of block
0
539-
540-
541-
542-
543-
544QIODevice *QImageReader::device() const-
545{-
546 return
never executed: return d->device;
d->device;
never executed: return d->device;
0
547}-
548void QImageReader::setFileName(const QString &fileName)-
549{-
550 setDevice(new QFile(fileName));-
551 d->deleteDevice = true;-
552}
never executed: end of block
0
553QString QImageReader::fileName() const-
554{-
555 QFile *file = qobject_cast<QFile *>(d->device);-
556 return
never executed: return file ? file->fileName() : QString();
file ? file->fileName() : QString();
never executed: return file ? file->fileName() : QString();
0
557}-
558void QImageReader::setQuality(int quality)-
559{-
560 d->quality = quality;-
561}
never executed: end of block
0
562int QImageReader::quality() const-
563{-
564 return
never executed: return d->quality;
d->quality;
never executed: return d->quality;
0
565}-
566QSize QImageReader::size() const-
567{-
568 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
569 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
570-
571 if (d->handler->supportsOption(QImageIOHandler::Size)
d->handler->su...Handler::Size)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
572 return
never executed: return d->handler->option(QImageIOHandler::Size).toSize();
d->handler->option(QImageIOHandler::Size).toSize();
never executed: return d->handler->option(QImageIOHandler::Size).toSize();
0
573-
574 return
never executed: return QSize();
QSize();
never executed: return QSize();
0
575}-
576QImage::Format QImageReader::imageFormat() const-
577{-
578 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
579 return
never executed: return QImage::Format_Invalid;
QImage::Format_Invalid;
never executed: return QImage::Format_Invalid;
0
580-
581 if (d->handler->supportsOption(QImageIOHandler::ImageFormat)
d->handler->su...::ImageFormat)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
582 return
never executed: return (QImage::Format)d->handler->option(QImageIOHandler::ImageFormat).toInt();
(QImage::Format)d->handler->option(QImageIOHandler::ImageFormat).toInt();
never executed: return (QImage::Format)d->handler->option(QImageIOHandler::ImageFormat).toInt();
0
583-
584 return
never executed: return QImage::Format_Invalid;
QImage::Format_Invalid;
never executed: return QImage::Format_Invalid;
0
585}-
586QStringList QImageReader::textKeys() const-
587{-
588 d->getText();-
589 return
never executed: return d->text.keys();
d->text.keys();
never executed: return d->text.keys();
0
590}-
591QString QImageReader::text(const QString &key) const-
592{-
593 d->getText();-
594 return
never executed: return d->text.value(key);
d->text.value(key);
never executed: return d->text.value(key);
0
595}-
596void QImageReader::setClipRect(const QRect &rect)-
597{-
598 d->clipRect = rect;-
599}
never executed: end of block
0
600QRect QImageReader::clipRect() const-
601{-
602 return
never executed: return d->clipRect;
d->clipRect;
never executed: return d->clipRect;
0
603}-
604void QImageReader::setScaledSize(const QSize &size)-
605{-
606 d->scaledSize = size;-
607}
never executed: end of block
0
608-
609-
610-
611-
612-
613-
614QSize QImageReader::scaledSize() const-
615{-
616 return
never executed: return d->scaledSize;
d->scaledSize;
never executed: return d->scaledSize;
0
617}-
618void QImageReader::setScaledClipRect(const QRect &rect)-
619{-
620 d->scaledClipRect = rect;-
621}
never executed: end of block
0
622-
623-
624-
625-
626-
627-
628QRect QImageReader::scaledClipRect() const-
629{-
630 return
never executed: return d->scaledClipRect;
d->scaledClipRect;
never executed: return d->scaledClipRect;
0
631}-
632void QImageReader::setBackgroundColor(const QColor &color)-
633{-
634 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
635 return;
never executed: return;
0
636 if (d->handler->supportsOption(QImageIOHandler::BackgroundColor)
d->handler->su...ckgroundColor)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
637 d->handler->setOption(QImageIOHandler::BackgroundColor, color);
never executed: d->handler->setOption(QImageIOHandler::BackgroundColor, color);
0
638}
never executed: end of block
0
639QColor QImageReader::backgroundColor() const-
640{-
641 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
642 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
643 if (d->handler->supportsOption(QImageIOHandler::BackgroundColor)
d->handler->su...ckgroundColor)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
644 return
never executed: return qvariant_cast<QColor>(d->handler->option(QImageIOHandler::BackgroundColor));
qvariant_cast<QColor>(d->handler->option(QImageIOHandler::BackgroundColor));
never executed: return qvariant_cast<QColor>(d->handler->option(QImageIOHandler::BackgroundColor));
0
645 return
never executed: return QColor();
QColor();
never executed: return QColor();
0
646}-
647bool QImageReader::supportsAnimation() const-
648{-
649 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
650 return
never executed: return false;
false;
never executed: return false;
0
651 if (d->handler->supportsOption(QImageIOHandler::Animation)
d->handler->su...er::Animation)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
652 return
never executed: return d->handler->option(QImageIOHandler::Animation).toBool();
d->handler->option(QImageIOHandler::Animation).toBool();
never executed: return d->handler->option(QImageIOHandler::Animation).toBool();
0
653 return
never executed: return false;
false;
never executed: return false;
0
654}-
655-
656-
657-
658-
659-
660-
661QByteArray QImageReader::subType() const-
662{-
663 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
664 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
665-
666 if (d->handler->supportsOption(QImageIOHandler::SubType)
d->handler->su...dler::SubType)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
667 return
never executed: return d->handler->option(QImageIOHandler::SubType).toByteArray();
d->handler->option(QImageIOHandler::SubType).toByteArray();
never executed: return d->handler->option(QImageIOHandler::SubType).toByteArray();
0
668 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
669}-
670-
671-
672-
673-
674-
675-
676QList<QByteArray> QImageReader::supportedSubTypes() const-
677{-
678 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
679 return
never executed: return QList<QByteArray>();
QList<QByteArray>();
never executed: return QList<QByteArray>();
0
680-
681 if (!d->handler->supportsOption(QImageIOHandler::SupportedSubTypes)
!d->handler->s...ortedSubTypes)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
682 return
never executed: return d->handler->option(QImageIOHandler::SupportedSubTypes).value< QList<QByteArray> >();
d->handler->option(QImageIOHandler::SupportedSubTypes).value< QList<QByteArray> >();
never executed: return d->handler->option(QImageIOHandler::SupportedSubTypes).value< QList<QByteArray> >();
0
683 return
never executed: return QList<QByteArray>();
QList<QByteArray>();
never executed: return QList<QByteArray>();
0
684}-
685QImageIOHandler::Transformations QImageReader::transformation() const-
686{-
687 int option = QImageIOHandler::TransformationNone;-
688 if (d->initHandler()
d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
&& d->handler->supportsOption(QImageIOHandler::ImageTransformation)
d->handler->su...ransformation)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
689 option = d->handler->option(QImageIOHandler::ImageTransformation).toInt();
never executed: option = d->handler->option(QImageIOHandler::ImageTransformation).toInt();
0
690 return
never executed: return QImageIOHandler::Transformations(option);
QImageIOHandler::Transformations(option);
never executed: return QImageIOHandler::Transformations(option);
0
691}-
692void QImageReader::setAutoTransform(bool enabled)-
693{-
694 d->autoTransform = enabled
enabledDescription
TRUEnever evaluated
FALSEnever evaluated
? QImageReaderPrivate::ApplyTransform
0
695 : QImageReaderPrivate::DoNotApplyTransform;-
696}
never executed: end of block
0
697bool QImageReader::autoTransform() const-
698{-
699 switch (d->autoTransform) {-
700 case
never executed: case QImageReaderPrivate::ApplyTransform:
QImageReaderPrivate::ApplyTransform:
never executed: case QImageReaderPrivate::ApplyTransform:
0
701 return
never executed: return true;
true;
never executed: return true;
0
702 case
never executed: case QImageReaderPrivate::DoNotApplyTransform:
QImageReaderPrivate::DoNotApplyTransform:
never executed: case QImageReaderPrivate::DoNotApplyTransform:
0
703 return
never executed: return false;
false;
never executed: return false;
0
704 case
never executed: case QImageReaderPrivate::UsePluginDefault:
QImageReaderPrivate::UsePluginDefault:
never executed: case QImageReaderPrivate::UsePluginDefault:
0
705 if (d->initHandler()
d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
706 return
never executed: return d->handler->supportsOption(QImageIOHandler::TransformedByDefault);
d->handler->supportsOption(QImageIOHandler::TransformedByDefault);
never executed: return d->handler->supportsOption(QImageIOHandler::TransformedByDefault);
0
707-
708 default
never executed: default:
:
never executed: default:
code before this statement never executed: default:
0
709 break;
never executed: break;
0
710 }-
711 return
never executed: return false;
false;
never executed: return false;
0
712}-
713void QImageReader::setGamma(float gamma)-
714{-
715 if (d->initHandler()
d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
&& d->handler->supportsOption(QImageIOHandler::Gamma)
d->handler->su...andler::Gamma)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
716 d->handler->setOption(QImageIOHandler::Gamma, gamma);
never executed: d->handler->setOption(QImageIOHandler::Gamma, gamma);
0
717}
never executed: end of block
0
718float QImageReader::gamma() const-
719{-
720 if (d->initHandler()
d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
&& d->handler->supportsOption(QImageIOHandler::Gamma)
d->handler->su...andler::Gamma)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
721 return
never executed: return d->handler->option(QImageIOHandler::Gamma).toFloat();
d->handler->option(QImageIOHandler::Gamma).toFloat();
never executed: return d->handler->option(QImageIOHandler::Gamma).toFloat();
0
722 return
never executed: return 0.0;
0.0;
never executed: return 0.0;
0
723}-
724bool QImageReader::canRead() const-
725{-
726 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
727 return
never executed: return false;
false;
never executed: return false;
0
728-
729 return
never executed: return d->handler->canRead();
d->handler->canRead();
never executed: return d->handler->canRead();
0
730}-
731QImage QImageReader::read()-
732{-
733-
734-
735 QImage image;-
736 return
never executed: return read(&image) ? image : QImage();
read(&image) ? image : QImage();
never executed: return read(&image) ? image : QImage();
0
737}-
738-
739extern void qt_imageTransform(QImage &src, QImageIOHandler::Transformations orient);-
740bool QImageReader::read(QImage *image)-
741{-
742 if (!image
!imageDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
743 QMessageLogger(__FILE__, 1312, __PRETTY_FUNCTION__).warning("QImageReader::read: cannot read into null pointer");-
744 return
never executed: return false;
false;
never executed: return false;
0
745 }-
746-
747 if (!d->handler
!d->handlerDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
748 return
never executed: return false;
false;
never executed: return false;
0
749-
750-
751 if (d->handler->supportsOption(QImageIOHandler::ScaledSize)
d->handler->su...r::ScaledSize)Description
TRUEnever evaluated
FALSEnever evaluated
&& d->scaledSize.isValid()
d->scaledSize.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
752 if ((d->handler->supportsOption(QImageIOHandler::ClipRect)
d->handler->su...ler::ClipRect)Description
TRUEnever evaluated
FALSEnever evaluated
&& !d->clipRect.isNull()
!d->clipRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
753 || d->clipRect.isNull()
d->clipRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
754-
755-
756 d->handler->setOption(QImageIOHandler::ScaledSize, d->scaledSize);-
757 }
never executed: end of block
0
758 }
never executed: end of block
0
759 if (d->handler->supportsOption(QImageIOHandler::ClipRect)
d->handler->su...ler::ClipRect)Description
TRUEnever evaluated
FALSEnever evaluated
&& !d->clipRect.isNull()
!d->clipRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
760 d->handler->setOption(QImageIOHandler::ClipRect, d->clipRect);
never executed: d->handler->setOption(QImageIOHandler::ClipRect, d->clipRect);
0
761 if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect)
d->handler->su...caledClipRect)Description
TRUEnever evaluated
FALSEnever evaluated
&& !d->scaledClipRect.isNull()
!d->scaledClipRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
762 d->handler->setOption(QImageIOHandler::ScaledClipRect, d->scaledClipRect);
never executed: d->handler->setOption(QImageIOHandler::ScaledClipRect, d->scaledClipRect);
0
763 if (d->handler->supportsOption(QImageIOHandler::Quality)
d->handler->su...dler::Quality)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
764 d->handler->setOption(QImageIOHandler::Quality, d->quality);
never executed: d->handler->setOption(QImageIOHandler::Quality, d->quality);
0
765-
766-
767 if (!d->handler->read(image)
!d->handler->read(image)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
768 d->imageReaderError = InvalidDataError;-
769 d->errorString = QImageReader::tr("Unable to read image data");-
770 return
never executed: return false;
false;
never executed: return false;
0
771 }-
772-
773-
774-
775 if (d->handler->supportsOption(QImageIOHandler::ClipRect)
d->handler->su...ler::ClipRect)Description
TRUEnever evaluated
FALSEnever evaluated
&& !d->clipRect.isNull()
!d->clipRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
776 if (d->handler->supportsOption(QImageIOHandler::ScaledSize)
d->handler->su...r::ScaledSize)Description
TRUEnever evaluated
FALSEnever evaluated
&& d->scaledSize.isValid()
d->scaledSize.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
777 if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect)
d->handler->su...caledClipRect)Description
TRUEnever evaluated
FALSEnever evaluated
&& !d->scaledClipRect.isNull()
!d->scaledClipRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
778-
779 }
never executed: end of block
else {
0
780-
781 if (!d->scaledClipRect.isNull()
!d->scaledClipRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
782 *
never executed: *image = image->copy(d->scaledClipRect);
image = image->copy(d->scaledClipRect);
never executed: *image = image->copy(d->scaledClipRect);
0
783 }
never executed: end of block
0
784 } else {-
785 if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect)
d->handler->su...caledClipRect)Description
TRUEnever evaluated
FALSEnever evaluated
&& !d->scaledClipRect.isNull()
!d->scaledClipRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
786-
787-
788 }
never executed: end of block
else {
0
789 if (d->scaledSize.isValid()
d->scaledSize.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
790 *image = image->scaled(d->scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);-
791 }
never executed: end of block
0
792 if (d->scaledClipRect.isValid()
d->scaledClipRect.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
793 *image = image->copy(d->scaledClipRect);-
794 }
never executed: end of block
0
795 }
never executed: end of block
0
796 }-
797 } else {-
798 if (d->handler->supportsOption(QImageIOHandler::ScaledSize)
d->handler->su...r::ScaledSize)Description
TRUEnever evaluated
FALSEnever evaluated
&& d->scaledSize.isValid()
d->scaledSize.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& d->clipRect.isNull()
d->clipRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
799 if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect)
d->handler->su...caledClipRect)Description
TRUEnever evaluated
FALSEnever evaluated
&& !d->scaledClipRect.isNull()
!d->scaledClipRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
800-
801 }
never executed: end of block
else {
0
802-
803 if (d->scaledClipRect.isValid()
d->scaledClipRect.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
804 *image = image->copy(d->scaledClipRect);-
805 }
never executed: end of block
0
806 }
never executed: end of block
0
807 } else {-
808 if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect)
d->handler->su...caledClipRect)Description
TRUEnever evaluated
FALSEnever evaluated
&& !d->scaledClipRect.isNull()
!d->scaledClipRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
809-
810-
811-
812 }
never executed: end of block
else {
0
813-
814 if (d->clipRect.isValid()
d->clipRect.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
815 *
never executed: *image = image->copy(d->clipRect);
image = image->copy(d->clipRect);
never executed: *image = image->copy(d->clipRect);
0
816 if (d->scaledSize.isValid()
d->scaledSize.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
817 *
never executed: *image = image->scaled(d->scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
image = image->scaled(d->scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
never executed: *image = image->scaled(d->scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
0
818 if (d->scaledClipRect.isValid()
d->scaledClipRect.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
819 *
never executed: *image = image->copy(d->scaledClipRect);
image = image->copy(d->scaledClipRect);
never executed: *image = image->copy(d->scaledClipRect);
0
820 }
never executed: end of block
0
821 }-
822 }-
823-
824-
825 static bool disable2xImageLoading = !qEnvironmentVariableIsEmpty("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING");-
826 if (!disable2xImageLoading
!disable2xImageLoadingDescription
TRUEnever evaluated
FALSEnever evaluated
&& QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))
QFileInfo(file...String("@2x"))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
827 image->setDevicePixelRatio(2.0);-
828 }
never executed: end of block
0
829 if (autoTransform()
autoTransform()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
830 qt_imageTransform(*image, transformation());
never executed: qt_imageTransform(*image, transformation());
0
831-
832 return
never executed: return true;
true;
never executed: return true;
0
833}-
834bool QImageReader::jumpToNextImage()-
835{-
836 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
837 return
never executed: return false;
false;
never executed: return false;
0
838 return
never executed: return d->handler->jumpToNextImage();
d->handler->jumpToNextImage();
never executed: return d->handler->jumpToNextImage();
0
839}-
840bool QImageReader::jumpToImage(int imageNumber)-
841{-
842 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
843 return
never executed: return false;
false;
never executed: return false;
0
844 return
never executed: return d->handler->jumpToImage(imageNumber);
d->handler->jumpToImage(imageNumber);
never executed: return d->handler->jumpToImage(imageNumber);
0
845}-
846int QImageReader::loopCount() const-
847{-
848 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
849 return
never executed: return -1;
-1;
never executed: return -1;
0
850 return
never executed: return d->handler->loopCount();
d->handler->loopCount();
never executed: return d->handler->loopCount();
0
851}-
852int QImageReader::imageCount() const-
853{-
854 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
855 return
never executed: return -1;
-1;
never executed: return -1;
0
856 return
never executed: return d->handler->imageCount();
d->handler->imageCount();
never executed: return d->handler->imageCount();
0
857}-
858int QImageReader::nextImageDelay() const-
859{-
860 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
861 return
never executed: return -1;
-1;
never executed: return -1;
0
862 return
never executed: return d->handler->nextImageDelay();
d->handler->nextImageDelay();
never executed: return d->handler->nextImageDelay();
0
863}-
864int QImageReader::currentImageNumber() const-
865{-
866 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
867 return
never executed: return -1;
-1;
never executed: return -1;
0
868 return
never executed: return d->handler->currentImageNumber();
d->handler->currentImageNumber();
never executed: return d->handler->currentImageNumber();
0
869}-
870-
871-
872-
873-
874-
875-
876-
877QRect QImageReader::currentImageRect() const-
878{-
879 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
880 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
881 return
never executed: return d->handler->currentImageRect();
d->handler->currentImageRect();
never executed: return d->handler->currentImageRect();
0
882}-
883-
884-
885-
886-
887-
888-
889QImageReader::ImageReaderError QImageReader::error() const-
890{-
891 return
never executed: return d->imageReaderError;
d->imageReaderError;
never executed: return d->imageReaderError;
0
892}-
893-
894-
895-
896-
897-
898-
899-
900QString QImageReader::errorString() const-
901{-
902 if (d->errorString.isEmpty()
d->errorString.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
903 return
never executed: return QImageReader::tr("Unknown error");
QImageReader::tr("Unknown error");
never executed: return QImageReader::tr("Unknown error");
0
904 return
never executed: return d->errorString;
d->errorString;
never executed: return d->errorString;
0
905}-
906bool QImageReader::supportsOption(QImageIOHandler::ImageOption option) const-
907{-
908 if (!d->initHandler()
!d->initHandler()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
909 return
never executed: return false;
false;
never executed: return false;
0
910 return
never executed: return d->handler->supportsOption(option);
d->handler->supportsOption(option);
never executed: return d->handler->supportsOption(option);
0
911}-
912-
913-
914-
915-
916-
917QByteArray QImageReader::imageFormat(const QString &fileName)-
918{-
919 QFile file(fileName);-
920 if (!file.open(QFile::ReadOnly)
!file.open(QFile::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
921 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
922-
923 return
never executed: return imageFormat(&file);
imageFormat(&file);
never executed: return imageFormat(&file);
0
924}-
925-
926-
927-
928-
929-
930-
931-
932QByteArray QImageReader::imageFormat(QIODevice *device)-
933{-
934 QByteArray format;-
935 QImageIOHandler *handler = createReadHandlerHelper(device, format, true, false);-
936 if (handler
handlerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
937 if (handler->canRead()
handler->canRead()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
938 format = handler->format();
never executed: format = handler->format();
0
939 delete handler;-
940 }
never executed: end of block
0
941 return
never executed: return format;
format;
never executed: return format;
0
942}-
943-
944-
945void supportedImageHandlerFormats(QFactoryLoader *loader,-
946 QImageIOPlugin::Capability cap,-
947 QList<QByteArray> *result);-
948-
949void supportedImageHandlerMimeTypes(QFactoryLoader *loader,-
950 QImageIOPlugin::Capability cap,-
951 QList<QByteArray> *result);-
952QList<QByteArray> QImageReader::supportedImageFormats()-
953{-
954 QList<QByteArray> formats;-
955 formats.reserve(_qt_NumFormats);-
956 for (int i = 0; i < _qt_NumFormats
i < _qt_NumFormatsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
957 formats << _qt_BuiltInFormats[i].extension;
never executed: formats << _qt_BuiltInFormats[i].extension;
0
958-
959-
960 supportedImageHandlerFormats(loader(), QImageIOPlugin::CanRead, &formats);-
961-
962-
963 std::sort(formats.begin(), formats.end());-
964 formats.erase(std::unique(formats.begin(), formats.end()), formats.end());-
965 return
never executed: return formats;
formats;
never executed: return formats;
0
966}-
967QList<QByteArray> QImageReader::supportedMimeTypes()-
968{-
969 QList<QByteArray> mimeTypes;-
970 mimeTypes.reserve(_qt_NumFormats);-
971 for (int i = 0; i < _qt_NumFormats
i < _qt_NumFormatsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
972 mimeTypes << _qt_BuiltInFormats[i].mimeType;
never executed: mimeTypes << _qt_BuiltInFormats[i].mimeType;
0
973-
974-
975 supportedImageHandlerMimeTypes(loader(), QImageIOPlugin::CanRead, &mimeTypes);-
976-
977-
978 std::sort(mimeTypes.begin(), mimeTypes.end());-
979 mimeTypes.erase(std::unique(mimeTypes.begin(), mimeTypes.end()), mimeTypes.end());-
980 return
never executed: return mimeTypes;
mimeTypes;
never executed: return mimeTypes;
0
981}-
982-
983-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9