Changeset 846 for trunk/src/gui/image/qimagereader.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/image/qimagereader.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 142 142 #include <private/qpnghandler_p.h> 143 143 #endif 144 #ifndef QT_NO_IMAGEFORMAT_JPEG 145 #include <private/qjpeghandler_p.h> 146 #endif 147 #ifndef QT_NO_IMAGEFORMAT_MNG 148 #include <private/qmnghandler_p.h> 149 #endif 150 #ifndef QT_NO_IMAGEFORMAT_TIFF 151 #include <private/qtiffhandler_p.h> 152 #endif 153 #ifdef QT_BUILTIN_GIF_READER 154 #include <private/qgifhandler_p.h> 155 #endif 144 156 145 157 QT_BEGIN_NAMESPACE 146 158 147 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)159 #ifndef QT_NO_LIBRARY 148 160 Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, 149 161 (QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats"))) … … 153 165 #ifndef QT_NO_IMAGEFORMAT_PNG 154 166 _qt_PngFormat, 167 #endif 168 #ifndef QT_NO_IMAGEFORMAT_JPEG 169 _qt_JpgFormat, 170 #endif 171 #ifndef QT_NO_IMAGEFORMAT_MNG 172 _qt_MngFormat, 173 #endif 174 #ifndef QT_NO_IMAGEFORMAT_TIFF 175 _qt_TifFormat, 176 #endif 177 #ifdef QT_BUILTIN_GIF_READER 178 _qt_GifFormat, 155 179 #endif 156 180 _qt_BmpFormat, … … 180 204 {_qt_PngFormat, "png"}, 181 205 #endif 206 #ifndef QT_NO_IMAGEFORMAT_JPEG 207 {_qt_JpgFormat, "jpg"}, 208 #endif 209 #ifndef QT_NO_IMAGEFORMAT_MNG 210 {_qt_MngFormat, "mng"}, 211 #endif 212 #ifndef QT_NO_IMAGEFORMAT_TIFF 213 {_qt_TifFormat, "tif"}, 214 #endif 215 #ifdef QT_BUILTIN_GIF_READER 216 {_qt_GifFormat, "gif"}, 217 #endif 182 218 {_qt_BmpFormat, "bmp"}, 183 219 #ifndef QT_NO_IMAGEFORMAT_PPM … … 206 242 QImageIOHandler *handler = 0; 207 243 208 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)244 #ifndef QT_NO_LIBRARY 209 245 // check if we have plugins that support the image format 210 246 QFactoryLoader *l = loader(); … … 218 254 #endif 219 255 220 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)256 #ifndef QT_NO_LIBRARY 221 257 int suffixPluginIndex = -1; 222 258 if (device && format.isEmpty() && autoDetectImageFormat && !ignoresFormatAndExtension) { … … 247 283 testFormat = QByteArray(); 248 284 249 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)285 #ifndef QT_NO_LIBRARY 250 286 if (suffixPluginIndex != -1) { 251 287 // check if the plugin that claims support for this format can load … … 302 338 if (false) { 303 339 #ifndef QT_NO_IMAGEFORMAT_PNG 304 340 } else if (testFormat == "png") { 305 341 handler = new QPngHandler; 342 #endif 343 #ifndef QT_NO_IMAGEFORMAT_JPEG 344 } else if (testFormat == "jpg" || testFormat == "jpeg") { 345 handler = new QJpegHandler; 346 #endif 347 #ifndef QT_NO_IMAGEFORMAT_MNG 348 } else if (testFormat == "mng") { 349 handler = new QMngHandler; 350 #endif 351 #ifndef QT_NO_IMAGEFORMAT_TIFF 352 } else if (testFormat == "tif" || testFormat == "tiff") { 353 handler = new QTiffHandler; 354 #endif 355 #ifdef QT_BUILTIN_GIF_READER 356 } else if (testFormat == "gif") { 357 handler = new QGifHandler; 306 358 #endif 307 359 #ifndef QT_NO_IMAGEFORMAT_BMP … … 332 384 } 333 385 334 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)386 #ifndef QT_NO_LIBRARY 335 387 if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) { 336 388 // check if any of our plugins recognize the file from its contents. … … 351 403 device->seek(pos); 352 404 } 353 #endif 405 #endif // QT_NO_LIBRARY 354 406 355 407 if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) { … … 381 433 break; 382 434 #endif 435 #ifndef QT_NO_IMAGEFORMAT_JPEG 436 case _qt_JpgFormat: 437 if (QJpegHandler::canRead(device)) 438 handler = new QJpegHandler; 439 break; 440 #endif 441 #ifndef QT_NO_IMAGEFORMAT_MNG 442 case _qt_MngFormat: 443 if (QMngHandler::canRead(device)) 444 handler = new QMngHandler; 445 break; 446 #endif 447 #ifndef QT_NO_IMAGEFORMAT_TIFF 448 case _qt_TifFormat: 449 if (QTiffHandler::canRead(device)) 450 handler = new QTiffHandler; 451 break; 452 #endif 453 #ifdef QT_BUILTIN_GIF_READER 454 case _qt_GifFormat: 455 if (QGifHandler::canRead(device)) 456 handler = new QGifHandler; 457 break; 458 #endif 383 459 #ifndef QT_NO_IMAGEFORMAT_BMP 384 460 case _qt_BmpFormat: … … 504 580 { 505 581 // check some preconditions 506 if (!device || (!deleteDevice && !device->isOpen() )) {582 if (!device || (!deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly))) { 507 583 imageReaderError = QImageReader::DeviceError; 508 584 errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Invalid device")); … … 1415 1491 formats << _qt_BuiltInFormats[i].extension; 1416 1492 1417 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)1493 #ifndef QT_NO_LIBRARY 1418 1494 QFactoryLoader *l = loader(); 1419 1495 QStringList keys = l->keys();
Note:
See TracChangeset
for help on using the changeset viewer.