Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5353{
    5454    int i;
    55     if (image->depth() == 1 && image->numColors() == 2) {
     55    if (image->depth() == 1 && image->() == 2) {
    5656        register uint *p = (uint *)image->bits();
    57         int nbytes = image->numBytes();
     57        int nbytes = image->();
    5858        for (i=0; i<nbytes/4; i++) {
    5959            *p = ~*p;
     
    8282const int BMP_FILEHDR_SIZE = 14;                // size of BMP_FILEHDR data
    8383
    84 QDataStream &operator>>(QDataStream &s, BMP_FILEHDR &bf)
     84QDataStream &operator>>(QDataStream &s, BMP_FILEHDR &bf)
    8585{                                                // read file header
    8686    s.readRawData(bf.bfType, 2);
     
    8989}
    9090
    91 QDataStream &operator<<(QDataStream &s, const BMP_FILEHDR &bf)
     91QDataStream &operator<<(QDataStream &s, const BMP_FILEHDR &bf)
    9292{                                                // write file header
    9393    s.writeRawData(bf.bfType, 2);
     
    107107
    108108
    109 QDataStream &operator>>(QDataStream &s, BMP_INFOHDR &bi)
     109QDataStream &operator>>(QDataStream &s, BMP_INFOHDR &bi)
    110110{
    111111    s >> bi.biSize;
     
    129129}
    130130
    131 QDataStream &operator<<(QDataStream &s, const BMP_INFOHDR &bi)
     131QDataStream &operator<<(QDataStream &s, const BMP_INFOHDR &bi)
    132132{
    133133    s << bi.biSize;
     
    247247    if (depth != 32) {
    248248        ncols = bi.biClrUsed ? bi.biClrUsed : 1 << nbits;
    249         image.setNumColors(ncols);
     249        image.set(ncols);
    250250    }
    251251
     
    527527        return false;
    528528
    529     if (image.depth() == 8 && image.numColors() <= 16) {
     529    if (image.depth() == 8 && image.() <= 16) {
    530530        bpl_bmp = (((bpl+1)/2+3)/4)*4;
    531531        nbits = 4;
     
    555555                                                : 2834; // 72 dpi default
    556556    bi.biYPelsPerMeter = image.dotsPerMeterY() ? image.dotsPerMeterY() : 2834;
    557     bi.biClrUsed       = image.numColors();
    558     bi.biClrImportant  = image.numColors();
     557    bi.biClrUsed       = image.();
     558    bi.biClrImportant  = image.();
    559559    s << bi;                                        // write info header
    560560    if (s.status() != QDataStream::Ok)
     
    562562
    563563    if (image.depth() != 32) {                // write color table
    564         uchar *color_table = new uchar[4*image.numColors()];
     564        uchar *color_table = new uchar[4*image.()];
    565565        uchar *rgb = color_table;
    566566        QVector<QRgb> c = image.colorTable();
    567         for (int i=0; i<image.numColors(); i++) {
     567        for (int i=0; i<image.(); i++) {
    568568            *rgb++ = qBlue (c[i]);
    569569            *rgb++ = qGreen(c[i]);
     
    571571            *rgb++ = 0;
    572572        }
    573         if (d->write((char *)color_table, 4*image.numColors()) == -1) {
     573        if (d->write((char *)color_table, 4*image.()) == -1) {
    574574            delete [] color_table;
    575575            return false;
     
    755755
    756756    // Code partially repeated in qt_write_dib
    757     if (image.depth() == 8 && image.numColors() <= 16) {
     757    if (image.depth() == 8 && image.() <= 16) {
    758758        bpl_bmp = (((bpl+1)/2+3)/4)*4;
    759759    } else if (image.depth() == 32) {
     
    772772    bf.bfReserved1 = 0;
    773773    bf.bfReserved2 = 0;
    774     bf.bfOffBits = BMP_FILEHDR_SIZE + BMP_WIN + image.numColors() * 4;
     774    bf.bfOffBits = BMP_FILEHDR_SIZE + BMP_WIN + image.() * 4;
    775775    bf.bfSize = bf.bfOffBits + bpl_bmp*image.height();
    776776    s << bf;
Note: See TracChangeset for help on using the changeset viewer.