src/gui/image/qimagereader.cpp
branchRCL_3
changeset 8 3f74d0d4af4c
parent 4 3b1da2848fc7
equal deleted inserted replaced
6:dee5afe5301f 8:3f74d0d4af4c
   261         }
   261         }
   262         if (device && !device->isSequential())
   262         if (device && !device->isSequential())
   263             device->seek(pos);
   263             device->seek(pos);
   264     }
   264     }
   265 
   265 
   266     if (!handler && !testFormat.isEmpty() && autoDetectImageFormat && !ignoresFormatAndExtension) {
   266     if (!handler && !testFormat.isEmpty() && !ignoresFormatAndExtension) {
   267         // check if any plugin supports the format (they are not allowed to
   267         // check if any plugin supports the format (they are not allowed to
   268         // read from the device yet).
   268         // read from the device yet).
   269         const qint64 pos = device ? device->pos() : 0;
   269         const qint64 pos = device ? device->pos() : 0;
   270         for (int i = 0; i < keys.size(); ++i) {
   270 
   271             if (i != suffixPluginIndex) {
   271         if (autoDetectImageFormat) {
   272                 QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i)));
   272             for (int i = 0; i < keys.size(); ++i) {
   273                 if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) {
   273                 if (i != suffixPluginIndex) {
       
   274                     QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i)));
       
   275                     if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) {
   274 #ifdef QIMAGEREADER_DEBUG
   276 #ifdef QIMAGEREADER_DEBUG
   275                     qDebug() << "QImageReader::createReadHandler: the" << keys.at(i) << "plugin can read this format";
   277                         qDebug() << "QImageReader::createReadHandler: the" << keys.at(i) << "plugin can read this format";
   276 #endif
   278 #endif
   277                     handler = plugin->create(device, testFormat);
   279                         handler = plugin->create(device, testFormat);
   278                     break;
   280                         break;
       
   281                     }
   279                 }
   282                 }
       
   283             }
       
   284         } else {
       
   285             QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(QLatin1String(testFormat)));
       
   286             if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) {
       
   287 #ifdef QIMAGEREADER_DEBUG
       
   288                 qDebug() << "QImageReader::createReadHandler: the" << testFormat << "plugin can read this format";
       
   289 #endif
       
   290                 handler = plugin->create(device, testFormat);
   280             }
   291             }
   281         }
   292         }
   282         if (device && !device->isSequential())
   293         if (device && !device->isSequential())
   283             device->seek(pos);
   294             device->seek(pos);
   284     }
   295     }
       
   296 
   285 #endif // QT_NO_LIBRARY
   297 #endif // QT_NO_LIBRARY
   286 
   298 
   287     // if we don't have a handler yet, check if we have built-in support for
   299     // if we don't have a handler yet, check if we have built-in support for
   288     // the format
   300     // the format
   289     if (!handler && !testFormat.isEmpty()) {
   301     if (!handler && !testFormat.isEmpty()) {