Changeset 561 for trunk/src/gui/image/qpnghandler.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/image/qpnghandler.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 67 67 # define Q_INTERNAL_WIN_NO_THROW 68 68 #endif 69 70 // avoid going through QImage::scanLine() which calls detach 71 #define FAST_SCAN_LINE(data, bpl, y) (data + (y) * bpl) 69 72 70 73 /* … … 172 175 return; 173 176 } 174 image.set NumColors(2);177 image.setColorCount(2); 175 178 image.setColor(1, qRgb(0,0,0)); 176 179 image.setColor(0, qRgb(255,255,255)); … … 200 203 return; 201 204 } 202 image.set NumColors(ncols);205 image.setColorCount(ncols); 203 206 for (int i=0; i<ncols; i++) { 204 207 int c = i*255/(ncols-1); … … 206 209 } 207 210 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) 208 212 const int g = info_ptr->trans_values.gray; 213 #else 214 const int g = info_ptr->trans_color.gray; 215 #endif 209 216 if (g < ncols) { 210 217 image.setColor(g, 0); … … 227 234 return; 228 235 } 229 image.set NumColors(info_ptr->num_palette);236 image.setColorCount(info_ptr->num_palette); 230 237 int i = 0; 231 238 if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { … … 235 242 info_ptr->palette[i].green, 236 243 info_ptr->palette[i].blue, 244 #if PNG_LIBPNG_VER_MAJOR < 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR < 4) 237 245 info_ptr->trans[i] 246 #else 247 info_ptr->trans_alpha[i] 248 #endif 238 249 ) 239 250 ); … … 501 512 if (color_type == PNG_COLOR_TYPE_PALETTE 502 513 && outImage->format() == QImage::Format_Indexed8) { 503 int color_table_size = outImage-> numColors();514 int color_table_size = outImage->colorCount(); 504 515 for (int y=0; y<(int)height; ++y) { 505 uchar *p = outImage->scanLine(y);516 uchar *p = FAST_SCAN_LINE(data, bpl, y); 506 517 uchar *end = p + width; 507 518 while (p < end) { … … 755 766 png_colorp palette = 0; 756 767 png_bytep copy_trans = 0; 757 if (image. numColors()) {768 if (image.colorCount()) { 758 769 // Paletted 759 int num_palette = image. numColors();770 int num_palette = image.colorCount(); 760 771 palette = new png_color[num_palette]; 761 772 png_set_PLTE(png_ptr, info_ptr, palette, num_palette); … … 845 856 0, 0, 0); 846 857 847 const uchar *data = image.bits();858 const uchar *data = (static_cast<const QImage *>(&image))->bits(); 848 859 int bpl = image.bytesPerLine(); 849 860 row_pointers = new png_bytep[height]; … … 957 968 { 958 969 if (option == Gamma) 959 d->gamma = value.to Double();970 d->gamma = value.toFloat(); 960 971 else if (option == Quality) 961 972 d->quality = value.toInt();
Note:
See TracChangeset
for help on using the changeset viewer.