Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/image/qimagereader.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    142142#include <private/qpnghandler_p.h>
    143143#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
    144156
    145157QT_BEGIN_NAMESPACE
    146158
    147 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
     159#ifndef QT_NO_LIBRARY
    148160Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
    149161                          (QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats")))
     
    153165#ifndef QT_NO_IMAGEFORMAT_PNG
    154166    _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,
    155179#endif
    156180    _qt_BmpFormat,
     
    180204    {_qt_PngFormat, "png"},
    181205#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
    182218    {_qt_BmpFormat, "bmp"},
    183219#ifndef QT_NO_IMAGEFORMAT_PPM
     
    206242    QImageIOHandler *handler = 0;
    207243
    208 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
     244#ifndef QT_NO_LIBRARY
    209245    // check if we have plugins that support the image format
    210246    QFactoryLoader *l = loader();
     
    218254#endif
    219255
    220 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
     256#ifndef QT_NO_LIBRARY
    221257    int suffixPluginIndex = -1;
    222258    if (device && format.isEmpty() && autoDetectImageFormat && !ignoresFormatAndExtension) {
     
    247283        testFormat = QByteArray();
    248284
    249 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
     285#ifndef QT_NO_LIBRARY
    250286    if (suffixPluginIndex != -1) {
    251287        // check if the plugin that claims support for this format can load
     
    302338        if (false) {
    303339#ifndef QT_NO_IMAGEFORMAT_PNG
    304         } else if (testFormat == "png") {
     340        } else if (testFormat == "png") {
    305341            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;
    306358#endif
    307359#ifndef QT_NO_IMAGEFORMAT_BMP
     
    332384    }
    333385
    334 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
     386#ifndef QT_NO_LIBRARY
    335387    if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) {
    336388        // check if any of our plugins recognize the file from its contents.
     
    351403            device->seek(pos);
    352404    }
    353 #endif
     405#endif // QT_NO_LIBRARY
    354406
    355407    if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) {
     
    381433                break;
    382434#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
    383459#ifndef QT_NO_IMAGEFORMAT_BMP
    384460            case _qt_BmpFormat:
     
    504580{
    505581    // check some preconditions
    506     if (!device || (!deleteDevice && !device->isOpen())) {
     582    if (!device || (!deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly))) {
    507583        imageReaderError = QImageReader::DeviceError;
    508584        errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Invalid device"));
     
    14151491        formats << _qt_BuiltInFormats[i].extension;
    14161492
    1417 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
     1493#ifndef QT_NO_LIBRARY
    14181494    QFactoryLoader *l = loader();
    14191495    QStringList keys = l->keys();
Note: See TracChangeset for help on using the changeset viewer.