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/qpnghandler.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6767#  define Q_INTERNAL_WIN_NO_THROW
    6868#endif
     69
     70// avoid going through QImage::scanLine() which calls detach
     71#define FAST_SCAN_LINE(data, bpl, y) (data + (y) * bpl)
    6972
    7073/*
     
    172175                    return;
    173176            }
    174             image.setNumColors(2);
     177            image.setColorCount(2);
    175178            image.setColor(1, qRgb(0,0,0));
    176179            image.setColor(0, qRgb(255,255,255));
     
    200203                    return;
    201204            }
    202             image.setNumColors(ncols);
     205            image.setColorCount(ncols);
    203206            for (int i=0; i<ncols; i++) {
    204207                int c = i*255/(ncols-1);
     
    206209            }
    207210            if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
     211#if PNG_LIBPNG_VER_MAJOR < 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR < 4)
    208212                const int g = info_ptr->trans_values.gray;
     213#else
     214                const int g = info_ptr->trans_color.gray;
     215#endif
    209216                if (g < ncols) {
    210217                    image.setColor(g, 0);
     
    227234                return;
    228235        }
    229         image.setNumColors(info_ptr->num_palette);
     236        image.setColorCount(info_ptr->num_palette);
    230237        int i = 0;
    231238        if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
     
    235242                    info_ptr->palette[i].green,
    236243                    info_ptr->palette[i].blue,
     244#if PNG_LIBPNG_VER_MAJOR < 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR < 4)
    237245                    info_ptr->trans[i]
     246#else
     247                    info_ptr->trans_alpha[i]
     248#endif
    238249                   )
    239250               );
     
    501512    if (color_type == PNG_COLOR_TYPE_PALETTE
    502513        && outImage->format() == QImage::Format_Indexed8) {
    503         int color_table_size = outImage->numColors();
     514        int color_table_size = outImage->colorCount();
    504515        for (int y=0; y<(int)height; ++y) {
    505             uchar *p = outImage->scanLine(y);
     516            uchar *p = FAST_SCAN_LINE(data, bpl, y);
    506517            uchar *end = p + width;
    507518            while (p < end) {
     
    755766    png_colorp palette = 0;
    756767    png_bytep copy_trans = 0;
    757     if (image.numColors()) {
     768    if (image.colorCount()) {
    758769        // Paletted
    759         int num_palette = image.numColors();
     770        int num_palette = image.colorCount();
    760771        palette = new png_color[num_palette];
    761772        png_set_PLTE(png_ptr, info_ptr, palette, num_palette);
     
    845856        0, 0, 0);
    846857
    847     const uchar *data = image.bits();
     858    const uchar *data = (static_cast<const QImage *>(&image))->bits();
    848859    int bpl = image.bytesPerLine();
    849860    row_pointers = new png_bytep[height];
     
    957968{
    958969    if (option == Gamma)
    959         d->gamma = value.toDouble();
     970        d->gamma = value.toFloat();
    960971    else if (option == Quality)
    961972        d->quality = value.toInt();
Note: See TracChangeset for help on using the changeset viewer.