Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

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

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/plugins/imageformats/ico/qicohandler.cpp

    r651 r769  
    5454#include <QtCore/QFile>
    5555#include <QtCore/QBuffer>
     56#include <qvariant.h>
    5657// These next two structs represent how the icon information is stored
    5758// in an ICO file.
     
    773774}
    774775
     776QVariant QtIcoHandler::option(ImageOption option) const
     777{
     778    if (option == Size) {
     779        QIODevice *device = QImageIOHandler::device();
     780        qint64 oldPos = device->pos();
     781        ICONDIRENTRY iconEntry;
     782        if (device->seek(oldPos + ICONDIR_SIZE + (m_currentIconIndex * ICONDIRENTRY_SIZE))) {
     783            if (readIconDirEntry(device, &iconEntry)) {
     784                device->seek(oldPos);
     785                return QSize(iconEntry.bWidth, iconEntry.bHeight);
     786            }
     787        }
     788        if (!device->isSequential())
     789            device->seek(oldPos);
     790    }
     791    return QVariant();
     792}
     793
     794bool QtIcoHandler::supportsOption(ImageOption option) const
     795{
     796    return option == Size;
     797}
     798
    775799/*!
    776800 * Verifies if some values (magic bytes) are set as expected in the header of the file.
  • trunk/src/plugins/imageformats/ico/qicohandler.h

    r651 r769  
    6363    static bool canRead(QIODevice *device);
    6464   
     65    bool supportsOption(ImageOption option) const;
     66    QVariant option(ImageOption option) const;
     67
    6568private:
    6669    int m_currentIconIndex;
  • trunk/src/plugins/imageformats/jpeg/qjpeghandler.cpp

    r651 r769  
    11891189    }
    11901190
    1191     return device->peek(2) == "\xFF\xD8";
     1191    char buffer[2];
     1192    if (device->peek(buffer, 2) != 2)
     1193        return false;
     1194
     1195    return uchar(buffer[0]) == 0xff && uchar(buffer[1]) == 0xd8;
    11921196}
    11931197
Note: See TracChangeset for help on using the changeset viewer.