| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | static QFactoryLoader *loader() { static QGlobalStatic<QFactoryLoader > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QFactoryLoader *x = new QFactoryLoader ("org.qt-project.Qt.QImageIOHandlerFactoryInterface", QLatin1String("/imageformats")); if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QFactoryLoader > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:2390 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:32 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:32 | yes Evaluation Count:2358 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-2390 |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | enum _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 | | - |
| 37 | struct _qt_BuiltInFormatStruct | - |
| 38 | { | - |
| 39 | _qt_BuiltInFormatType type; | - |
| 40 | const char *extension; | - |
| 41 | }; | - |
| 42 | | - |
| 43 | static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = { | - |
| 44 | | - |
| 45 | {_qt_PngFormat, "png"}, | - |
| 46 | {_qt_BmpFormat, "bmp"}, | - |
| 47 | | - |
| 48 | | - |
| 49 | {_qt_PpmFormat, "ppm"}, | - |
| 50 | {_qt_PgmFormat, "pgm"}, | - |
| 51 | {_qt_PbmFormat, "pbm"}, | - |
| 52 | | - |
| 53 | | - |
| 54 | {_qt_XbmFormat, "xbm"}, | - |
| 55 | | - |
| 56 | | - |
| 57 | {_qt_XpmFormat, "xpm"}, | - |
| 58 | | - |
| 59 | {_qt_NoFormat, ""} | - |
| 60 | }; | - |
| 61 | | - |
| 62 | static QImageIOHandler *createReadHandlerHelper(QIODevice *device, | - |
| 63 | const QByteArray &format, | - |
| 64 | bool autoDetectImageFormat, | - |
| 65 | bool ignoresFormatAndExtension) | - |
| 66 | { | - |
| 67 | if (!autoDetectImageFormat && format.isEmpty()) evaluated: !autoDetectImageFormat| yes Evaluation Count:10 | yes Evaluation Count:1720 |
evaluated: format.isEmpty()| yes Evaluation Count:8 | yes Evaluation Count:2 |
| 2-1720 |
| 68 | return 0; executed: return 0;Execution Count:8 | 8 |
| 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 && format.isEmpty() && autoDetectImageFormat && !ignoresFormatAndExtension) { partially evaluated: device| yes Evaluation Count:1722 | no Evaluation Count:0 |
evaluated: format.isEmpty()| yes Evaluation Count:1157 | yes Evaluation Count:565 |
partially evaluated: autoDetectImageFormat| yes Evaluation Count:1157 | no Evaluation Count:0 |
evaluated: !ignoresFormatAndExtension| yes Evaluation Count:1077 | yes Evaluation Count:80 |
| 0-1722 |
| 93 | | - |
| 94 | | - |
| 95 | | - |
| 96 | if (QFile *file = qobject_cast<QFile *>(device)) { evaluated: QFile *file = qobject_cast<QFile *>(device)| yes Evaluation Count:976 | yes Evaluation Count:101 |
| 101-976 |
| 97 | | - |
| 98 | | - |
| 99 | | - |
| 100 | if (!(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()) { evaluated: !(suffix = QFileInfo(file->fileName()).suffix().toLower().toLatin1()).isEmpty()| yes Evaluation Count:938 | yes Evaluation Count:38 |
| 38-938 |
| 101 | | - |
| 102 | const int index = keyMap.key(QString::fromLatin1(suffix), -1); | - |
| 103 | if (index != -1) { evaluated: index != -1| yes Evaluation Count:268 | yes Evaluation Count:670 |
| 268-670 |
| 104 | | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | suffixPluginIndex = index; | - |
| 109 | } executed: }Execution Count:268 | 268 |
| 110 | | - |
| 111 | } executed: }Execution Count:938 | 938 |
| 112 | } executed: }Execution Count:976 | 976 |
| 113 | } executed: }Execution Count:1077 | 1077 |
| 114 | | - |
| 115 | QByteArray testFormat = !form.isEmpty() ? form : suffix; evaluated: !form.isEmpty()| yes Evaluation Count:565 | yes Evaluation Count:1157 |
| 565-1157 |
| 116 | | - |
| 117 | if (ignoresFormatAndExtension) evaluated: ignoresFormatAndExtension| yes Evaluation Count:80 | yes Evaluation Count:1642 |
| 80-1642 |
| 118 | testFormat = QByteArray(); executed: testFormat = QByteArray();Execution Count:80 | 80 |
| 119 | | - |
| 120 | | - |
| 121 | if (suffixPluginIndex != -1) { evaluated: suffixPluginIndex != -1| yes Evaluation Count:268 | yes Evaluation Count:1454 |
| 268-1454 |
| 122 | | - |
| 123 | | - |
| 124 | const qint64 pos = device ? device->pos() : 0; partially evaluated: device| yes Evaluation Count:268 | no Evaluation Count:0 |
| 0-268 |
| 125 | const int index = keyMap.key(QString::fromLatin1(suffix), -1); | - |
| 126 | if (index != -1) { partially evaluated: index != -1| yes Evaluation Count:268 | no Evaluation Count:0 |
| 0-268 |
| 127 | QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(index)); | - |
| 128 | if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { partially evaluated: plugin| yes Evaluation Count:268 | no Evaluation Count:0 |
partially evaluated: plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead| yes Evaluation Count:268 | no Evaluation Count:0 |
| 0-268 |
| 129 | handler = plugin->create(device, testFormat); | - |
| 130 | | - |
| 131 | | - |
| 132 | | - |
| 133 | | - |
| 134 | } executed: }Execution Count:268 | 268 |
| 135 | } executed: }Execution Count:268 | 268 |
| 136 | if (device && !device->isSequential()) partially evaluated: device| yes Evaluation Count:268 | no Evaluation Count:0 |
evaluated: !device->isSequential()| yes Evaluation Count:266 | yes Evaluation Count:2 |
| 0-268 |
| 137 | device->seek(pos); executed: device->seek(pos);Execution Count:266 | 266 |
| 138 | } executed: }Execution Count:268 | 268 |
| 139 | | - |
| 140 | if (!handler && !testFormat.isEmpty() && !ignoresFormatAndExtension) { evaluated: !handler| yes Evaluation Count:1454 | yes Evaluation Count:268 |
evaluated: !testFormat.isEmpty()| yes Evaluation Count:1235 | yes Evaluation Count:219 |
partially evaluated: !ignoresFormatAndExtension| yes Evaluation Count:1235 | no Evaluation Count:0 |
| 0-1454 |
| 141 | | - |
| 142 | | - |
| 143 | const qint64 pos = device ? device->pos() : 0; partially evaluated: device| yes Evaluation Count:1235 | no Evaluation Count:0 |
| 0-1235 |
| 144 | | - |
| 145 | if (autoDetectImageFormat) { evaluated: autoDetectImageFormat| yes Evaluation Count:1233 | yes Evaluation Count:2 |
| 2-1233 |
| 146 | const int keyCount = keyMap.keys().size(); | - |
| 147 | for (int i = 0; i < keyCount; ++i) { evaluated: i < keyCount| yes Evaluation Count:4666 | yes Evaluation Count:1097 |
| 1097-4666 |
| 148 | if (i != suffixPluginIndex) { partially evaluated: i != suffixPluginIndex| yes Evaluation Count:4666 | no Evaluation Count:0 |
| 0-4666 |
| 149 | QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(i)); | - |
| 150 | if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { evaluated: plugin| yes Evaluation Count:3569 | yes Evaluation Count:1097 |
evaluated: plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead| yes Evaluation Count:136 | yes Evaluation Count:3433 |
| 136-3569 |
| 151 | | - |
| 152 | | - |
| 153 | | - |
| 154 | handler = plugin->create(device, testFormat); | - |
| 155 | break; executed: break;Execution Count:136 | 136 |
| 156 | } | - |
| 157 | } executed: }Execution Count:4530 | 4530 |
| 158 | } executed: }Execution Count:4530 | 4530 |
| 159 | } else { executed: }Execution Count:1233 | 1233 |
| 160 | const int testIndex = keyMap.key(QLatin1String(testFormat), -1); | - |
| 161 | if (testIndex != -1) { evaluated: testIndex != -1| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 162 | QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(testIndex)); | - |
| 163 | if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { partially evaluated: plugin| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 164 | | - |
| 165 | | - |
| 166 | | - |
| 167 | handler = plugin->create(device, testFormat); | - |
| 168 | } executed: }Execution Count:1 | 1 |
| 169 | } executed: }Execution Count:1 | 1 |
| 170 | } executed: }Execution Count:2 | 2 |
| 171 | if (device && !device->isSequential()) partially evaluated: device| yes Evaluation Count:1235 | no Evaluation Count:0 |
evaluated: !device->isSequential()| yes Evaluation Count:1234 | yes Evaluation Count:1 |
| 0-1235 |
| 172 | device->seek(pos); executed: device->seek(pos);Execution Count:1234 | 1234 |
| 173 | } executed: }Execution Count:1235 | 1235 |
| 174 | | - |
| 175 | | - |
| 176 | | - |
| 177 | | - |
| 178 | | - |
| 179 | if (!handler && !testFormat.isEmpty()) { evaluated: !handler| yes Evaluation Count:1317 | yes Evaluation Count:405 |
evaluated: !testFormat.isEmpty()| yes Evaluation Count:1098 | yes Evaluation Count:219 |
| 219-1317 |
| 180 | if (false) { partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:1098 |
| 0-1098 |
| 181 | | - |
| 182 | } else if (testFormat == "png") { evaluated: testFormat == "png"| yes Evaluation Count:354 | yes Evaluation Count:744 |
| 0-744 |
| 183 | handler = new QPngHandler; | - |
| 184 | } else if (testFormat == "bmp") { executed: }Execution Count:354 evaluated: testFormat == "bmp"| yes Evaluation Count:308 | yes Evaluation Count:436 |
| 308-436 |
| 185 | handler = new QBmpHandler; | - |
| 186 | } else if (testFormat == "dib") { executed: }Execution Count:308 partially evaluated: testFormat == "dib"| no Evaluation Count:0 | yes Evaluation Count:436 |
| 0-436 |
| 187 | handler = new QBmpHandler(QBmpHandler::DibFormat); | - |
| 188 | | - |
| 189 | | - |
| 190 | } else if (testFormat == "xpm") { evaluated: testFormat == "xpm"| yes Evaluation Count:156 | yes Evaluation Count:280 |
| 0-280 |
| 191 | handler = new QXpmHandler; | - |
| 192 | | - |
| 193 | | - |
| 194 | } else if (testFormat == "xbm") { evaluated: testFormat == "xbm"| yes Evaluation Count:47 | yes Evaluation Count:233 |
executed: }Execution Count:156 | 47-233 |
| 195 | handler = new QXbmHandler; | - |
| 196 | handler->setOption(QImageIOHandler::SubType, testFormat); | - |
| 197 | | - |
| 198 | | - |
| 199 | } else if (testFormat == "pbm" || testFormat == "pbmraw" || testFormat == "pgm" executed: }Execution Count:47 evaluated: testFormat == "pbm"| yes Evaluation Count:27 | yes Evaluation Count:206 |
partially evaluated: testFormat == "pbmraw"| no Evaluation Count:0 | yes Evaluation Count:206 |
evaluated: testFormat == "pgm"| yes Evaluation Count:24 | yes Evaluation Count:182 |
| 0-206 |
| 200 | || testFormat == "pgmraw" || testFormat == "ppm" || testFormat == "ppmraw") { partially evaluated: testFormat == "pgmraw"| no Evaluation Count:0 | yes Evaluation Count:182 |
evaluated: testFormat == "ppm"| yes Evaluation Count:152 | yes Evaluation Count:30 |
partially evaluated: testFormat == "ppmraw"| no Evaluation Count:0 | yes Evaluation Count:30 |
| 0-182 |
| 201 | handler = new QPpmHandler; | - |
| 202 | handler->setOption(QImageIOHandler::SubType, testFormat); | - |
| 203 | | - |
| 204 | } executed: }Execution Count:203 | 203 |
| 205 | | - |
| 206 | | - |
| 207 | | - |
| 208 | | - |
| 209 | | - |
| 210 | } | - |
| 211 | | - |
| 212 | | - |
| 213 | if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) { evaluated: !handler| yes Evaluation Count:249 | yes Evaluation Count:1473 |
partially evaluated: autoDetectImageFormat| yes Evaluation Count:249 | no Evaluation Count:0 |
never evaluated: ignoresFormatAndExtension | 0-1473 |
| 214 | | - |
| 215 | const qint64 pos = device ? device->pos() : 0; partially evaluated: device| yes Evaluation Count:249 | no Evaluation Count:0 |
| 0-249 |
| 216 | const int keyCount = keyMap.keys().size(); | - |
| 217 | for (int i = 0; i < keyCount; ++i) { evaluated: i < keyCount| yes Evaluation Count:920 | yes Evaluation Count:205 |
| 205-920 |
| 218 | if (i != suffixPluginIndex) { partially evaluated: i != suffixPluginIndex| yes Evaluation Count:920 | no Evaluation Count:0 |
| 0-920 |
| 219 | QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(i)); | - |
| 220 | if (plugin && plugin->capabilities(device, QByteArray()) & QImageIOPlugin::CanRead) { evaluated: plugin| yes Evaluation Count:715 | yes Evaluation Count:205 |
evaluated: plugin->capabilities(device, QByteArray()) & QImageIOPlugin::CanRead| yes Evaluation Count:44 | yes Evaluation Count:671 |
| 44-715 |
| 221 | handler = plugin->create(device, testFormat); | - |
| 222 | | - |
| 223 | | - |
| 224 | | - |
| 225 | break; executed: break;Execution Count:44 | 44 |
| 226 | } | - |
| 227 | } executed: }Execution Count:876 | 876 |
| 228 | } executed: }Execution Count:876 | 876 |
| 229 | if (device && !device->isSequential()) partially evaluated: device| yes Evaluation Count:249 | no Evaluation Count:0 |
evaluated: !device->isSequential()| yes Evaluation Count:231 | yes Evaluation Count:18 |
| 0-249 |
| 230 | device->seek(pos); executed: device->seek(pos);Execution Count:231 | 231 |
| 231 | } executed: }Execution Count:249 | 249 |
| 232 | | - |
| 233 | | - |
| 234 | if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) { evaluated: !handler| yes Evaluation Count:205 | yes Evaluation Count:1517 |
partially evaluated: autoDetectImageFormat| yes Evaluation Count:205 | no Evaluation Count:0 |
never evaluated: ignoresFormatAndExtension | 0-1517 |
| 235 | | - |
| 236 | | - |
| 237 | int currentFormat = 0; | - |
| 238 | if (!suffix.isEmpty()) { evaluated: !suffix.isEmpty()| yes Evaluation Count:30 | yes Evaluation Count:175 |
| 30-175 |
| 239 | | - |
| 240 | | - |
| 241 | for (int i = 0; i < _qt_NumFormats; ++i) { evaluated: i < _qt_NumFormats| yes Evaluation Count:210 | yes Evaluation Count:30 |
| 30-210 |
| 242 | if (_qt_BuiltInFormats[i].extension == suffix) { partially evaluated: _qt_BuiltInFormats[i].extension == suffix| no Evaluation Count:0 | yes Evaluation Count:210 |
| 0-210 |
| 243 | currentFormat = i; | - |
| 244 | break; | 0 |
| 245 | } | - |
| 246 | } executed: }Execution Count:210 | 210 |
| 247 | } executed: }Execution Count:30 | 30 |
| 248 | | - |
| 249 | QByteArray subType; | - |
| 250 | int numFormats = _qt_NumFormats; | - |
| 251 | while (device && numFormats >= 0) { partially evaluated: device| yes Evaluation Count:553 | no Evaluation Count:0 |
evaluated: numFormats >= 0| yes Evaluation Count:539 | yes Evaluation Count:14 |
| 0-553 |
| 252 | const _qt_BuiltInFormatStruct *formatStruct = &_qt_BuiltInFormats[currentFormat]; | - |
| 253 | | - |
| 254 | const qint64 pos = device->pos(); | - |
| 255 | switch (formatStruct->type) { | - |
| 256 | | - |
| 257 | case _qt_PngFormat: | - |
| 258 | if (QPngHandler::canRead(device)) evaluated: QPngHandler::canRead(device)| yes Evaluation Count:94 | yes Evaluation Count:125 |
| 94-125 |
| 259 | handler = new QPngHandler; executed: handler = new QPngHandler;Execution Count:94 | 94 |
| 260 | break; executed: break;Execution Count:219 | 219 |
| 261 | case _qt_BmpFormat: | - |
| 262 | if (QBmpHandler::canRead(device)) evaluated: QBmpHandler::canRead(device)| yes Evaluation Count:30 | yes Evaluation Count:81 |
| 30-81 |
| 263 | handler = new QBmpHandler; executed: handler = new QBmpHandler;Execution Count:30 | 30 |
| 264 | break; executed: break;Execution Count:111 | 111 |
| 265 | | - |
| 266 | | - |
| 267 | case _qt_XpmFormat: | - |
| 268 | if (QXpmHandler::canRead(device)) evaluated: QXpmHandler::canRead(device)| yes Evaluation Count:15 | yes Evaluation Count:14 |
| 14-15 |
| 269 | handler = new QXpmHandler; executed: handler = new QXpmHandler;Execution Count:15 | 15 |
| 270 | break; executed: break;Execution Count:29 | 29 |
| 271 | | - |
| 272 | | - |
| 273 | case _qt_PbmFormat: | - |
| 274 | case _qt_PgmFormat: | - |
| 275 | case _qt_PpmFormat: | - |
| 276 | if (QPpmHandler::canRead(device, &subType)) { evaluated: QPpmHandler::canRead(device, &subType)| yes Evaluation Count:48 | yes Evaluation Count:99 |
| 48-99 |
| 277 | handler = new QPpmHandler; | - |
| 278 | handler->setOption(QImageIOHandler::SubType, subType); | - |
| 279 | } executed: }Execution Count:48 | 48 |
| 280 | break; executed: break;Execution Count:147 | 147 |
| 281 | | - |
| 282 | | - |
| 283 | case _qt_XbmFormat: | - |
| 284 | if (QXbmHandler::canRead(device)) evaluated: QXbmHandler::canRead(device)| yes Evaluation Count:4 | yes Evaluation Count:29 |
| 4-29 |
| 285 | handler = new QXbmHandler; executed: handler = new QXbmHandler;Execution Count:4 | 4 |
| 286 | break; executed: break;Execution Count:33 | 33 |
| 287 | | - |
| 288 | default: | - |
| 289 | break; | 0 |
| 290 | } | - |
| 291 | if (!device->isSequential()) evaluated: !device->isSequential()| yes Evaluation Count:505 | yes Evaluation Count:34 |
| 34-505 |
| 292 | device->seek(pos); executed: device->seek(pos);Execution Count:505 | 505 |
| 293 | | - |
| 294 | if (handler) { evaluated: handler| yes Evaluation Count:191 | yes Evaluation Count:348 |
| 191-348 |
| 295 | | - |
| 296 | | - |
| 297 | | - |
| 298 | | - |
| 299 | break; executed: break;Execution Count:191 | 191 |
| 300 | } | - |
| 301 | | - |
| 302 | --numFormats; | - |
| 303 | ++currentFormat; | - |
| 304 | currentFormat %= _qt_NumFormats; | - |
| 305 | } executed: }Execution Count:348 | 348 |
| 306 | } executed: }Execution Count:205 | 205 |
| 307 | | - |
| 308 | if (!handler) { evaluated: !handler| yes Evaluation Count:14 | yes Evaluation Count:1708 |
| 14-1708 |
| 309 | | - |
| 310 | | - |
| 311 | | - |
| 312 | | - |
| 313 | return 0; executed: return 0;Execution Count:14 | 14 |
| 314 | } | - |
| 315 | | - |
| 316 | handler->setDevice(device); | - |
| 317 | if (!form.isEmpty()) evaluated: !form.isEmpty()| yes Evaluation Count:565 | yes Evaluation Count:1143 |
| 565-1143 |
| 318 | handler->setFormat(form); executed: handler->setFormat(form);Execution Count:565 | 565 |
| 319 | return handler; executed: return handler;Execution Count:1708 | 1708 |
| 320 | } | - |
| 321 | | - |
| 322 | class QImageReaderPrivate | - |
| 323 | { | - |
| 324 | public: | - |
| 325 | QImageReaderPrivate(QImageReader *qq); | - |
| 326 | ~QImageReaderPrivate(); | - |
| 327 | | - |
| 328 | | - |
| 329 | QByteArray format; | - |
| 330 | bool autoDetectImageFormat; | - |
| 331 | bool ignoresFormatAndExtension; | - |
| 332 | QIODevice *device; | - |
| 333 | bool deleteDevice; | - |
| 334 | QImageIOHandler *handler; | - |
| 335 | bool initHandler(); | - |
| 336 | | - |
| 337 | | - |
| 338 | QRect clipRect; | - |
| 339 | QSize scaledSize; | - |
| 340 | QRect scaledClipRect; | - |
| 341 | int quality; | - |
| 342 | QMap<QString, QString> text; | - |
| 343 | void getText(); | - |
| 344 | | - |
| 345 | | - |
| 346 | QImageReader::ImageReaderError imageReaderError; | - |
| 347 | QString errorString; | - |
| 348 | | - |
| 349 | QImageReader *q; | - |
| 350 | }; | - |
| 351 | | - |
| 352 | | - |
| 353 | | - |
| 354 | | - |
| 355 | QImageReaderPrivate::QImageReaderPrivate(QImageReader *qq) | - |
| 356 | : autoDetectImageFormat(true), ignoresFormatAndExtension(false) | - |
| 357 | { | - |
| 358 | device = 0; | - |
| 359 | deleteDevice = false; | - |
| 360 | handler = 0; | - |
| 361 | quality = -1; | - |
| 362 | imageReaderError = QImageReader::UnknownError; | - |
| 363 | | - |
| 364 | q = qq; | - |
| 365 | } executed: }Execution Count:1738 | 1738 |
| 366 | | - |
| 367 | | - |
| 368 | | - |
| 369 | | - |
| 370 | QImageReaderPrivate::~QImageReaderPrivate() | - |
| 371 | { | - |
| 372 | if (deleteDevice) evaluated: deleteDevice| yes Evaluation Count:1481 | yes Evaluation Count:257 |
| 257-1481 |
| 373 | delete device; executed: delete device;Execution Count:1481 | 1481 |
| 374 | delete handler; | - |
| 375 | } executed: }Execution Count:1738 | 1738 |
| 376 | | - |
| 377 | | - |
| 378 | | - |
| 379 | | - |
| 380 | bool QImageReaderPrivate::initHandler() | - |
| 381 | { | - |
| 382 | | - |
| 383 | if (!device || (!deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly))) { partially evaluated: !device| no Evaluation Count:0 | yes Evaluation Count:2447 |
evaluated: !deleteDevice| yes Evaluation Count:273 | yes Evaluation Count:2174 |
evaluated: !device->isOpen()| yes Evaluation Count:12 | yes Evaluation Count:261 |
partially evaluated: !device->open(QIODevice::ReadOnly)| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-2447 |
| 384 | imageReaderError = QImageReader::DeviceError; | - |
| 385 | errorString = QLatin1String("Invalid device"); | - |
| 386 | return false; never executed: return false; | 0 |
| 387 | } | - |
| 388 | | - |
| 389 | | - |
| 390 | if (deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly) && autoDetectImageFormat) { evaluated: deleteDevice| yes Evaluation Count:2174 | yes Evaluation Count:273 |
evaluated: !device->isOpen()| yes Evaluation Count:1485 | yes Evaluation Count:689 |
evaluated: !device->open(QIODevice::ReadOnly)| yes Evaluation Count:336 | yes Evaluation Count:1149 |
evaluated: autoDetectImageFormat| yes Evaluation Count:334 | yes Evaluation Count:2 |
| 2-2174 |
| 391 | QList<QByteArray> extensions = QImageReader::supportedImageFormats(); | - |
| 392 | if (!format.isEmpty()) { evaluated: !format.isEmpty()| yes Evaluation Count:174 | yes Evaluation Count:160 |
| 160-174 |
| 393 | | - |
| 394 | int currentFormatIndex = extensions.indexOf(format.toLower()); | - |
| 395 | if (currentFormatIndex > 0) evaluated: currentFormatIndex > 0| yes Evaluation Count:134 | yes Evaluation Count:40 |
| 40-134 |
| 396 | extensions.swap(0, currentFormatIndex); executed: extensions.swap(0, currentFormatIndex);Execution Count:134 | 134 |
| 397 | } executed: }Execution Count:174 | 174 |
| 398 | | - |
| 399 | int currentExtension = 0; | - |
| 400 | | - |
| 401 | QFile *file = static_cast<QFile *>(device); | - |
| 402 | QString fileName = file->fileName(); | - |
| 403 | | - |
| 404 | do { | - |
| 405 | file->setFileName(fileName + QLatin1Char('.') | - |
| 406 | + QString::fromLatin1(extensions.at(currentExtension++).constData())); | - |
| 407 | file->open(QIODevice::ReadOnly); | - |
| 408 | } while (!file->isOpen() && currentExtension < extensions.size()); evaluated: !file->isOpen()| yes Evaluation Count:922 | yes Evaluation Count:290 |
evaluated: currentExtension < extensions.size()| yes Evaluation Count:878 | yes Evaluation Count:44 |
executed: }Execution Count:1212 | 44-1212 |
| 409 | | - |
| 410 | if (!device->isOpen()) { evaluated: !device->isOpen()| yes Evaluation Count:44 | yes Evaluation Count:290 |
| 44-290 |
| 411 | imageReaderError = QImageReader::FileNotFoundError; | - |
| 412 | errorString = QLatin1String("File not found"); | - |
| 413 | file->setFileName(fileName); | - |
| 414 | return false; executed: return false;Execution Count:44 | 44 |
| 415 | } | - |
| 416 | } executed: }Execution Count:290 | 290 |
| 417 | | - |
| 418 | | - |
| 419 | if (!handler && (handler = createReadHandlerHelper(device, format, autoDetectImageFormat, ignoresFormatAndExtension)) == 0) { evaluated: !handler| yes Evaluation Count:1701 | yes Evaluation Count:702 |
evaluated: (handler = createReadHandlerHelper(device, format, autoDetectImageFormat, ignoresFormatAndExtension)) == 0| yes Evaluation Count:22 | yes Evaluation Count:1679 |
| 22-1701 |
| 420 | imageReaderError = QImageReader::UnsupportedFormatError; | - |
| 421 | errorString = QLatin1String("Unsupported image format"); | - |
| 422 | return false; executed: return false;Execution Count:22 | 22 |
| 423 | } | - |
| 424 | return true; executed: return true;Execution Count:2381 | 2381 |
| 425 | } | - |
| 426 | | - |
| 427 | | - |
| 428 | | - |
| 429 | | - |
| 430 | void QImageReaderPrivate::getText() | - |
| 431 | { | - |
| 432 | if (!text.isEmpty() || (!handler && !initHandler()) || !handler->supportsOption(QImageIOHandler::Description)) evaluated: !text.isEmpty()| yes Evaluation Count:24 | yes Evaluation Count:12 |
partially evaluated: !handler| yes Evaluation Count:12 | no Evaluation Count:0 |
partially evaluated: !initHandler()| no Evaluation Count:0 | yes Evaluation Count:12 |
partially evaluated: !handler->supportsOption(QImageIOHandler::Description)| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-24 |
| 433 | return; executed: return;Execution Count:24 | 24 |
| 434 | for (QForeachContainer<__typeof__(handler->option(QImageIOHandler::Description).toString().split( QLatin1String("\n\n")))> _container_(handler->option(QImageIOHandler::Description).toString().split( QLatin1String("\n\n"))); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &pair = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 435 | | - |
| 436 | int index = pair.indexOf(QLatin1Char(':')); | - |
| 437 | if (index >= 0 && pair.indexOf(QLatin1Char(' ')) < index) { partially evaluated: index >= 0| yes Evaluation Count:66 | no Evaluation Count:0 |
partially evaluated: pair.indexOf(QLatin1Char(' ')) < index| no Evaluation Count:0 | yes Evaluation Count:66 |
| 0-66 |
| 438 | text.insert(QLatin1String("Description"), pair.simplified()); | - |
| 439 | } else { | 0 |
| 440 | QString key = pair.left(index); | - |
| 441 | text.insert(key, pair.mid(index + 2).simplified()); | - |
| 442 | } executed: }Execution Count:66 | 66 |
| 443 | } | - |
| 444 | } executed: }Execution Count:12 | 12 |
| 445 | | - |
| 446 | | - |
| 447 | | - |
| 448 | | - |
| 449 | | - |
| 450 | QImageReader::QImageReader() | - |
| 451 | : d(new QImageReaderPrivate(this)) | - |
| 452 | { | - |
| 453 | } executed: }Execution Count:87 | 87 |
| 454 | | - |
| 455 | | - |
| 456 | | - |
| 457 | | - |
| 458 | | - |
| 459 | QImageReader::QImageReader(QIODevice *device, const QByteArray &format) | - |
| 460 | : d(new QImageReaderPrivate(this)) | - |
| 461 | { | - |
| 462 | d->device = device; | - |
| 463 | d->format = format; | - |
| 464 | } executed: }Execution Count:252 | 252 |
| 465 | | - |
| 466 | | - |
| 467 | | - |
| 468 | | - |
| 469 | | - |
| 470 | | - |
| 471 | | - |
| 472 | QImageReader::QImageReader(const QString &fileName, const QByteArray &format) | - |
| 473 | : d(new QImageReaderPrivate(this)) | - |
| 474 | { | - |
| 475 | QFile *file = new QFile(fileName); | - |
| 476 | d->device = file; | - |
| 477 | d->deleteDevice = true; | - |
| 478 | d->format = format; | - |
| 479 | } executed: }Execution Count:1399 | 1399 |
| 480 | | - |
| 481 | | - |
| 482 | | - |
| 483 | | - |
| 484 | QImageReader::~QImageReader() | - |
| 485 | { | - |
| 486 | delete d; | - |
| 487 | } executed: }Execution Count:1738 | 1738 |
| 488 | void QImageReader::setFormat(const QByteArray &format) | - |
| 489 | { | - |
| 490 | d->format = format; | - |
| 491 | } | 0 |
| 492 | QByteArray QImageReader::format() const | - |
| 493 | { | - |
| 494 | if (d->format.isEmpty()) { evaluated: d->format.isEmpty()| yes Evaluation Count:190 | yes Evaluation Count:45 |
| 45-190 |
| 495 | if (!d->initHandler()) evaluated: !d->initHandler()| yes Evaluation Count:4 | yes Evaluation Count:186 |
| 4-186 |
| 496 | return QByteArray(); executed: return QByteArray();Execution Count:4 | 4 |
| 497 | return d->handler->canRead() ? d->handler->format() : QByteArray(); executed: return d->handler->canRead() ? d->handler->format() : QByteArray();Execution Count:186 | 186 |
| 498 | } | - |
| 499 | | - |
| 500 | return d->format; executed: return d->format;Execution Count:45 | 45 |
| 501 | } | - |
| 502 | void QImageReader::setAutoDetectImageFormat(bool enabled) | - |
| 503 | { | - |
| 504 | d->autoDetectImageFormat = enabled; | - |
| 505 | } executed: }Execution Count:10 | 10 |
| 506 | | - |
| 507 | | - |
| 508 | | - |
| 509 | | - |
| 510 | | - |
| 511 | | - |
| 512 | | - |
| 513 | bool QImageReader::autoDetectImageFormat() const | - |
| 514 | { | - |
| 515 | return d->autoDetectImageFormat; never executed: return d->autoDetectImageFormat; | 0 |
| 516 | } | - |
| 517 | void QImageReader::setDecideFormatFromContent(bool ignored) | - |
| 518 | { | - |
| 519 | d->ignoresFormatAndExtension = ignored; | - |
| 520 | } executed: }Execution Count:80 | 80 |
| 521 | bool QImageReader::decideFormatFromContent() const | - |
| 522 | { | - |
| 523 | return d->ignoresFormatAndExtension; never executed: return d->ignoresFormatAndExtension; | 0 |
| 524 | } | - |
| 525 | void QImageReader::setDevice(QIODevice *device) | - |
| 526 | { | - |
| 527 | if (d->device && d->deleteDevice) evaluated: d->device| yes Evaluation Count:4 | yes Evaluation Count:84 |
evaluated: d->deleteDevice| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2-84 |
| 528 | delete d->device; executed: delete d->device;Execution Count:2 | 2 |
| 529 | d->device = device; | - |
| 530 | d->deleteDevice = false; | - |
| 531 | delete d->handler; | - |
| 532 | d->handler = 0; | - |
| 533 | d->text.clear(); | - |
| 534 | } executed: }Execution Count:88 | 88 |
| 535 | | - |
| 536 | | - |
| 537 | | - |
| 538 | | - |
| 539 | | - |
| 540 | QIODevice *QImageReader::device() const | - |
| 541 | { | - |
| 542 | return d->device; executed: return d->device;Execution Count:47 | 47 |
| 543 | } | - |
| 544 | void QImageReader::setFileName(const QString &fileName) | - |
| 545 | { | - |
| 546 | setDevice(new QFile(fileName)); | - |
| 547 | d->deleteDevice = true; | - |
| 548 | } executed: }Execution Count:84 | 84 |
| 549 | QString QImageReader::fileName() const | - |
| 550 | { | - |
| 551 | QFile *file = qobject_cast<QFile *>(d->device); | - |
| 552 | return file ? file->fileName() : QString(); executed: return file ? file->fileName() : QString();Execution Count:1692 | 1692 |
| 553 | } | - |
| 554 | void QImageReader::setQuality(int quality) | - |
| 555 | { | - |
| 556 | d->quality = quality; | - |
| 557 | } executed: }Execution Count:19 | 19 |
| 558 | int QImageReader::quality() const | - |
| 559 | { | - |
| 560 | return d->quality; never executed: return d->quality; | 0 |
| 561 | } | - |
| 562 | QSize QImageReader::size() const | - |
| 563 | { | - |
| 564 | if (!d->initHandler()) evaluated: !d->initHandler()| yes Evaluation Count:3 | yes Evaluation Count:59 |
| 3-59 |
| 565 | return QSize(); executed: return QSize();Execution Count:3 | 3 |
| 566 | | - |
| 567 | if (d->handler->supportsOption(QImageIOHandler::Size)) partially evaluated: d->handler->supportsOption(QImageIOHandler::Size)| yes Evaluation Count:59 | no Evaluation Count:0 |
| 0-59 |
| 568 | return d->handler->option(QImageIOHandler::Size).toSize(); executed: return d->handler->option(QImageIOHandler::Size).toSize();Execution Count:59 | 59 |
| 569 | | - |
| 570 | return QSize(); never executed: return QSize(); | 0 |
| 571 | } | - |
| 572 | QImage::Format QImageReader::imageFormat() const | - |
| 573 | { | - |
| 574 | if (!d->initHandler()) partially evaluated: !d->initHandler()| no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
| 575 | return QImage::Format_Invalid; never executed: return QImage::Format_Invalid; | 0 |
| 576 | | - |
| 577 | if (d->handler->supportsOption(QImageIOHandler::ImageFormat)) evaluated: d->handler->supportsOption(QImageIOHandler::ImageFormat)| yes Evaluation Count:17 | yes Evaluation Count:2 |
| 2-17 |
| 578 | return (QImage::Format)d->handler->option(QImageIOHandler::ImageFormat).toInt(); executed: return (QImage::Format)d->handler->option(QImageIOHandler::ImageFormat).toInt();Execution Count:17 | 17 |
| 579 | | - |
| 580 | return QImage::Format_Invalid; executed: return QImage::Format_Invalid;Execution Count:2 | 2 |
| 581 | } | - |
| 582 | QStringList QImageReader::textKeys() const | - |
| 583 | { | - |
| 584 | d->getText(); | - |
| 585 | return d->text.keys(); never executed: return d->text.keys(); | 0 |
| 586 | } | - |
| 587 | QString QImageReader::text(const QString &key) const | - |
| 588 | { | - |
| 589 | d->getText(); | - |
| 590 | return d->text.value(key); executed: return d->text.value(key);Execution Count:36 | 36 |
| 591 | } | - |
| 592 | void QImageReader::setClipRect(const QRect &rect) | - |
| 593 | { | - |
| 594 | d->clipRect = rect; | - |
| 595 | } executed: }Execution Count:14 | 14 |
| 596 | QRect QImageReader::clipRect() const | - |
| 597 | { | - |
| 598 | return d->clipRect; never executed: return d->clipRect; | 0 |
| 599 | } | - |
| 600 | void QImageReader::setScaledSize(const QSize &size) | - |
| 601 | { | - |
| 602 | d->scaledSize = size; | - |
| 603 | } executed: }Execution Count:71 | 71 |
| 604 | | - |
| 605 | | - |
| 606 | | - |
| 607 | | - |
| 608 | | - |
| 609 | | - |
| 610 | QSize QImageReader::scaledSize() const | - |
| 611 | { | - |
| 612 | return d->scaledSize; executed: return d->scaledSize;Execution Count:141 | 141 |
| 613 | } | - |
| 614 | void QImageReader::setScaledClipRect(const QRect &rect) | - |
| 615 | { | - |
| 616 | d->scaledClipRect = rect; | - |
| 617 | } executed: }Execution Count:13 | 13 |
| 618 | | - |
| 619 | | - |
| 620 | | - |
| 621 | | - |
| 622 | | - |
| 623 | | - |
| 624 | QRect QImageReader::scaledClipRect() const | - |
| 625 | { | - |
| 626 | return d->scaledClipRect; never executed: return d->scaledClipRect; | 0 |
| 627 | } | - |
| 628 | void QImageReader::setBackgroundColor(const QColor &color) | - |
| 629 | { | - |
| 630 | if (!d->initHandler()) evaluated: !d->initHandler()| yes Evaluation Count:2 | yes Evaluation Count:19 |
| 2-19 |
| 631 | return; executed: return;Execution Count:2 | 2 |
| 632 | if (d->handler->supportsOption(QImageIOHandler::BackgroundColor)) partially evaluated: d->handler->supportsOption(QImageIOHandler::BackgroundColor)| no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
| 633 | d->handler->setOption(QImageIOHandler::BackgroundColor, color); never executed: d->handler->setOption(QImageIOHandler::BackgroundColor, color); | 0 |
| 634 | } executed: }Execution Count:19 | 19 |
| 635 | QColor QImageReader::backgroundColor() const | - |
| 636 | { | - |
| 637 | if (!d->initHandler()) evaluated: !d->initHandler()| yes Evaluation Count:2 | yes Evaluation Count:19 |
| 2-19 |
| 638 | return QColor(); executed: return QColor();Execution Count:2 | 2 |
| 639 | if (d->handler->supportsOption(QImageIOHandler::BackgroundColor)) partially evaluated: d->handler->supportsOption(QImageIOHandler::BackgroundColor)| no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
| 640 | return qvariant_cast<QColor>(d->handler->option(QImageIOHandler::BackgroundColor)); never executed: return qvariant_cast<QColor>(d->handler->option(QImageIOHandler::BackgroundColor)); | 0 |
| 641 | return QColor(); executed: return QColor();Execution Count:19 | 19 |
| 642 | } | - |
| 643 | bool QImageReader::supportsAnimation() const | - |
| 644 | { | - |
| 645 | if (!d->initHandler()) evaluated: !d->initHandler()| yes Evaluation Count:2 | yes Evaluation Count:53 |
| 2-53 |
| 646 | return false; executed: return false;Execution Count:2 | 2 |
| 647 | if (d->handler->supportsOption(QImageIOHandler::Animation)) evaluated: d->handler->supportsOption(QImageIOHandler::Animation)| yes Evaluation Count:6 | yes Evaluation Count:47 |
| 6-47 |
| 648 | return d->handler->option(QImageIOHandler::Animation).toBool(); executed: return d->handler->option(QImageIOHandler::Animation).toBool();Execution Count:6 | 6 |
| 649 | return false; executed: return false;Execution Count:47 | 47 |
| 650 | } | - |
| 651 | bool QImageReader::canRead() const | - |
| 652 | { | - |
| 653 | if (!d->initHandler()) evaluated: !d->initHandler()| yes Evaluation Count:3 | yes Evaluation Count:393 |
| 3-393 |
| 654 | return false; executed: return false;Execution Count:3 | 3 |
| 655 | | - |
| 656 | return d->handler->canRead(); executed: return d->handler->canRead();Execution Count:393 | 393 |
| 657 | } | - |
| 658 | QImage QImageReader::read() | - |
| 659 | { | - |
| 660 | | - |
| 661 | | - |
| 662 | QImage image; | - |
| 663 | return read(&image) ? image : QImage(); executed: return read(&image) ? image : QImage();Execution Count:1663 | 1663 |
| 664 | } | - |
| 665 | bool QImageReader::read(QImage *image) | - |
| 666 | { | - |
| 667 | if (!image) { partially evaluated: !image| no Evaluation Count:0 | yes Evaluation Count:1848 |
| 0-1848 |
| 668 | QMessageLogger("image/qimagereader.cpp", 1168, __PRETTY_FUNCTION__).warning("QImageReader::read: cannot read into null pointer"); | - |
| 669 | return false; never executed: return false; | 0 |
| 670 | } | - |
| 671 | | - |
| 672 | if (!d->handler && !d->initHandler()) evaluated: !d->handler| yes Evaluation Count:1286 | yes Evaluation Count:562 |
evaluated: !d->initHandler()| yes Evaluation Count:30 | yes Evaluation Count:1256 |
| 30-1286 |
| 673 | return false; executed: return false;Execution Count:30 | 30 |
| 674 | | - |
| 675 | | - |
| 676 | if (d->handler->supportsOption(QImageIOHandler::ScaledSize) && d->scaledSize.isValid()) { evaluated: d->handler->supportsOption(QImageIOHandler::ScaledSize)| yes Evaluation Count:626 | yes Evaluation Count:1192 |
evaluated: d->scaledSize.isValid()| yes Evaluation Count:24 | yes Evaluation Count:602 |
| 24-1192 |
| 677 | if ((d->handler->supportsOption(QImageIOHandler::ClipRect) && !d->clipRect.isNull()) evaluated: d->handler->supportsOption(QImageIOHandler::ClipRect)| yes Evaluation Count:20 | yes Evaluation Count:4 |
partially evaluated: !d->clipRect.isNull()| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 678 | || d->clipRect.isNull()) { partially evaluated: d->clipRect.isNull()| yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-24 |
| 679 | | - |
| 680 | | - |
| 681 | d->handler->setOption(QImageIOHandler::ScaledSize, d->scaledSize); | - |
| 682 | } executed: }Execution Count:24 | 24 |
| 683 | } executed: }Execution Count:24 | 24 |
| 684 | if (d->handler->supportsOption(QImageIOHandler::ClipRect) && !d->clipRect.isNull()) evaluated: d->handler->supportsOption(QImageIOHandler::ClipRect)| yes Evaluation Count:194 | yes Evaluation Count:1624 |
evaluated: !d->clipRect.isNull()| yes Evaluation Count:1 | yes Evaluation Count:193 |
| 1-1624 |
| 685 | d->handler->setOption(QImageIOHandler::ClipRect, d->clipRect); executed: d->handler->setOption(QImageIOHandler::ClipRect, d->clipRect);Execution Count:1 | 1 |
| 686 | if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull()) evaluated: d->handler->supportsOption(QImageIOHandler::ScaledClipRect)| yes Evaluation Count:194 | yes Evaluation Count:1624 |
evaluated: !d->scaledClipRect.isNull()| yes Evaluation Count:1 | yes Evaluation Count:193 |
| 1-1624 |
| 687 | d->handler->setOption(QImageIOHandler::ScaledClipRect, d->scaledClipRect); executed: d->handler->setOption(QImageIOHandler::ScaledClipRect, d->scaledClipRect);Execution Count:1 | 1 |
| 688 | if (d->handler->supportsOption(QImageIOHandler::Quality)) evaluated: d->handler->supportsOption(QImageIOHandler::Quality)| yes Evaluation Count:626 | yes Evaluation Count:1192 |
| 626-1192 |
| 689 | d->handler->setOption(QImageIOHandler::Quality, d->quality); executed: d->handler->setOption(QImageIOHandler::Quality, d->quality);Execution Count:626 | 626 |
| 690 | | - |
| 691 | | - |
| 692 | if (!d->handler->read(image)) { evaluated: !d->handler->read(image)| yes Evaluation Count:137 | yes Evaluation Count:1681 |
| 137-1681 |
| 693 | d->imageReaderError = InvalidDataError; | - |
| 694 | d->errorString = QLatin1String("Unable to read image data"); | - |
| 695 | return false; executed: return false;Execution Count:137 | 137 |
| 696 | } | - |
| 697 | | - |
| 698 | | - |
| 699 | | - |
| 700 | if (d->handler->supportsOption(QImageIOHandler::ClipRect) && !d->clipRect.isNull()) { evaluated: d->handler->supportsOption(QImageIOHandler::ClipRect)| yes Evaluation Count:168 | yes Evaluation Count:1513 |
evaluated: !d->clipRect.isNull()| yes Evaluation Count:1 | yes Evaluation Count:167 |
| 1-1513 |
| 701 | if (d->handler->supportsOption(QImageIOHandler::ScaledSize) && d->scaledSize.isValid()) { partially evaluated: d->handler->supportsOption(QImageIOHandler::ScaledSize)| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: d->scaledSize.isValid()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 702 | if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull()) { never evaluated: d->handler->supportsOption(QImageIOHandler::ScaledClipRect) never evaluated: !d->scaledClipRect.isNull() | 0 |
| 703 | | - |
| 704 | } else { | 0 |
| 705 | | - |
| 706 | if (!d->scaledClipRect.isNull()) never evaluated: !d->scaledClipRect.isNull() | 0 |
| 707 | *image = image->copy(d->scaledClipRect); never executed: *image = image->copy(d->scaledClipRect); | 0 |
| 708 | } | 0 |
| 709 | } else { | - |
| 710 | if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull()) { partially evaluated: d->handler->supportsOption(QImageIOHandler::ScaledClipRect)| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: !d->scaledClipRect.isNull()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 711 | | - |
| 712 | | - |
| 713 | } else { | 0 |
| 714 | if (d->scaledSize.isValid()) { partially evaluated: d->scaledSize.isValid()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 715 | *image = image->scaled(d->scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); | - |
| 716 | } | 0 |
| 717 | if (d->scaledClipRect.isValid()) { partially evaluated: d->scaledClipRect.isValid()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 718 | *image = image->copy(d->scaledClipRect); | - |
| 719 | } | 0 |
| 720 | } executed: }Execution Count:1 | 1 |
| 721 | } | - |
| 722 | } else { | - |
| 723 | if (d->handler->supportsOption(QImageIOHandler::ScaledSize) && d->scaledSize.isValid() && d->clipRect.isNull()) { evaluated: d->handler->supportsOption(QImageIOHandler::ScaledSize)| yes Evaluation Count:584 | yes Evaluation Count:1096 |
evaluated: d->scaledSize.isValid()| yes Evaluation Count:15 | yes Evaluation Count:569 |
partially evaluated: d->clipRect.isNull()| yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-1096 |
| 724 | if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull()) { evaluated: d->handler->supportsOption(QImageIOHandler::ScaledClipRect)| yes Evaluation Count:11 | yes Evaluation Count:4 |
evaluated: !d->scaledClipRect.isNull()| yes Evaluation Count:1 | yes Evaluation Count:10 |
| 1-11 |
| 725 | | - |
| 726 | } else { executed: }Execution Count:1 | 1 |
| 727 | | - |
| 728 | if (d->scaledClipRect.isValid()) { evaluated: d->scaledClipRect.isValid()| yes Evaluation Count:1 | yes Evaluation Count:13 |
| 1-13 |
| 729 | *image = image->copy(d->scaledClipRect); | - |
| 730 | } executed: }Execution Count:1 | 1 |
| 731 | } executed: }Execution Count:14 | 14 |
| 732 | } else { | - |
| 733 | if (d->handler->supportsOption(QImageIOHandler::ScaledClipRect) && !d->scaledClipRect.isNull()) { evaluated: d->handler->supportsOption(QImageIOHandler::ScaledClipRect)| yes Evaluation Count:156 | yes Evaluation Count:1509 |
partially evaluated: !d->scaledClipRect.isNull()| no Evaluation Count:0 | yes Evaluation Count:156 |
| 0-1509 |
| 734 | | - |
| 735 | | - |
| 736 | | - |
| 737 | } else { | 0 |
| 738 | | - |
| 739 | if (d->clipRect.isValid()) evaluated: d->clipRect.isValid()| yes Evaluation Count:13 | yes Evaluation Count:1652 |
| 13-1652 |
| 740 | *image = image->copy(d->clipRect); executed: *image = image->copy(d->clipRect);Execution Count:13 | 13 |
| 741 | if (d->scaledSize.isValid()) evaluated: d->scaledSize.isValid()| yes Evaluation Count:40 | yes Evaluation Count:1625 |
| 40-1625 |
| 742 | *image = image->scaled(d->scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); executed: *image = image->scaled(d->scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);Execution Count:40 | 40 |
| 743 | if (d->scaledClipRect.isValid()) evaluated: d->scaledClipRect.isValid()| yes Evaluation Count:11 | yes Evaluation Count:1654 |
| 11-1654 |
| 744 | *image = image->copy(d->scaledClipRect); executed: *image = image->copy(d->scaledClipRect);Execution Count:11 | 11 |
| 745 | } executed: }Execution Count:1665 | 1665 |
| 746 | } | - |
| 747 | } | - |
| 748 | | - |
| 749 | | - |
| 750 | if (QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) { partially evaluated: QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))| no Evaluation Count:0 | yes Evaluation Count:1681 |
| 0-1681 |
| 751 | image->setDevicePixelRatio(2.0); | - |
| 752 | } | 0 |
| 753 | | - |
| 754 | return true; executed: return true;Execution Count:1681 | 1681 |
| 755 | } | - |
| 756 | bool QImageReader::jumpToNextImage() | - |
| 757 | { | - |
| 758 | if (!d->initHandler()) partially evaluated: !d->initHandler()| no Evaluation Count:0 | yes Evaluation Count:42 |
| 0-42 |
| 759 | return false; never executed: return false; | 0 |
| 760 | return d->handler->jumpToNextImage(); executed: return d->handler->jumpToNextImage();Execution Count:42 | 42 |
| 761 | } | - |
| 762 | bool QImageReader::jumpToImage(int imageNumber) | - |
| 763 | { | - |
| 764 | if (!d->initHandler()) partially evaluated: !d->initHandler()| no Evaluation Count:0 | yes Evaluation Count:60 |
| 0-60 |
| 765 | return false; never executed: return false; | 0 |
| 766 | return d->handler->jumpToImage(imageNumber); executed: return d->handler->jumpToImage(imageNumber);Execution Count:60 | 60 |
| 767 | } | - |
| 768 | int QImageReader::loopCount() const | - |
| 769 | { | - |
| 770 | if (!d->initHandler()) partially evaluated: !d->initHandler()| no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
| 771 | return -1; never executed: return -1; | 0 |
| 772 | return d->handler->loopCount(); executed: return d->handler->loopCount();Execution Count:11 | 11 |
| 773 | } | - |
| 774 | int QImageReader::imageCount() const | - |
| 775 | { | - |
| 776 | if (!d->initHandler()) evaluated: !d->initHandler()| yes Evaluation Count:1 | yes Evaluation Count:61 |
| 1-61 |
| 777 | return -1; executed: return -1;Execution Count:1 | 1 |
| 778 | return d->handler->imageCount(); executed: return d->handler->imageCount();Execution Count:61 | 61 |
| 779 | } | - |
| 780 | int QImageReader::nextImageDelay() const | - |
| 781 | { | - |
| 782 | if (!d->initHandler()) partially evaluated: !d->initHandler()| no Evaluation Count:0 | yes Evaluation Count:177 |
| 0-177 |
| 783 | return -1; never executed: return -1; | 0 |
| 784 | return d->handler->nextImageDelay(); executed: return d->handler->nextImageDelay();Execution Count:177 | 177 |
| 785 | } | - |
| 786 | int QImageReader::currentImageNumber() const | - |
| 787 | { | - |
| 788 | if (!d->initHandler()) never evaluated: !d->initHandler() | 0 |
| 789 | return -1; never executed: return -1; | 0 |
| 790 | return d->handler->currentImageNumber(); never executed: return d->handler->currentImageNumber(); | 0 |
| 791 | } | - |
| 792 | | - |
| 793 | | - |
| 794 | | - |
| 795 | | - |
| 796 | | - |
| 797 | | - |
| 798 | | - |
| 799 | QRect QImageReader::currentImageRect() const | - |
| 800 | { | - |
| 801 | if (!d->initHandler()) never evaluated: !d->initHandler() | 0 |
| 802 | return QRect(); never executed: return QRect(); | 0 |
| 803 | return d->handler->currentImageRect(); never executed: return d->handler->currentImageRect(); | 0 |
| 804 | } | - |
| 805 | | - |
| 806 | | - |
| 807 | | - |
| 808 | | - |
| 809 | | - |
| 810 | | - |
| 811 | QImageReader::ImageReaderError QImageReader::error() const | - |
| 812 | { | - |
| 813 | return d->imageReaderError; never executed: return d->imageReaderError; | 0 |
| 814 | } | - |
| 815 | | - |
| 816 | | - |
| 817 | | - |
| 818 | | - |
| 819 | | - |
| 820 | | - |
| 821 | | - |
| 822 | QString QImageReader::errorString() const | - |
| 823 | { | - |
| 824 | if (d->errorString.isEmpty()) partially evaluated: d->errorString.isEmpty()| yes Evaluation Count:240 | no Evaluation Count:0 |
| 0-240 |
| 825 | return QLatin1String("Unknown error"); executed: return QLatin1String("Unknown error");Execution Count:240 | 240 |
| 826 | return d->errorString; never executed: return d->errorString; | 0 |
| 827 | } | - |
| 828 | bool QImageReader::supportsOption(QImageIOHandler::ImageOption option) const | - |
| 829 | { | - |
| 830 | if (!d->initHandler()) evaluated: !d->initHandler()| yes Evaluation Count:19 | yes Evaluation Count:14 |
| 14-19 |
| 831 | return false; executed: return false;Execution Count:19 | 19 |
| 832 | return d->handler->supportsOption(option); executed: return d->handler->supportsOption(option);Execution Count:14 | 14 |
| 833 | } | - |
| 834 | | - |
| 835 | | - |
| 836 | | - |
| 837 | | - |
| 838 | | - |
| 839 | QByteArray QImageReader::imageFormat(const QString &fileName) | - |
| 840 | { | - |
| 841 | QFile file(fileName); | - |
| 842 | if (!file.open(QFile::ReadOnly)) partially evaluated: !file.open(QFile::ReadOnly)| no Evaluation Count:0 | yes Evaluation Count:29 |
| 0-29 |
| 843 | return QByteArray(); never executed: return QByteArray(); | 0 |
| 844 | | - |
| 845 | return imageFormat(&file); executed: return imageFormat(&file);Execution Count:29 | 29 |
| 846 | } | - |
| 847 | | - |
| 848 | | - |
| 849 | | - |
| 850 | | - |
| 851 | | - |
| 852 | | - |
| 853 | | - |
| 854 | QByteArray QImageReader::imageFormat(QIODevice *device) | - |
| 855 | { | - |
| 856 | QByteArray format; | - |
| 857 | QImageIOHandler *handler = createReadHandlerHelper(device, format, true, false); | - |
| 858 | if (handler) { partially evaluated: handler| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
| 859 | if (handler->canRead()) partially evaluated: handler->canRead()| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
| 860 | format = handler->format(); executed: format = handler->format();Execution Count:29 | 29 |
| 861 | delete handler; | - |
| 862 | } executed: }Execution Count:29 | 29 |
| 863 | return format; executed: return format;Execution Count:29 | 29 |
| 864 | } | - |
| 865 | | - |
| 866 | | - |
| 867 | void supportedImageHandlerFormats(QFactoryLoader *loader, | - |
| 868 | QImageIOPlugin::Capability cap, | - |
| 869 | QSet<QByteArray> *result); | - |
| 870 | QList<QByteArray> QImageReader::supportedImageFormats() | - |
| 871 | { | - |
| 872 | QSet<QByteArray> formats; | - |
| 873 | for (int i = 0; i < _qt_NumFormats; ++i) evaluated: i < _qt_NumFormats| yes Evaluation Count:4676 | yes Evaluation Count:668 |
| 668-4676 |
| 874 | formats << _qt_BuiltInFormats[i].extension; executed: formats << _qt_BuiltInFormats[i].extension;Execution Count:4676 | 4676 |
| 875 | | - |
| 876 | | - |
| 877 | supportedImageHandlerFormats(loader(), QImageIOPlugin::CanRead, &formats); | - |
| 878 | | - |
| 879 | | - |
| 880 | QList<QByteArray> sortedFormats; | - |
| 881 | for (QSet<QByteArray>::ConstIterator it = formats.constBegin(); it != formats.constEnd(); ++it) evaluated: it != formats.constEnd()| yes Evaluation Count:7348 | yes Evaluation Count:668 |
| 668-7348 |
| 882 | sortedFormats << *it; executed: sortedFormats << *it;Execution Count:7348 | 7348 |
| 883 | | - |
| 884 | qSort(sortedFormats); | - |
| 885 | return sortedFormats; executed: return sortedFormats;Execution Count:668 | 668 |
| 886 | } | - |
| 887 | | - |
| 888 | | - |
| 889 | | - |
| | |