| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the plugins of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include "qtiffhandler_p.h"cxx . . $ `<file>/src/plugins/imageformats/tiff/qtiffhandler_p.h`/ |
| 41 | #include <qvariant.h> |
| 42 | #include <qcolorspace.h> |
| 43 | #include <qdebug.h> |
| 44 | #include <qimage.h> |
| 45 | #include <qglobal.h> |
| 46 | #include <qbuffer.h> |
| 47 | #include <qfiledevice.h> |
| 48 | |
| 49 | extern "C" { |
| 50 | #include "tiffio.h" |
| 51 | } |
| 52 | |
| 53 | #include <memory> |
| 54 | |
| 55 | QT_BEGIN_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:148:10`! |
| 56 | |
| 57 | tsize_t qtiffReadProccxx . . $ qtiffReadProc(45df71ebdb98f7e0).(thandle_t fd, tdata_t buf, tsize_t size) |
| 58 | { |
| 59 | QIODevicecxx . . $ QIODevice# *device = static_cast<QIODevicecxx . . $ QIODevice# *>(fd); |
| 60 | return device->isReadablecxx . . $ QIODevice#isReadable(50ce9a9e25b4a850).() ? device->readcxx . . $ QIODevice#read(2e638bc8ed65be6c).(static_cast<char *>(buf), size) : -1; |
| 61 | } |
| 62 | |
| 63 | tsize_t qtiffWriteProccxx . . $ qtiffWriteProc(45df71ebdb98f7e0).(thandle_t fd, tdata_t buf, tsize_t size) |
| 64 | { |
| 65 | return static_cast<QIODevicecxx . . $ QIODevice# *>(fd)->writecxx . . $ QIODevice#write(93d4069f65218ea4).(static_cast<char *>(buf), size); |
| 66 | } |
| 67 | |
| 68 | toff_t qtiffSeekProccxx . . $ qtiffSeekProc(d07fab68d5b55d71).(thandle_t fd, toff_t off, int whence) |
| 69 | { |
| 70 | QIODevicecxx . . $ QIODevice# *device = static_cast<QIODevicecxx . . $ QIODevice# *>(fd); |
| 71 | switch (whence) { |
| 72 | case SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!: |
| 73 | device->seekcxx . . $ QIODevice#seek(49597d8fcab147c1).(off); |
| 74 | break; |
| 75 | case SEEK_CURcxx . . $ `<external>/232824719582829767/stdio.h:111:9`!: |
| 76 | device->seekcxx . . $ QIODevice#seek(49597d8fcab147c1).(device->poscxx . . $ QIODevice#pos(98833e9ab7de59a4).() + off); |
| 77 | break; |
| 78 | case SEEK_ENDcxx . . $ `<external>/232824719582829767/stdio.h:112:9`!: |
| 79 | device->seekcxx . . $ QIODevice#seek(49597d8fcab147c1).(device->sizecxx . . $ QIODevice#size(98833e9ab7de59a4).() + off); |
| 80 | break; |
| 81 | } |
| 82 | |
| 83 | return device->poscxx . . $ QIODevice#pos(98833e9ab7de59a4).(); |
| 84 | } |
| 85 | |
| 86 | int qtiffCloseProccxx . . $ qtiffCloseProc(dedf1e9b1c614a07).(thandle_t /*fd*/) |
| 87 | { |
| 88 | return 0; |
| 89 | } |
| 90 | |
| 91 | toff_t qtiffSizeProccxx . . $ qtiffSizeProc(751e5d26f8574c32).(thandle_t fd) |
| 92 | { |
| 93 | return static_cast<QIODevicecxx . . $ QIODevice# *>(fd)->sizecxx . . $ QIODevice#size(98833e9ab7de59a4).(); |
| 94 | } |
| 95 | |
| 96 | int qtiffMapProccxx . . $ qtiffMapProc(75bc687cc19be944).(thandle_t fd, void **base, toff_t *size) |
| 97 | { |
| 98 | QIODevicecxx . . $ QIODevice# *device = static_cast<QIODevicecxx . . $ QIODevice# *>(fd); |
| 99 | |
| 100 | QFileDevicecxx . . $ QFileDevice# *file = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QFileDevicecxx . . $ QFileDevice# *>(device); |
| 101 | if (file) { |
| 102 | *base = file->mapcxx . . $ QFileDevice#map(cc68507cb16db87).(0, file->sizecxx . . $ QFileDevice#size(98833e9ab7de59a4).()); |
| 103 | if (*base != nullptr) { |
| 104 | *size = file->sizecxx . . $ QFileDevice#size(98833e9ab7de59a4).(); |
| 105 | return 1; |
| 106 | } |
| 107 | } else { |
| 108 | QBuffercxx . . $ QBuffer# *buf = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QBuffercxx . . $ QBuffer# *>(device); |
| 109 | if (buf) { |
| 110 | *base = const_cast<char *>(buf->datacxx . . $ QBuffer#data(86b60c98674fc185).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()); |
| 111 | *size = buf->sizecxx . . $ QBuffer#size(98833e9ab7de59a4).(); |
| 112 | return 1; |
| 113 | } |
| 114 | } |
| 115 | return 0; |
| 116 | } |
| 117 | |
| 118 | void qtiffUnmapProccxx . . $ qtiffUnmapProc(d02d295a36f87ec9).(thandle_t fd, void *base, toff_t /*size*/) |
| 119 | { |
| 120 | QFileDevicecxx . . $ QFileDevice# *file = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QFileDevicecxx . . $ QFileDevice# *>(static_cast<QIODevicecxx . . $ QIODevice# *>(fd)); |
| 121 | if (file && base) |
| 122 | file->unmapcxx . . $ QFileDevice#unmap(8c2a43c3cf3cca3e).(static_cast<ucharcxx . . $ uchar# *>(base)); |
| 123 | } |
| 124 | |
| 125 | |
| 126 | class QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate# |
| 127 | { |
| 128 | public: |
| 129 | QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#QTiffHandlerPrivate(49f6e7a06ebc5aa8).(); |
| 130 | ~cxx . . $ QTiffHandlerPrivate#`~QTiffHandlerPrivate`(ced63f7c635d850d).QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#(); |
| 131 | |
| 132 | static bool canReadcxx . . $ QTiffHandlerPrivate#canRead(33ee36428ee918e7).(QIODevicecxx . . $ QIODevice# *device); |
| 133 | bool openForReadcxx . . $ QTiffHandlerPrivate#openForRead(33ee36428ee918e7).(QIODevicecxx . . $ QIODevice# *device); |
| 134 | bool readHeaderscxx . . $ QTiffHandlerPrivate#readHeaders(33ee36428ee918e7).(QIODevicecxx . . $ QIODevice# *device); |
| 135 | void closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 136 | |
| 137 | TIFF *tiffcxx . . $ QTiffHandlerPrivate#tiff.; |
| 138 | int compressioncxx . . $ QTiffHandlerPrivate#compression.; |
| 139 | QImageIOHandlercxx . . $ QImageIOHandler#::Transformationscxx . . $ QImageIOHandler#Transformations# transformationcxx . . $ QTiffHandlerPrivate#transformation.; |
| 140 | QImagecxx . . $ QImage#::Formatcxx . . $ QImage#Format# formatcxx . . $ QTiffHandlerPrivate#format.; |
| 141 | QSizecxx . . $ QSize# sizecxx . . $ QTiffHandlerPrivate#size.; |
| 142 | uint16_tcxx . . $ uint16_t# photometriccxx . . $ QTiffHandlerPrivate#photometric.; |
| 143 | bool grayscalecxx . . $ QTiffHandlerPrivate#grayscale.; |
| 144 | bool headersReadcxx . . $ QTiffHandlerPrivate#headersRead.; |
| 145 | int currentDirectorycxx . . $ QTiffHandlerPrivate#currentDirectory.; |
| 146 | int directoryCountcxx . . $ QTiffHandlerPrivate#directoryCount.; |
| 147 | }; |
| 148 | |
| 149 | static QImageIOHandlercxx . . $ QImageIOHandler#::Transformationscxx . . $ QImageIOHandler#Transformations# exif2Qtcxx . . $ exif2Qt(d37ea5f923582dbe).(int exifOrientation) |
| 150 | { |
| 151 | switch (exifOrientation) { |
| 152 | case 1: // normal |
| 153 | return QImageIOHandlercxx . . $ QFlags#QFlags(93d577a3e9528307).::TransformationNonecxx . . $ QImageIOHandler#TransformationNone.; |
| 154 | case 2: // mirror horizontal |
| 155 | return QImageIOHandlercxx . . $ QFlags#QFlags(93d577a3e9528307).::TransformationMirrorcxx . . $ QImageIOHandler#TransformationMirror.; |
| 156 | case 3: // rotate 180 |
| 157 | return QImageIOHandlercxx . . $ QFlags#QFlags(93d577a3e9528307).::TransformationRotate180cxx . . $ QImageIOHandler#TransformationRotate180.; |
| 158 | case 4: // mirror vertical |
| 159 | return QImageIOHandlercxx . . $ QFlags#QFlags(93d577a3e9528307).::TransformationFlipcxx . . $ QImageIOHandler#TransformationFlip.; |
| 160 | case 5: // mirror horizontal and rotate 270 CW |
| 161 | return QImageIOHandlercxx . . $ QFlags#QFlags(93d577a3e9528307).::TransformationFlipAndRotate90cxx . . $ QImageIOHandler#TransformationFlipAndRotate90.; |
| 162 | case 6: // rotate 90 CW |
| 163 | return QImageIOHandlercxx . . $ QFlags#QFlags(93d577a3e9528307).::TransformationRotate90cxx . . $ QImageIOHandler#TransformationRotate90.; |
| 164 | case 7: // mirror horizontal and rotate 90 CW |
| 165 | return QImageIOHandlercxx . . $ QFlags#QFlags(93d577a3e9528307).::TransformationMirrorAndRotate90cxx . . $ QImageIOHandler#TransformationMirrorAndRotate90.; |
| 166 | case 8: // rotate 270 CW |
| 167 | return QImageIOHandlercxx . . $ QFlags#QFlags(93d577a3e9528307).::TransformationRotate270cxx . . $ QImageIOHandler#TransformationRotate270.; |
| 168 | } |
| 169 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("Invalid EXIF orientation"); |
| 170 | return QImageIOHandlercxx . . $ QFlags#QFlags(93d577a3e9528307).::TransformationNonecxx . . $ QImageIOHandler#TransformationNone.; |
| 171 | } |
| 172 | |
| 173 | static int qt2Exifcxx . . $ qt2Exif(a68312a2d7b03b35).(QImageIOHandlercxx . . $ QImageIOHandler#::Transformationscxx . . $ QImageIOHandler#Transformations# transformation) |
| 174 | { |
| 175 | switch (transformation) { |
| 176 | case QImageIOHandlercxx . . $ QImageIOHandler#::TransformationNonecxx . . $ QImageIOHandler#TransformationNone.: |
| 177 | return 1; |
| 178 | case QImageIOHandlercxx . . $ QImageIOHandler#::TransformationMirrorcxx . . $ QImageIOHandler#TransformationMirror.: |
| 179 | return 2; |
| 180 | case QImageIOHandlercxx . . $ QImageIOHandler#::TransformationRotate180cxx . . $ QImageIOHandler#TransformationRotate180.: |
| 181 | return 3; |
| 182 | case QImageIOHandlercxx . . $ QImageIOHandler#::TransformationFlipcxx . . $ QImageIOHandler#TransformationFlip.: |
| 183 | return 4; |
| 184 | case QImageIOHandlercxx . . $ QImageIOHandler#::TransformationFlipAndRotate90cxx . . $ QImageIOHandler#TransformationFlipAndRotate90.: |
| 185 | return 5; |
| 186 | case QImageIOHandlercxx . . $ QImageIOHandler#::TransformationRotate90cxx . . $ QImageIOHandler#TransformationRotate90.: |
| 187 | return 6; |
| 188 | case QImageIOHandlercxx . . $ QImageIOHandler#::TransformationMirrorAndRotate90cxx . . $ QImageIOHandler#TransformationMirrorAndRotate90.: |
| 189 | return 7; |
| 190 | case QImageIOHandlercxx . . $ QImageIOHandler#::TransformationRotate270cxx . . $ QImageIOHandler#TransformationRotate270.: |
| 191 | return 8; |
| 192 | } |
| 193 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("Invalid Qt image transformation"); |
| 194 | return 1; |
| 195 | } |
| 196 | |
| 197 | QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#::QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#QTiffHandlerPrivate(49f6e7a06ebc5aa8).() |
| 198 | : tiffcxx . . $ QTiffHandlerPrivate#tiff.(0) |
| 199 | , compressioncxx . . $ QTiffHandlerPrivate#compression.(QTiffHandlercxx . . $ QTiffHandler#::NoCompressioncxx . . $ QTiffHandler#NoCompression.) |
| 200 | , transformationcxx . . $ QTiffHandlerPrivate#transformation.(QImageIOHandlercxx . . $ QImageIOHandler#::TransformationNonecxx . . $ QImageIOHandler#TransformationNone.) |
| 201 | , formatcxx . . $ QTiffHandlerPrivate#format.(QImagecxx . . $ QImage#::Format_Invalidcxx . . $ QImage#Format_Invalid.) |
| 202 | , photometriccxx . . $ QTiffHandlerPrivate#photometric.(false) |
| 203 | , grayscalecxx . . $ QTiffHandlerPrivate#grayscale.(false) |
| 204 | , headersReadcxx . . $ QTiffHandlerPrivate#headersRead.(false) |
| 205 | , currentDirectorycxx . . $ QTiffHandlerPrivate#currentDirectory.(0) |
| 206 | , directoryCountcxx . . $ QTiffHandlerPrivate#directoryCount.(0) |
| 207 | { |
| 208 | } |
| 209 | |
| 210 | QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#::~cxx . . $ QTiffHandlerPrivate#`~QTiffHandlerPrivate`(ced63f7c635d850d).QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#() |
| 211 | { |
| 212 | closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 213 | } |
| 214 | |
| 215 | void QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#::closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).() |
| 216 | { |
| 217 | if (tiffcxx . . $ QTiffHandlerPrivate#tiff.) |
| 218 | TIFFClose(tiffcxx . . $ QTiffHandlerPrivate#tiff.); |
| 219 | tiffcxx . . $ QTiffHandlerPrivate#tiff. = 0; |
| 220 | } |
| 221 | |
| 222 | bool QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#::canReadcxx . . $ QTiffHandlerPrivate#canRead(33ee36428ee918e7).(QIODevicecxx . . $ QIODevice# *device) |
| 223 | { |
| 224 | if (!device) { |
| 225 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("QTiffHandler::canRead() called with no device"); |
| 226 | return false; |
| 227 | } |
| 228 | |
| 229 | // current implementation uses TIFFClientOpen which needs to be |
| 230 | // able to seek, so sequential devices are not supported |
| 231 | char h[4]; |
| 232 | if (device->peekcxx . . $ QIODevice#peek(2e638bc8ed65be6c).(h, 4) != 4) |
| 233 | return false; |
| 234 | if ((h[0] == 0x49 && h[1] == 0x49) && (h[2] == 0x2a || h[2] == 0x2b) && h[3] == 0) |
| 235 | return true; // Little endian, classic or bigtiff |
| 236 | if ((h[0] == 0x4d && h[1] == 0x4d) && h[2] == 0 && (h[3] == 0x2a || h[3] == 0x2b)) |
| 237 | return true; // Big endian, classic or bigtiff |
| 238 | return false; |
| 239 | } |
| 240 | |
| 241 | bool QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#::openForReadcxx . . $ QTiffHandlerPrivate#openForRead(33ee36428ee918e7).(QIODevicecxx . . $ QIODevice# *device) |
| 242 | { |
| 243 | if (tiffcxx . . $ QTiffHandlerPrivate#tiff.) |
| 244 | return true; |
| 245 | |
| 246 | if (!canReadcxx . . $ QTiffHandlerPrivate#canRead(33ee36428ee918e7).(device)) |
| 247 | return false; |
| 248 | |
| 249 | tiffcxx . . $ QTiffHandlerPrivate#tiff. = TIFFClientOpen("foo", |
| 250 | "r", |
| 251 | device, |
| 252 | qtiffReadProccxx . . $ qtiffReadProc(45df71ebdb98f7e0)., |
| 253 | qtiffWriteProccxx . . $ qtiffWriteProc(45df71ebdb98f7e0)., |
| 254 | qtiffSeekProccxx . . $ qtiffSeekProc(d07fab68d5b55d71)., |
| 255 | qtiffCloseProccxx . . $ qtiffCloseProc(dedf1e9b1c614a07)., |
| 256 | qtiffSizeProccxx . . $ qtiffSizeProc(751e5d26f8574c32)., |
| 257 | qtiffMapProccxx . . $ qtiffMapProc(75bc687cc19be944)., |
| 258 | qtiffUnmapProccxx . . $ qtiffUnmapProc(d02d295a36f87ec9).); |
| 259 | |
| 260 | if (!tiffcxx . . $ QTiffHandlerPrivate#tiff.) { |
| 261 | return false; |
| 262 | } |
| 263 | return true; |
| 264 | } |
| 265 | |
| 266 | bool QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#::readHeaderscxx . . $ QTiffHandlerPrivate#readHeaders(33ee36428ee918e7).(QIODevicecxx . . $ QIODevice# *device) |
| 267 | { |
| 268 | if (headersReadcxx . . $ QTiffHandlerPrivate#headersRead.) |
| 269 | return true; |
| 270 | |
| 271 | if (!openForReadcxx . . $ QTiffHandlerPrivate#openForRead(33ee36428ee918e7).(device)) |
| 272 | return false; |
| 273 | |
| 274 | TIFFSetDirectory(tiffcxx . . $ QTiffHandlerPrivate#tiff., currentDirectorycxx . . $ QTiffHandlerPrivate#currentDirectory.); |
| 275 | |
| 276 | uint32_tcxx . . $ uint32_t# width; |
| 277 | uint32_tcxx . . $ uint32_t# height; |
| 278 | if (!TIFFGetField(tiffcxx . . $ QTiffHandlerPrivate#tiff., TIFFTAG_IMAGEWIDTHcxx . . $ `<external>/3587304560481274643/tiff.h:178:9`!, &width) |
| 279 | || !TIFFGetField(tiffcxx . . $ QTiffHandlerPrivate#tiff., TIFFTAG_IMAGELENGTHcxx . . $ `<external>/3587304560481274643/tiff.h:179:9`!, &height) |
| 280 | || !TIFFGetField(tiffcxx . . $ QTiffHandlerPrivate#tiff., TIFFTAG_PHOTOMETRICcxx . . $ `<external>/3587304560481274643/tiff.h:220:9`!, &photometriccxx . . $ QTiffHandlerPrivate#photometric.)) { |
| 281 | closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 282 | return false; |
| 283 | } |
| 284 | sizecxx . . $ QTiffHandlerPrivate#size. =cxx . . $ QSize#`operator=`(eccf1d0da1f690e2). QSizecxx . . $ QSize#QSize(c0d38f4800714fae).(width, height); |
| 285 | |
| 286 | uint16_tcxx . . $ uint16_t# orientationTag; |
| 287 | if (TIFFGetField(tiffcxx . . $ QTiffHandlerPrivate#tiff., TIFFTAG_ORIENTATIONcxx . . $ `<external>/3587304560481274643/tiff.h:248:9`!, &orientationTag)) |
| 288 | transformationcxx . . $ QTiffHandlerPrivate#transformation. =cxx . . $ QFlags#`operator=`(614762fe853d85ac). exif2Qtcxx . . $ exif2Qt(d37ea5f923582dbe).(orientationTag); |
| 289 | |
| 290 | // BitsPerSample defaults to 1 according to the TIFF spec. |
| 291 | uint16_tcxx . . $ uint16_t# bitPerSample; |
| 292 | if (!TIFFGetField(tiffcxx . . $ QTiffHandlerPrivate#tiff., TIFFTAG_BITSPERSAMPLEcxx . . $ `<external>/3587304560481274643/tiff.h:180:9`!, &bitPerSample)) |
| 293 | bitPerSample = 1; |
| 294 | uint16_tcxx . . $ uint16_t# samplesPerPixel; // they may be e.g. grayscale with 2 samples per pixel |
| 295 | if (!TIFFGetField(tiffcxx . . $ QTiffHandlerPrivate#tiff., TIFFTAG_SAMPLESPERPIXELcxx . . $ `<external>/3587304560481274643/tiff.h:257:9`!, &samplesPerPixel)) |
| 296 | samplesPerPixel = 1; |
| 297 | |
| 298 | grayscalecxx . . $ QTiffHandlerPrivate#grayscale. = photometriccxx . . $ QTiffHandlerPrivate#photometric. == PHOTOMETRIC_MINISBLACKcxx . . $ `<external>/3587304560481274643/tiff.h:222:9`! || photometriccxx . . $ QTiffHandlerPrivate#photometric. == PHOTOMETRIC_MINISWHITEcxx . . $ `<external>/3587304560481274643/tiff.h:221:9`!; |
| 299 | |
| 300 | if (grayscalecxx . . $ QTiffHandlerPrivate#grayscale. && bitPerSample == 1 && samplesPerPixel == 1) |
| 301 | formatcxx . . $ QTiffHandlerPrivate#format. = QImagecxx . . $ QImage#::Format_Monocxx . . $ QImage#Format_Mono.; |
| 302 | else if (photometriccxx . . $ QTiffHandlerPrivate#photometric. == PHOTOMETRIC_MINISBLACKcxx . . $ `<external>/3587304560481274643/tiff.h:222:9`! && bitPerSample == 8 && samplesPerPixel == 1) |
| 303 | formatcxx . . $ QTiffHandlerPrivate#format. = QImagecxx . . $ QImage#::Format_Grayscale8cxx . . $ QImage#Format_Grayscale8.; |
| 304 | else if (photometriccxx . . $ QTiffHandlerPrivate#photometric. == PHOTOMETRIC_MINISBLACKcxx . . $ `<external>/3587304560481274643/tiff.h:222:9`! && bitPerSample == 16 && samplesPerPixel == 1) |
| 305 | formatcxx . . $ QTiffHandlerPrivate#format. = QImagecxx . . $ QImage#::Format_Grayscale16cxx . . $ QImage#Format_Grayscale16.; |
| 306 | else if ((grayscalecxx . . $ QTiffHandlerPrivate#grayscale. || photometriccxx . . $ QTiffHandlerPrivate#photometric. == PHOTOMETRIC_PALETTEcxx . . $ `<external>/3587304560481274643/tiff.h:224:9`!) && bitPerSample == 8 && samplesPerPixel == 1) |
| 307 | formatcxx . . $ QTiffHandlerPrivate#format. = QImagecxx . . $ QImage#::Format_Indexed8cxx . . $ QImage#Format_Indexed8.; |
| 308 | else if (samplesPerPixel < 4) |
| 309 | if (bitPerSample == 16 && photometriccxx . . $ QTiffHandlerPrivate#photometric. == PHOTOMETRIC_RGBcxx . . $ `<external>/3587304560481274643/tiff.h:223:9`!) |
| 310 | formatcxx . . $ QTiffHandlerPrivate#format. = QImagecxx . . $ QImage#::Format_RGBX64cxx . . $ QImage#Format_RGBX64.; |
| 311 | else |
| 312 | formatcxx . . $ QTiffHandlerPrivate#format. = QImagecxx . . $ QImage#::Format_RGB32cxx . . $ QImage#Format_RGB32.; |
| 313 | else { |
| 314 | uint16_tcxx . . $ uint16_t# count; |
| 315 | uint16_tcxx . . $ uint16_t# *extrasamples; |
| 316 | // If there is any definition of the alpha-channel, libtiff will return premultiplied |
| 317 | // data to us. If there is none, libtiff will not touch it and we assume it to be |
| 318 | // non-premultiplied, matching behavior of tested image editors, and how older Qt |
| 319 | // versions used to save it. |
| 320 | bool premultiplied = true; |
| 321 | bool gotField = TIFFGetField(tiffcxx . . $ QTiffHandlerPrivate#tiff., TIFFTAG_EXTRASAMPLEScxx . . $ `<external>/3587304560481274643/tiff.h:329:9`!, &count, &extrasamples); |
| 322 | if (!gotField || !count || extrasamples[0] == EXTRASAMPLE_UNSPECIFIEDcxx . . $ `<external>/3587304560481274643/tiff.h:330:9`!) |
| 323 | premultiplied = false; |
| 324 | |
| 325 | if (bitPerSample == 16 && photometriccxx . . $ QTiffHandlerPrivate#photometric. == PHOTOMETRIC_RGBcxx . . $ `<external>/3587304560481274643/tiff.h:223:9`!) { |
| 326 | // We read 64-bit raw, so unassoc remains unpremultiplied. |
| 327 | if (gotField && count && extrasamples[0] == EXTRASAMPLE_UNASSALPHAcxx . . $ `<external>/3587304560481274643/tiff.h:332:9`!) |
| 328 | premultiplied = false; |
| 329 | if (premultiplied) |
| 330 | formatcxx . . $ QTiffHandlerPrivate#format. = QImagecxx . . $ QImage#::Format_RGBA64_Premultipliedcxx . . $ QImage#Format_RGBA64_Premultiplied.; |
| 331 | else |
| 332 | formatcxx . . $ QTiffHandlerPrivate#format. = QImagecxx . . $ QImage#::Format_RGBA64cxx . . $ QImage#Format_RGBA64.; |
| 333 | } else { |
| 334 | if (premultiplied) |
| 335 | formatcxx . . $ QTiffHandlerPrivate#format. = QImagecxx . . $ QImage#::Format_ARGB32_Premultipliedcxx . . $ QImage#Format_ARGB32_Premultiplied.; |
| 336 | else |
| 337 | formatcxx . . $ QTiffHandlerPrivate#format. = QImagecxx . . $ QImage#::Format_ARGB32cxx . . $ QImage#Format_ARGB32.; |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | headersReadcxx . . $ QTiffHandlerPrivate#headersRead. = true; |
| 342 | return true; |
| 343 | } |
| 344 | |
| 345 | QTiffHandlercxx . . $ QTiffHandler#::QTiffHandlercxx . . $ QTiffHandler#QTiffHandler(49f6e7a06ebc5aa8).() |
| 346 | : QImageIOHandlercxx . . $ QImageIOHandler#() |
| 347 | , dcxx . . $ QTiffHandler#d.(new QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#QTiffHandlerPrivate(49f6e7a06ebc5aa8).) |
| 348 | { |
| 349 | } |
| 350 | |
| 351 | bool QTiffHandlercxx . . $ QTiffHandler#::canReadcxx . . $ QTiffHandler#canRead(50ce9a9e25b4a850).() const |
| 352 | { |
| 353 | if (dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).tiffcxx . . $ QTiffHandlerPrivate#tiff.) |
| 354 | return true; |
| 355 | if (QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#::canReadcxx . . $ QTiffHandlerPrivate#canRead(33ee36428ee918e7).(devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).())) { |
| 356 | setFormatcxx . . $ QImageIOHandler#setFormat(7c8dc563d715d744).("tiff"cxx . . $ QByteArray#QByteArray(34d26762b42c433a).); |
| 357 | return true; |
| 358 | } |
| 359 | return false; |
| 360 | } |
| 361 | |
| 362 | bool QTiffHandlercxx . . $ QTiffHandler#::canReadcxx . . $ QTiffHandler#canRead(33ee36428ee918e7).(QIODevicecxx . . $ QIODevice# *device) |
| 363 | { |
| 364 | return QTiffHandlerPrivatecxx . . $ QTiffHandlerPrivate#::canReadcxx . . $ QTiffHandlerPrivate#canRead(33ee36428ee918e7).(device); |
| 365 | } |
| 366 | |
| 367 | bool QTiffHandlercxx . . $ QTiffHandler#::readcxx . . $ QTiffHandler#read(5a6f164356166ee6).(QImagecxx . . $ QImage# *image) |
| 368 | { |
| 369 | // Open file and read headers if it hasn't already been done. |
| 370 | if (!dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).readHeaderscxx . . $ QTiffHandlerPrivate#readHeaders(33ee36428ee918e7).(devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).())) |
| 371 | return false; |
| 372 | |
| 373 | QImagecxx . . $ QImage#::Formatcxx . . $ QImage#Format# format = dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).formatcxx . . $ QTiffHandlerPrivate#format.; |
| 374 | |
| 375 | if (image->sizecxx . . $ QImage#size(4b3b776e5ee2b367).() ==cxx . . $ `operator==`(1de60fa97ecbf80a). dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).sizecxx . . $ QTiffHandlerPrivate#size. && image->formatcxx . . $ QImage#format(18a95330327ec5b8).() != format) |
| 376 | image->reinterpretAsFormatcxx . . $ QImage#reinterpretAsFormat(d9d136bf1bd5989e).(format); |
| 377 | |
| 378 | if (image->sizecxx . . $ QImage#size(4b3b776e5ee2b367).() !=cxx . . $ `operator!=`(1de60fa97ecbf80a). dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).sizecxx . . $ QTiffHandlerPrivate#size. || image->formatcxx . . $ QImage#format(18a95330327ec5b8).() != format) |
| 379 | *image =cxx . . $ QImage#`operator=`(e6308d6f8c10e1d2). QImagecxx . . $ QImage#QImage(fe815e29ae3e37c9).(dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).sizecxx . . $ QTiffHandlerPrivate#size., format); |
| 380 | |
| 381 | if (image->isNullcxx . . $ QImage#isNull(50ce9a9e25b4a850).()) { |
| 382 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 383 | return false; |
| 384 | } |
| 385 | |
| 386 | TIFF *const tiff = dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).tiffcxx . . $ QTiffHandlerPrivate#tiff.; |
| 387 | if (TIFFIsTiled(tiff) && TIFFTileSize64(tiff) > uint64_tcxx . . $ uint64_t#(image->sizeInBytescxx . . $ QImage#sizeInBytes(98833e9ab7de59a4).())) // Corrupt image |
| 388 | return false; |
| 389 | const quint32cxx . . $ quint32# width = dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).sizecxx . . $ QTiffHandlerPrivate#size..widthcxx . . $ QSize#width(ea6fe5115c70a13f).(); |
| 390 | const quint32cxx . . $ quint32# height = dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).sizecxx . . $ QTiffHandlerPrivate#size..heightcxx . . $ QSize#height(ea6fe5115c70a13f).(); |
| 391 | |
| 392 | // Setup color tables |
| 393 | if (format == QImagecxx . . $ QImage#::Format_Monocxx . . $ QImage#Format_Mono. || format == QImagecxx . . $ QImage#::Format_Indexed8cxx . . $ QImage#Format_Indexed8.) { |
| 394 | if (format == QImagecxx . . $ QImage#::Format_Monocxx . . $ QImage#Format_Mono.) { |
| 395 | QVectorcxx . . $ QVector#<QRgbcxx . . $ QRgb#> colortablecxx . . $ QVector#QVector(d4f767463ce0a6b3).(2); |
| 396 | if (dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).photometriccxx . . $ QTiffHandlerPrivate#photometric. == PHOTOMETRIC_MINISBLACKcxx . . $ `<external>/3587304560481274643/tiff.h:222:9`!) { |
| 397 | colortable[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).0] = 0xff000000; |
| 398 | colortable[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).1] = 0xffffffff; |
| 399 | } else { |
| 400 | colortable[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).0] = 0xffffffff; |
| 401 | colortable[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).1] = 0xff000000; |
| 402 | } |
| 403 | image->setColorTablecxx . . $ QImage#setColorTable(eaba81ae3f5c62bf).(colortablecxx . . $ QVector#QVector(8c6ebb725bc04eaa).); |
| 404 | } else if (format == QImagecxx . . $ QImage#::Format_Indexed8cxx . . $ QImage#Format_Indexed8.) { |
| 405 | const uint16_tcxx . . $ uint16_t# tableSize = 256; |
| 406 | QVectorcxx . . $ QVector#<QRgbcxx . . $ QRgb#> qtColorTablecxx . . $ QVector#QVector(d4f767463ce0a6b3).(tableSize); |
| 407 | if (dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).grayscalecxx . . $ QTiffHandlerPrivate#grayscale.) { |
| 408 | for (int i = 0; i<tableSize; ++i) { |
| 409 | const int c = (dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).photometriccxx . . $ QTiffHandlerPrivate#photometric. == PHOTOMETRIC_MINISBLACKcxx . . $ `<external>/3587304560481274643/tiff.h:222:9`!) ? i : (255 - i); |
| 410 | qtColorTable[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).i] = qRgbcxx . . $ qRgb(530956271a9518a5).(c, c, c); |
| 411 | } |
| 412 | } else { |
| 413 | // create the color table |
| 414 | uint16_tcxx . . $ uint16_t# *redTable = 0; |
| 415 | uint16_tcxx . . $ uint16_t# *greenTable = 0; |
| 416 | uint16_tcxx . . $ uint16_t# *blueTable = 0; |
| 417 | if (!TIFFGetField(tiff, TIFFTAG_COLORMAPcxx . . $ `<external>/3587304560481274643/tiff.h:309:9`!, &redTable, &greenTable, &blueTable)) { |
| 418 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 419 | return false; |
| 420 | } |
| 421 | if (!redTable || !greenTable || !blueTable) { |
| 422 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 423 | return false; |
| 424 | } |
| 425 | |
| 426 | for (int i = 0; i<tableSize ;++i) { |
| 427 | // emulate libtiff behavior for 16->8 bit color map conversion: just ignore the lower 8 bits |
| 428 | const int red = redTable[i] >> 8; |
| 429 | const int green = greenTable[i] >> 8; |
| 430 | const int blue = blueTable[i] >> 8; |
| 431 | qtColorTable[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).i] = qRgbcxx . . $ qRgb(530956271a9518a5).(red, green, blue); |
| 432 | } |
| 433 | } |
| 434 | image->setColorTablecxx . . $ QImage#setColorTable(eaba81ae3f5c62bf).(qtColorTablecxx . . $ QVector#QVector(8c6ebb725bc04eaa).); |
| 435 | // free redTable, greenTable and greenTable done by libtiff |
| 436 | } |
| 437 | } |
| 438 | bool format8bit = (format == QImagecxx . . $ QImage#::Format_Monocxx . . $ QImage#Format_Mono. || format == QImagecxx . . $ QImage#::Format_Indexed8cxx . . $ QImage#Format_Indexed8. || format == QImagecxx . . $ QImage#::Format_Grayscale8cxx . . $ QImage#Format_Grayscale8.); |
| 439 | bool format16bit = (format == QImagecxx . . $ QImage#::Format_Grayscale16cxx . . $ QImage#Format_Grayscale16.); |
| 440 | bool format64bit = (format == QImagecxx . . $ QImage#::Format_RGBX64cxx . . $ QImage#Format_RGBX64. || format == QImagecxx . . $ QImage#::Format_RGBA64cxx . . $ QImage#Format_RGBA64. || format == QImagecxx . . $ QImage#::Format_RGBA64_Premultipliedcxx . . $ QImage#Format_RGBA64_Premultiplied.); |
| 441 | |
| 442 | // Formats we read directly, instead of over RGBA32: |
| 443 | if (format8bit || format16bit || format64bit) { |
| 444 | int bytesPerPixel = image->depthcxx . . $ QImage#depth(455f465bc33b4cdf).() / 8; |
| 445 | if (format == QImagecxx . . $ QImage#::Format_RGBX64cxx . . $ QImage#Format_RGBX64.) |
| 446 | bytesPerPixel = 6; |
| 447 | if (TIFFIsTiled(tiff)) { |
| 448 | quint32cxx . . $ quint32# tileWidth, tileLength; |
| 449 | TIFFGetField(tiff, TIFFTAG_TILEWIDTHcxx . . $ `<external>/3587304560481274643/tiff.h:311:9`!, &tileWidth); |
| 450 | TIFFGetField(tiff, TIFFTAG_TILELENGTHcxx . . $ `<external>/3587304560481274643/tiff.h:312:9`!, &tileLength); |
| 451 | if (!tileWidth || !tileLength || tileWidth % 16 || tileLength % 16) { |
| 452 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 453 | return false; |
| 454 | } |
| 455 | quint32cxx . . $ quint32# byteWidth = (format == QImagecxx . . $ QImage#::Format_Monocxx . . $ QImage#Format_Mono.) ? (width + 7)/8 : (width * bytesPerPixel); |
| 456 | quint32cxx . . $ quint32# byteTileWidth = (format == QImagecxx . . $ QImage#::Format_Monocxx . . $ QImage#Format_Mono.) ? tileWidth/8 : (tileWidth * bytesPerPixel); |
| 457 | tmsize_t byteTileSize = TIFFTileSize(tiff); |
| 458 | ucharcxx . . $ uchar# *buf = (ucharcxx . . $ uchar# *)_TIFFmalloc(byteTileSize); |
| 459 | if (!buf || byteTileSize / tileLength < byteTileWidth) { |
| 460 | _TIFFfree(buf); |
| 461 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 462 | return false; |
| 463 | } |
| 464 | for (quint32cxx . . $ quint32# y = 0; y < height; y += tileLength) { |
| 465 | for (quint32cxx . . $ quint32# x = 0; x < width; x += tileWidth) { |
| 466 | if (TIFFReadTile(tiff, buf, x, y, 0, 0) < 0) { |
| 467 | _TIFFfree(buf); |
| 468 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 469 | return false; |
| 470 | } |
| 471 | quint32cxx . . $ quint32# linesToCopy = qMincxx . . $ qMin(2a338fce5842aa6a).(tileLength, height - y); |
| 472 | quint32cxx . . $ quint32# byteOffset = (format == QImagecxx . . $ QImage#::Format_Monocxx . . $ QImage#Format_Mono.) ? x/8 : (x * bytesPerPixel); |
| 473 | quint32cxx . . $ quint32# widthToCopy = qMincxx . . $ qMin(2a338fce5842aa6a).(byteTileWidth, byteWidth - byteOffset); |
| 474 | for (quint32cxx . . $ quint32# i = 0; i < linesToCopy; i++) { |
| 475 | ::memcpy(image->scanLinecxx . . $ QImage#scanLine(f18dc31a6ecbac56).(y + i) + byteOffset, buf + (i * byteTileWidth), widthToCopy); |
| 476 | } |
| 477 | } |
| 478 | } |
| 479 | _TIFFfree(buf); |
| 480 | } else { |
| 481 | if (image->bytesPerLinecxx . . $ QImage#bytesPerLine(455f465bc33b4cdf).() < TIFFScanlineSize(tiff)) { |
| 482 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 483 | return false; |
| 484 | } |
| 485 | for (uint32_tcxx . . $ uint32_t# y=0; y<height; ++y) { |
| 486 | if (TIFFReadScanline(tiff, image->scanLinecxx . . $ QImage#scanLine(f18dc31a6ecbac56).(y), y, 0) < 0) { |
| 487 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 488 | return false; |
| 489 | } |
| 490 | } |
| 491 | } |
| 492 | if (format == QImagecxx . . $ QImage#::Format_RGBX64cxx . . $ QImage#Format_RGBX64.) |
| 493 | rgb48fixupcxx . . $ QTiffHandler#rgb48fixup(704f3a01150ff264).(image); |
| 494 | } else { |
| 495 | const int stopOnError = 1; |
| 496 | if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32_tcxx . . $ uint32_t# *>(image->bitscxx . . $ QImage#bits(37d8967d10cb1e7b).()), qt2Exifcxx . . $ qt2Exif(a68312a2d7b03b35).(dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).transformationcxx . . $ QTiffHandlerPrivate#transformation.), stopOnError)) { |
| 497 | for (uint32_tcxx . . $ uint32_t# y=0; y<height; ++y) |
| 498 | convert32BitOrdercxx . . $ QTiffHandler#convert32BitOrder(d0320739773070f2).(image->scanLinecxx . . $ QImage#scanLine(f18dc31a6ecbac56).(y), width); |
| 499 | } else { |
| 500 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).closecxx . . $ QTiffHandlerPrivate#close(49f6e7a06ebc5aa8).(); |
| 501 | return false; |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | |
| 506 | float resX = 0; |
| 507 | float resY = 0; |
| 508 | uint16_tcxx . . $ uint16_t# resUnit; |
| 509 | if (!TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNITcxx . . $ `<external>/3587304560481274643/tiff.h:287:9`!, &resUnit)) |
| 510 | resUnit = RESUNIT_INCHcxx . . $ `<external>/3587304560481274643/tiff.h:289:9`!; |
| 511 | |
| 512 | if (TIFFGetField(tiff, TIFFTAG_XRESOLUTIONcxx . . $ `<external>/3587304560481274643/tiff.h:262:9`!, &resX) |
| 513 | && TIFFGetField(tiff, TIFFTAG_YRESOLUTIONcxx . . $ `<external>/3587304560481274643/tiff.h:263:9`!, &resY)) { |
| 514 | |
| 515 | switch(resUnit) { |
| 516 | case RESUNIT_CENTIMETERcxx . . $ `<external>/3587304560481274643/tiff.h:290:9`!: |
| 517 | image->setDotsPerMeterXcxx . . $ QImage#setDotsPerMeterX(d4f767463ce0a6b3).(qRoundcxx . . $ qRound(1bb0578f3efdc255).(resX * 100)); |
| 518 | image->setDotsPerMeterYcxx . . $ QImage#setDotsPerMeterY(d4f767463ce0a6b3).(qRoundcxx . . $ qRound(1bb0578f3efdc255).(resY * 100)); |
| 519 | break; |
| 520 | case RESUNIT_INCHcxx . . $ `<external>/3587304560481274643/tiff.h:289:9`!: |
| 521 | image->setDotsPerMeterXcxx . . $ QImage#setDotsPerMeterX(d4f767463ce0a6b3).(qRoundcxx . . $ qRound(620b9ac44d2573a6).(resX * (100 / 2.54))); |
| 522 | image->setDotsPerMeterYcxx . . $ QImage#setDotsPerMeterY(d4f767463ce0a6b3).(qRoundcxx . . $ qRound(620b9ac44d2573a6).(resY * (100 / 2.54))); |
| 523 | break; |
| 524 | default: |
| 525 | // do nothing as defaults have already |
| 526 | // been set within the QImage class |
| 527 | break; |
| 528 | } |
| 529 | } |
| 530 | |
| 531 | uint32_tcxx . . $ uint32_t# count; |
| 532 | void *profile; |
| 533 | if (TIFFGetField(tiff, TIFFTAG_ICCPROFILEcxx . . $ `<external>/3587304560481274643/tiff.h:479:9`!, &count, &profile)) { |
| 534 | QByteArraycxx . . $ QByteArray# iccProfilecxx . . $ QByteArray#QByteArray(34d26762b42c433a).(reinterpret_cast<const char *>(profile), count); |
| 535 | image->setColorSpacecxx . . $ QImage#setColorSpace(2de784921415d79f).(QColorSpacecxx . . $ QColorSpace#::fromIccProfilecxx . . $ QColorSpace#fromIccProfile(6f53d2c777ddbb7d).(iccProfile)); |
| 536 | } |
| 537 | // We do not handle colorimetric metadat not on ICC profile form, it seems to be a lot |
| 538 | // less common, and would need additional API in QColorSpace. |
| 539 | |
| 540 | return true; |
| 541 | } |
| 542 | |
| 543 | static bool checkGrayscalecxx . . $ checkGrayscale(663867f4909b9266).(const QVectorcxx . . $ QVector#<QRgbcxx . . $ QRgb#> &colorTable) |
| 544 | { |
| 545 | if (colorTable.sizecxx . . $ QVector#size(455f465bc33b4cdf).() != 256) |
| 546 | return false; |
| 547 | |
| 548 | const bool increasing = (colorTable.atcxx . . $ QVector#at(e2681f9bb6b2f357).(0) == 0xff000000); |
| 549 | for (int i = 0; i < 256; ++i) { |
| 550 | if ((increasing && colorTable.atcxx . . $ QVector#at(e2681f9bb6b2f357).(i) != qRgbcxx . . $ qRgb(530956271a9518a5).(i, i, i)) |
| 551 | || (!increasing && colorTable.atcxx . . $ QVector#at(e2681f9bb6b2f357).(i) != qRgbcxx . . $ qRgb(530956271a9518a5).(255 - i, 255 - i, 255 - i))) |
| 552 | return false; |
| 553 | } |
| 554 | return true; |
| 555 | } |
| 556 | |
| 557 | static QVectorcxx . . $ QVector#<QRgbcxx . . $ QRgb#> effectiveColorTablecxx . . $ effectiveColorTable(4fe82e0255d6ae73).(const QImagecxx . . $ QImage# &image) |
| 558 | { |
| 559 | QVectorcxx . . $ QVector#<QRgbcxx . . $ QRgb#> colorscxx . . $ QVector#QVector(ced63f7c635d850d).; |
| 560 | switch (image.formatcxx . . $ QImage#format(18a95330327ec5b8).()) { |
| 561 | case QImagecxx . . $ QImage#::Format_Indexed8cxx . . $ QImage#Format_Indexed8.: |
| 562 | colors =cxx . . $ QVector#`operator=`(70978f0ed5016e46). image.colorTablecxx . . $ QImage#colorTable(74d2aeddae6a4bc9).(); |
| 563 | break; |
| 564 | case QImagecxx . . $ QImage#::Format_Alpha8cxx . . $ QImage#Format_Alpha8.: |
| 565 | colors.resizecxx . . $ QVector#resize(d4f767463ce0a6b3).(256); |
| 566 | for (int i = 0; i < 256; ++i) |
| 567 | colors[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).i] = qRgbacxx . . $ qRgba(7a6d2d8711beacc4).(0, 0, 0, i); |
| 568 | break; |
| 569 | case QImagecxx . . $ QImage#::Format_Grayscale8cxx . . $ QImage#Format_Grayscale8.: |
| 570 | case QImagecxx . . $ QImage#::Format_Grayscale16cxx . . $ QImage#Format_Grayscale16.: |
| 571 | colors.resizecxx . . $ QVector#resize(d4f767463ce0a6b3).(256); |
| 572 | for (int i = 0; i < 256; ++i) |
| 573 | colors[cxx . . $ QVector#`operator[]`(7a0ef1c7079e8533).i] = qRgbcxx . . $ qRgb(530956271a9518a5).(i, i, i); |
| 574 | break; |
| 575 | default: |
| 576 | Q_UNREACHABLEcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:1363:9`!(); |
| 577 | } |
| 578 | return colorscxx . . $ QVector#QVector(a0d8f1cfe28f0150).; |
| 579 | } |
| 580 | |
| 581 | static quint32cxx . . $ quint32# defaultStripSizecxx . . $ defaultStripSize(67626842def46744).(TIFF *tiff) |
| 582 | { |
| 583 | // Aim for 4MB strips |
| 584 | qint64cxx . . $ qint64# scanSize = qMaxcxx . . $ qMax(2a338fce5842aa6a).(qint64cxx . . $ qint64#(1), qint64cxx . . $ qint64#(TIFFScanlineSize(tiff))); |
| 585 | qint64cxx . . $ qint64# numRows = (4 * 1024 * 1024) / scanSize; |
| 586 | quint32cxx . . $ quint32# reqSize = static_cast<quint32cxx . . $ quint32#>(qBoundcxx . . $ qBound(3dbe0c69cb86ae06).(qint64cxx . . $ qint64#(1), numRows, qint64cxx . . $ qint64#(UINT_MAXcxx . . $ `<external>/67164224788392828/limits.h:124:9`!))); |
| 587 | return TIFFDefaultStripSize(tiff, reqSize); |
| 588 | } |
| 589 | |
| 590 | bool QTiffHandlercxx . . $ QTiffHandler#::writecxx . . $ QTiffHandler#write(73afe20316494619).(const QImagecxx . . $ QImage# &image) |
| 591 | { |
| 592 | if (!devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).()->isWritablecxx . . $ QIODevice#isWritable(50ce9a9e25b4a850).()) |
| 593 | return false; |
| 594 | |
| 595 | TIFF *const tiff = TIFFClientOpen("foo", |
| 596 | "wB", |
| 597 | devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).(), |
| 598 | qtiffReadProccxx . . $ qtiffReadProc(45df71ebdb98f7e0)., |
| 599 | qtiffWriteProccxx . . $ qtiffWriteProc(45df71ebdb98f7e0)., |
| 600 | qtiffSeekProccxx . . $ qtiffSeekProc(d07fab68d5b55d71)., |
| 601 | qtiffCloseProccxx . . $ qtiffCloseProc(dedf1e9b1c614a07)., |
| 602 | qtiffSizeProccxx . . $ qtiffSizeProc(751e5d26f8574c32)., |
| 603 | qtiffMapProccxx . . $ qtiffMapProc(75bc687cc19be944)., |
| 604 | qtiffUnmapProccxx . . $ qtiffUnmapProc(d02d295a36f87ec9).); |
| 605 | if (!tiff) |
| 606 | return false; |
| 607 | |
| 608 | const int width = image.widthcxx . . $ QImage#width(455f465bc33b4cdf).(); |
| 609 | const int height = image.heightcxx . . $ QImage#height(455f465bc33b4cdf).(); |
| 610 | const int compression = dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).compressioncxx . . $ QTiffHandlerPrivate#compression.; |
| 611 | |
| 612 | if (!TIFFSetField(tiff, TIFFTAG_IMAGEWIDTHcxx . . $ `<external>/3587304560481274643/tiff.h:178:9`!, width) |
| 613 | || !TIFFSetField(tiff, TIFFTAG_IMAGELENGTHcxx . . $ `<external>/3587304560481274643/tiff.h:179:9`!, height) |
| 614 | || !TIFFSetField(tiff, TIFFTAG_PLANARCONFIGcxx . . $ `<external>/3587304560481274643/tiff.h:264:9`!, PLANARCONFIG_CONTIGcxx . . $ `<external>/3587304560481274643/tiff.h:265:9`!)) { |
| 615 | TIFFClose(tiff); |
| 616 | return false; |
| 617 | } |
| 618 | |
| 619 | // set the resolution |
| 620 | bool resolutionSet = false; |
| 621 | const int dotPerMeterX = image.dotsPerMeterXcxx . . $ QImage#dotsPerMeterX(455f465bc33b4cdf).(); |
| 622 | const int dotPerMeterY = image.dotsPerMeterYcxx . . $ QImage#dotsPerMeterY(455f465bc33b4cdf).(); |
| 623 | if ((dotPerMeterX % 100) == 0 |
| 624 | && (dotPerMeterY % 100) == 0) { |
| 625 | resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNITcxx . . $ `<external>/3587304560481274643/tiff.h:287:9`!, RESUNIT_CENTIMETERcxx . . $ `<external>/3587304560481274643/tiff.h:290:9`!) |
| 626 | && TIFFSetField(tiff, TIFFTAG_XRESOLUTIONcxx . . $ `<external>/3587304560481274643/tiff.h:262:9`!, dotPerMeterX/100.0) |
| 627 | && TIFFSetField(tiff, TIFFTAG_YRESOLUTIONcxx . . $ `<external>/3587304560481274643/tiff.h:263:9`!, dotPerMeterY/100.0); |
| 628 | } else { |
| 629 | resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNITcxx . . $ `<external>/3587304560481274643/tiff.h:287:9`!, RESUNIT_INCHcxx . . $ `<external>/3587304560481274643/tiff.h:289:9`!) |
| 630 | && TIFFSetField(tiff, TIFFTAG_XRESOLUTIONcxx . . $ `<external>/3587304560481274643/tiff.h:262:9`!, static_cast<float>(image.logicalDpiXcxx . . $ QPaintDevice#logicalDpiX(455f465bc33b4cdf).())) |
| 631 | && TIFFSetField(tiff, TIFFTAG_YRESOLUTIONcxx . . $ `<external>/3587304560481274643/tiff.h:263:9`!, static_cast<float>(image.logicalDpiYcxx . . $ QPaintDevice#logicalDpiY(455f465bc33b4cdf).())); |
| 632 | } |
| 633 | if (!resolutionSet) { |
| 634 | TIFFClose(tiff); |
| 635 | return false; |
| 636 | } |
| 637 | // set the orienataion |
| 638 | bool orientationSet = false; |
| 639 | orientationSet = TIFFSetField(tiff, TIFFTAG_ORIENTATIONcxx . . $ `<external>/3587304560481274643/tiff.h:248:9`!, qt2Exifcxx . . $ qt2Exif(a68312a2d7b03b35).(dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).transformationcxx . . $ QTiffHandlerPrivate#transformation.)); |
| 640 | if (!orientationSet) { |
| 641 | TIFFClose(tiff); |
| 642 | return false; |
| 643 | } |
| 644 | // set color space |
| 645 | if (image.colorSpacecxx . . $ QImage#colorSpace(c90390460279a559).().isValidcxx . . $ QColorSpace#isValid(3482b152b9333168).()) { |
| 646 | QByteArraycxx . . $ QByteArray# iccProfile = image.colorSpacecxx . . $ QImage#colorSpace(c90390460279a559).().iccProfilecxx . . $ QColorSpace#iccProfile(a96750bfbcb1fbe9).(); |
| 647 | if (!TIFFSetField(tiff, TIFFTAG_ICCPROFILEcxx . . $ `<external>/3587304560481274643/tiff.h:479:9`!, iccProfile.sizecxx . . $ QByteArray#size(455f465bc33b4cdf).(), reinterpret_cast<const void *>(iccProfile.constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).()))) { |
| 648 | TIFFClose(tiff); |
| 649 | return false; |
| 650 | } |
| 651 | } |
| 652 | // configure image depth |
| 653 | const QImagecxx . . $ QImage#::Formatcxx . . $ QImage#Format# format = image.formatcxx . . $ QImage#format(18a95330327ec5b8).(); |
| 654 | if (format == QImagecxx . . $ QImage#::Format_Monocxx . . $ QImage#Format_Mono. || format == QImagecxx . . $ QImage#::Format_MonoLSBcxx . . $ QImage#Format_MonoLSB.) { |
| 655 | uint16_tcxx . . $ uint16_t# photometric = PHOTOMETRIC_MINISBLACKcxx . . $ `<external>/3587304560481274643/tiff.h:222:9`!; |
| 656 | if (image.colorTablecxx . . $ QImage#colorTable(74d2aeddae6a4bc9).().atcxx . . $ QVector#at(e2681f9bb6b2f357).(0) == 0xffffffff) |
| 657 | photometric = PHOTOMETRIC_MINISWHITEcxx . . $ `<external>/3587304560481274643/tiff.h:221:9`!; |
| 658 | if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRICcxx . . $ `<external>/3587304560481274643/tiff.h:220:9`!, photometric) |
| 659 | || !TIFFSetField(tiff, TIFFTAG_COMPRESSIONcxx . . $ `<external>/3587304560481274643/tiff.h:181:9`!, compression == NoCompressioncxx . . $ QTiffHandler#NoCompression. ? COMPRESSION_NONEcxx . . $ `<external>/3587304560481274643/tiff.h:182:9`! : COMPRESSION_LZWcxx . . $ `<external>/3587304560481274643/tiff.h:188:9`!) |
| 660 | || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLEcxx . . $ `<external>/3587304560481274643/tiff.h:180:9`!, 1) |
| 661 | || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIPcxx . . $ `<external>/3587304560481274643/tiff.h:258:9`!, defaultStripSizecxx . . $ defaultStripSize(67626842def46744).(tiff))) { |
| 662 | TIFFClose(tiff); |
| 663 | return false; |
| 664 | } |
| 665 | |
| 666 | // try to do the conversion in chunks no greater than 16 MB |
| 667 | const int chunks = int(image.sizeInBytescxx . . $ QImage#sizeInBytes(98833e9ab7de59a4).() / (1024 * 1024 * 16)) + 1; |
| 668 | const int chunkHeight = qMaxcxx . . $ qMax(2a338fce5842aa6a).(height / chunks, 1); |
| 669 | |
| 670 | int y = 0; |
| 671 | while (y < height) { |
| 672 | QImagecxx . . $ QImage# chunk = image.copycxx . . $ QImage#copy(8ee0c0fba042168e).(0, y, width, qMincxx . . $ qMin(2a338fce5842aa6a).(chunkHeight, height - y)).convertToFormatcxx . . $ QImage#convertToFormat(17f068fded86ac61).(QImagecxx . . $ QImage#::Format_Monocxx . . $ QImage#Format_Mono.); |
| 673 | |
| 674 | int chunkStart = y; |
| 675 | int chunkEnd = y + chunk.heightcxx . . $ QImage#height(455f465bc33b4cdf).(); |
| 676 | while (y < chunkEnd) { |
| 677 | if (TIFFWriteScanline(tiff, reinterpret_cast<uint32_tcxx . . $ uint32_t# *>(chunk.scanLinecxx . . $ QImage#scanLine(f18dc31a6ecbac56).(y - chunkStart)), y) != 1) { |
| 678 | TIFFClose(tiff); |
| 679 | return false; |
| 680 | } |
| 681 | ++y; |
| 682 | } |
| 683 | } |
| 684 | TIFFClose(tiff); |
| 685 | } else if (format == QImagecxx . . $ QImage#::Format_Indexed8cxx . . $ QImage#Format_Indexed8. |
| 686 | || format == QImagecxx . . $ QImage#::Format_Grayscale8cxx . . $ QImage#Format_Grayscale8. |
| 687 | || format == QImagecxx . . $ QImage#::Format_Grayscale16cxx . . $ QImage#Format_Grayscale16. |
| 688 | || format == QImagecxx . . $ QImage#::Format_Alpha8cxx . . $ QImage#Format_Alpha8.) { |
| 689 | QVectorcxx . . $ QVector#<QRgbcxx . . $ QRgb#> colorTable = effectiveColorTablecxx . . $ effectiveColorTable(4fe82e0255d6ae73).(image); |
| 690 | bool isGrayscale = checkGrayscalecxx . . $ checkGrayscale(663867f4909b9266).(colorTable); |
| 691 | if (isGrayscale) { |
| 692 | uint16_tcxx . . $ uint16_t# photometric = PHOTOMETRIC_MINISBLACKcxx . . $ `<external>/3587304560481274643/tiff.h:222:9`!; |
| 693 | if (colorTable.atcxx . . $ QVector#at(e2681f9bb6b2f357).(0) == 0xffffffff) |
| 694 | photometric = PHOTOMETRIC_MINISWHITEcxx . . $ `<external>/3587304560481274643/tiff.h:221:9`!; |
| 695 | if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRICcxx . . $ `<external>/3587304560481274643/tiff.h:220:9`!, photometric) |
| 696 | || !TIFFSetField(tiff, TIFFTAG_COMPRESSIONcxx . . $ `<external>/3587304560481274643/tiff.h:181:9`!, compression == NoCompressioncxx . . $ QTiffHandler#NoCompression. ? COMPRESSION_NONEcxx . . $ `<external>/3587304560481274643/tiff.h:182:9`! : COMPRESSION_LZWcxx . . $ `<external>/3587304560481274643/tiff.h:188:9`!) |
| 697 | || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLEcxx . . $ `<external>/3587304560481274643/tiff.h:180:9`!, image.depthcxx . . $ QImage#depth(455f465bc33b4cdf).()) |
| 698 | || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIPcxx . . $ `<external>/3587304560481274643/tiff.h:258:9`!, defaultStripSizecxx . . $ defaultStripSize(67626842def46744).(tiff))) { |
| 699 | TIFFClose(tiff); |
| 700 | return false; |
| 701 | } |
| 702 | } else { |
| 703 | if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRICcxx . . $ `<external>/3587304560481274643/tiff.h:220:9`!, PHOTOMETRIC_PALETTEcxx . . $ `<external>/3587304560481274643/tiff.h:224:9`!) |
| 704 | || !TIFFSetField(tiff, TIFFTAG_COMPRESSIONcxx . . $ `<external>/3587304560481274643/tiff.h:181:9`!, compression == NoCompressioncxx . . $ QTiffHandler#NoCompression. ? COMPRESSION_NONEcxx . . $ `<external>/3587304560481274643/tiff.h:182:9`! : COMPRESSION_LZWcxx . . $ `<external>/3587304560481274643/tiff.h:188:9`!) |
| 705 | || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLEcxx . . $ `<external>/3587304560481274643/tiff.h:180:9`!, 8) |
| 706 | || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIPcxx . . $ `<external>/3587304560481274643/tiff.h:258:9`!, defaultStripSizecxx . . $ defaultStripSize(67626842def46744).(tiff))) { |
| 707 | TIFFClose(tiff); |
| 708 | return false; |
| 709 | } |
| 710 | //// write the color table |
| 711 | // allocate the color tables |
| 712 | const int tableSize = colorTable.sizecxx . . $ QVector#size(455f465bc33b4cdf).(); |
| 713 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!(tableSize <= 256); |
| 714 | QVarLengthArraycxx . . $ QVarLengthArray#<uint16_tcxx . . $ uint16_t#> redTablecxx . . $ QVarLengthArray#QVarLengthArray(d4f767463ce0a6b3).(tableSize); |
| 715 | QVarLengthArraycxx . . $ QVarLengthArray#<uint16_tcxx . . $ uint16_t#> greenTablecxx . . $ QVarLengthArray#QVarLengthArray(d4f767463ce0a6b3).(tableSize); |
| 716 | QVarLengthArraycxx . . $ QVarLengthArray#<uint16_tcxx . . $ uint16_t#> blueTablecxx . . $ QVarLengthArray#QVarLengthArray(d4f767463ce0a6b3).(tableSize); |
| 717 | |
| 718 | // set the color table |
| 719 | for (int i = 0; i<tableSize; ++i) { |
| 720 | const QRgbcxx . . $ QRgb# color = colorTable.atcxx . . $ QVector#at(e2681f9bb6b2f357).(i); |
| 721 | redTable[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).i] = qRedcxx . . $ qRed(4c679297bf94b9eb).(color) * 257; |
| 722 | greenTable[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).i] = qGreencxx . . $ qGreen(4c679297bf94b9eb).(color) * 257; |
| 723 | blueTable[cxx . . $ QVarLengthArray#`operator[]`(7a0ef1c7079e8533).i] = qBluecxx . . $ qBlue(4c679297bf94b9eb).(color) * 257; |
| 724 | } |
| 725 | |
| 726 | const bool setColorTableSuccess = TIFFSetField(tiff, TIFFTAG_COLORMAPcxx . . $ `<external>/3587304560481274643/tiff.h:309:9`!, redTable.datacxx . . $ QVarLengthArray#data(155dc7f103cdb9db).(), greenTable.datacxx . . $ QVarLengthArray#data(155dc7f103cdb9db).(), blueTable.datacxx . . $ QVarLengthArray#data(155dc7f103cdb9db).()); |
| 727 | |
| 728 | if (!setColorTableSuccess) { |
| 729 | TIFFClose(tiff); |
| 730 | return false; |
| 731 | } |
| 732 | } |
| 733 | |
| 734 | //// write the data |
| 735 | for (int y = 0; y < height; ++y) { |
| 736 | if (TIFFWriteScanline(tiff, const_cast<ucharcxx . . $ uchar# *>(image.scanLinecxx . . $ QImage#scanLine(280d4429970bac4e).(y)), y) != 1) { |
| 737 | TIFFClose(tiff); |
| 738 | return false; |
| 739 | } |
| 740 | } |
| 741 | TIFFClose(tiff); |
| 742 | } else if (format == QImagecxx . . $ QImage#::Format_RGBX64cxx . . $ QImage#Format_RGBX64.) { |
| 743 | if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRICcxx . . $ `<external>/3587304560481274643/tiff.h:220:9`!, PHOTOMETRIC_RGBcxx . . $ `<external>/3587304560481274643/tiff.h:223:9`!) |
| 744 | || !TIFFSetField(tiff, TIFFTAG_COMPRESSIONcxx . . $ `<external>/3587304560481274643/tiff.h:181:9`!, compression == NoCompressioncxx . . $ QTiffHandler#NoCompression. ? COMPRESSION_NONEcxx . . $ `<external>/3587304560481274643/tiff.h:182:9`! : COMPRESSION_LZWcxx . . $ `<external>/3587304560481274643/tiff.h:188:9`!) |
| 745 | || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXELcxx . . $ `<external>/3587304560481274643/tiff.h:257:9`!, 3) |
| 746 | || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLEcxx . . $ `<external>/3587304560481274643/tiff.h:180:9`!, 16) |
| 747 | || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIPcxx . . $ `<external>/3587304560481274643/tiff.h:258:9`!, TIFFDefaultStripSize(tiff, 0))) { |
| 748 | TIFFClose(tiff); |
| 749 | return false; |
| 750 | } |
| 751 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<quint16cxx . . $ quint16#[]> rgb48linecxx . . $ std/unique_ptr#unique_ptr(2bd1d077c542d025).(new quint16cxx . . $ quint16#[width * 3]); |
| 752 | for (int y = 0; y < height; ++y) { |
| 753 | const quint16cxx . . $ quint16# *srcLine = reinterpret_cast<const quint16cxx . . $ quint16# *>(image.constScanLinecxx . . $ QImage#constScanLine(280d4429970bac4e).(y)); |
| 754 | for (int x = 0; x < width; ++x) { |
| 755 | rgb48line[cxx . . $ std/unique_ptr#`operator[]`(d29315ade3bf818e).x * 3 + 0] = srcLine[x * 4 + 0]; |
| 756 | rgb48line[cxx . . $ std/unique_ptr#`operator[]`(d29315ade3bf818e).x * 3 + 1] = srcLine[x * 4 + 1]; |
| 757 | rgb48line[cxx . . $ std/unique_ptr#`operator[]`(d29315ade3bf818e).x * 3 + 2] = srcLine[x * 4 + 2]; |
| 758 | } |
| 759 | |
| 760 | if (TIFFWriteScanline(tiff, (void*)rgb48line.getcxx . . $ std/unique_ptr#get(ea7391e9eeeaf20e).(), y) != 1) { |
| 761 | TIFFClose(tiff); |
| 762 | return false; |
| 763 | } |
| 764 | } |
| 765 | TIFFClose(tiff); |
| 766 | } else if (format == QImagecxx . . $ QImage#::Format_RGBA64cxx . . $ QImage#Format_RGBA64. |
| 767 | || format == QImagecxx . . $ QImage#::Format_RGBA64_Premultipliedcxx . . $ QImage#Format_RGBA64_Premultiplied.) { |
| 768 | const bool premultiplied = image.formatcxx . . $ QImage#format(18a95330327ec5b8).() != QImagecxx . . $ QImage#::Format_RGBA64cxx . . $ QImage#Format_RGBA64.; |
| 769 | const uint16_tcxx . . $ uint16_t# extrasamples = premultiplied ? EXTRASAMPLE_ASSOCALPHAcxx . . $ `<external>/3587304560481274643/tiff.h:331:9`! : EXTRASAMPLE_UNASSALPHAcxx . . $ `<external>/3587304560481274643/tiff.h:332:9`!; |
| 770 | if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRICcxx . . $ `<external>/3587304560481274643/tiff.h:220:9`!, PHOTOMETRIC_RGBcxx . . $ `<external>/3587304560481274643/tiff.h:223:9`!) |
| 771 | || !TIFFSetField(tiff, TIFFTAG_COMPRESSIONcxx . . $ `<external>/3587304560481274643/tiff.h:181:9`!, compression == NoCompressioncxx . . $ QTiffHandler#NoCompression. ? COMPRESSION_NONEcxx . . $ `<external>/3587304560481274643/tiff.h:182:9`! : COMPRESSION_LZWcxx . . $ `<external>/3587304560481274643/tiff.h:188:9`!) |
| 772 | || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXELcxx . . $ `<external>/3587304560481274643/tiff.h:257:9`!, 4) |
| 773 | || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLEcxx . . $ `<external>/3587304560481274643/tiff.h:180:9`!, 16) |
| 774 | || !TIFFSetField(tiff, TIFFTAG_EXTRASAMPLEScxx . . $ `<external>/3587304560481274643/tiff.h:329:9`!, 1, &extrasamples) |
| 775 | || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIPcxx . . $ `<external>/3587304560481274643/tiff.h:258:9`!, TIFFDefaultStripSize(tiff, 0))) { |
| 776 | TIFFClose(tiff); |
| 777 | return false; |
| 778 | } |
| 779 | for (int y = 0; y < height; ++y) { |
| 780 | if (TIFFWriteScanline(tiff, (void*)image.scanLinecxx . . $ QImage#scanLine(280d4429970bac4e).(y), y) != 1) { |
| 781 | TIFFClose(tiff); |
| 782 | return false; |
| 783 | } |
| 784 | } |
| 785 | TIFFClose(tiff); |
| 786 | } else if (!image.hasAlphaChannelcxx . . $ QImage#hasAlphaChannel(50ce9a9e25b4a850).()) { |
| 787 | if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRICcxx . . $ `<external>/3587304560481274643/tiff.h:220:9`!, PHOTOMETRIC_RGBcxx . . $ `<external>/3587304560481274643/tiff.h:223:9`!) |
| 788 | || !TIFFSetField(tiff, TIFFTAG_COMPRESSIONcxx . . $ `<external>/3587304560481274643/tiff.h:181:9`!, compression == NoCompressioncxx . . $ QTiffHandler#NoCompression. ? COMPRESSION_NONEcxx . . $ `<external>/3587304560481274643/tiff.h:182:9`! : COMPRESSION_LZWcxx . . $ `<external>/3587304560481274643/tiff.h:188:9`!) |
| 789 | || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXELcxx . . $ `<external>/3587304560481274643/tiff.h:257:9`!, 3) |
| 790 | || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLEcxx . . $ `<external>/3587304560481274643/tiff.h:180:9`!, 8) |
| 791 | || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIPcxx . . $ `<external>/3587304560481274643/tiff.h:258:9`!, defaultStripSizecxx . . $ defaultStripSize(67626842def46744).(tiff))) { |
| 792 | TIFFClose(tiff); |
| 793 | return false; |
| 794 | } |
| 795 | // try to do the RGB888 conversion in chunks no greater than 16 MB |
| 796 | const int chunks = int(image.sizeInBytescxx . . $ QImage#sizeInBytes(98833e9ab7de59a4).() / (1024 * 1024 * 16)) + 1; |
| 797 | const int chunkHeight = qMaxcxx . . $ qMax(2a338fce5842aa6a).(height / chunks, 1); |
| 798 | |
| 799 | int y = 0; |
| 800 | while (y < height) { |
| 801 | const QImagecxx . . $ QImage# chunk = image.copycxx . . $ QImage#copy(8ee0c0fba042168e).(0, y, width, qMincxx . . $ qMin(2a338fce5842aa6a).(chunkHeight, height - y)).convertToFormatcxx . . $ QImage#convertToFormat(17f068fded86ac61).(QImagecxx . . $ QImage#::Format_RGB888cxx . . $ QImage#Format_RGB888.); |
| 802 | |
| 803 | int chunkStart = y; |
| 804 | int chunkEnd = y + chunk.heightcxx . . $ QImage#height(455f465bc33b4cdf).(); |
| 805 | while (y < chunkEnd) { |
| 806 | if (TIFFWriteScanline(tiff, (void*)chunk.scanLinecxx . . $ QImage#scanLine(280d4429970bac4e).(y - chunkStart), y) != 1) { |
| 807 | TIFFClose(tiff); |
| 808 | return false; |
| 809 | } |
| 810 | ++y; |
| 811 | } |
| 812 | } |
| 813 | TIFFClose(tiff); |
| 814 | } else { |
| 815 | const bool premultiplied = image.formatcxx . . $ QImage#format(18a95330327ec5b8).() != QImagecxx . . $ QImage#::Format_ARGB32cxx . . $ QImage#Format_ARGB32. |
| 816 | && image.formatcxx . . $ QImage#format(18a95330327ec5b8).() != QImagecxx . . $ QImage#::Format_RGBA8888cxx . . $ QImage#Format_RGBA8888.; |
| 817 | const uint16_tcxx . . $ uint16_t# extrasamples = premultiplied ? EXTRASAMPLE_ASSOCALPHAcxx . . $ `<external>/3587304560481274643/tiff.h:331:9`! : EXTRASAMPLE_UNASSALPHAcxx . . $ `<external>/3587304560481274643/tiff.h:332:9`!; |
| 818 | if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRICcxx . . $ `<external>/3587304560481274643/tiff.h:220:9`!, PHOTOMETRIC_RGBcxx . . $ `<external>/3587304560481274643/tiff.h:223:9`!) |
| 819 | || !TIFFSetField(tiff, TIFFTAG_COMPRESSIONcxx . . $ `<external>/3587304560481274643/tiff.h:181:9`!, compression == NoCompressioncxx . . $ QTiffHandler#NoCompression. ? COMPRESSION_NONEcxx . . $ `<external>/3587304560481274643/tiff.h:182:9`! : COMPRESSION_LZWcxx . . $ `<external>/3587304560481274643/tiff.h:188:9`!) |
| 820 | || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXELcxx . . $ `<external>/3587304560481274643/tiff.h:257:9`!, 4) |
| 821 | || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLEcxx . . $ `<external>/3587304560481274643/tiff.h:180:9`!, 8) |
| 822 | || !TIFFSetField(tiff, TIFFTAG_EXTRASAMPLEScxx . . $ `<external>/3587304560481274643/tiff.h:329:9`!, 1, &extrasamples) |
| 823 | || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIPcxx . . $ `<external>/3587304560481274643/tiff.h:258:9`!, defaultStripSizecxx . . $ defaultStripSize(67626842def46744).(tiff))) { |
| 824 | TIFFClose(tiff); |
| 825 | return false; |
| 826 | } |
| 827 | // try to do the RGBA8888 conversion in chunks no greater than 16 MB |
| 828 | const int chunks = int(image.sizeInBytescxx . . $ QImage#sizeInBytes(98833e9ab7de59a4).() / (1024 * 1024 * 16)) + 1; |
| 829 | const int chunkHeight = qMaxcxx . . $ qMax(2a338fce5842aa6a).(height / chunks, 1); |
| 830 | |
| 831 | const QImagecxx . . $ QImage#::Formatcxx . . $ QImage#Format# format = premultiplied ? QImagecxx . . $ QImage#::Format_RGBA8888_Premultipliedcxx . . $ QImage#Format_RGBA8888_Premultiplied. |
| 832 | : QImagecxx . . $ QImage#::Format_RGBA8888cxx . . $ QImage#Format_RGBA8888.; |
| 833 | int y = 0; |
| 834 | while (y < height) { |
| 835 | const QImagecxx . . $ QImage# chunk = image.copycxx . . $ QImage#copy(8ee0c0fba042168e).(0, y, width, qMincxx . . $ qMin(2a338fce5842aa6a).(chunkHeight, height - y)).convertToFormatcxx . . $ QImage#convertToFormat(17f068fded86ac61).(format); |
| 836 | |
| 837 | int chunkStart = y; |
| 838 | int chunkEnd = y + chunk.heightcxx . . $ QImage#height(455f465bc33b4cdf).(); |
| 839 | while (y < chunkEnd) { |
| 840 | if (TIFFWriteScanline(tiff, (void*)chunk.scanLinecxx . . $ QImage#scanLine(280d4429970bac4e).(y - chunkStart), y) != 1) { |
| 841 | TIFFClose(tiff); |
| 842 | return false; |
| 843 | } |
| 844 | ++y; |
| 845 | } |
| 846 | } |
| 847 | TIFFClose(tiff); |
| 848 | } |
| 849 | |
| 850 | return true; |
| 851 | } |
| 852 | |
| 853 | QVariantcxx . . $ QVariant# QTiffHandlercxx . . $ QTiffHandler#::optioncxx . . $ QTiffHandler#option(5e4f138555277744).(ImageOptioncxx . . $ QImageIOHandler#ImageOption# option) const |
| 854 | { |
| 855 | if (option == Sizecxx . . $ QImageIOHandler#Size. && canReadcxx . . $ QTiffHandler#canRead(50ce9a9e25b4a850).()) { |
| 856 | if (dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).readHeaderscxx . . $ QTiffHandlerPrivate#readHeaders(33ee36428ee918e7).(devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).())) |
| 857 | return dcxx . . $ QVariant#QVariant(1c5f201b4c2f0aba).->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).sizecxx . . $ QTiffHandlerPrivate#size.; |
| 858 | } else if (option == CompressionRatiocxx . . $ QImageIOHandler#CompressionRatio.) { |
| 859 | return dcxx . . $ QVariant#QVariant(d4f767463ce0a6b3).->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).compressioncxx . . $ QTiffHandlerPrivate#compression.; |
| 860 | } else if (option == ImageFormatcxx . . $ QImageIOHandler#ImageFormat.) { |
| 861 | if (dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).readHeaderscxx . . $ QTiffHandlerPrivate#readHeaders(33ee36428ee918e7).(devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).())) |
| 862 | return dcxx . . $ QVariant#QVariant(d4f767463ce0a6b3).->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).formatcxx . . $ QTiffHandlerPrivate#format.; |
| 863 | } else if (option == ImageTransformationcxx . . $ QImageIOHandler#ImageTransformation.) { |
| 864 | if (dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).readHeaderscxx . . $ QTiffHandlerPrivate#readHeaders(33ee36428ee918e7).(devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).())) |
| 865 | return intcxx . . $ QVariant#QVariant(d4f767463ce0a6b3).(dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).transformationcxx . . $ QTiffHandlerPrivate#transformation.); |
| 866 | } |
| 867 | return QVariantcxx . . $ QVariant#QVariant(ced63f7c635d850d).(); |
| 868 | } |
| 869 | |
| 870 | void QTiffHandlercxx . . $ QTiffHandler#::setOptioncxx . . $ QTiffHandler#setOption(eb42a208eb11d98f).(ImageOptioncxx . . $ QImageIOHandler#ImageOption# option, const QVariantcxx . . $ QVariant# &value) |
| 871 | { |
| 872 | if (option == CompressionRatiocxx . . $ QImageIOHandler#CompressionRatio. && value.typecxx . . $ QVariant#type(5e54638cd06c4ff1).() == QVariantcxx . . $ QVariant#::Intcxx . . $ QVariant#Int.) |
| 873 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).compressioncxx . . $ QTiffHandlerPrivate#compression. = qBoundcxx . . $ qBound(3dbe0c69cb86ae06).(0, value.toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(), 1); |
| 874 | if (option == ImageTransformationcxx . . $ QImageIOHandler#ImageTransformation.) { |
| 875 | int transformation = value.toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 876 | if (transformation > 0 && transformation < 8) |
| 877 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).transformationcxx . . $ QTiffHandlerPrivate#transformation. =cxx . . $ QFlags#`operator=`(614762fe853d85ac). QImageIOHandlercxx . . $ QImageIOHandler#::Transformationscxx . . $ QImageIOHandler#Transformations#(transformationcxx . . $ QFlag#QFlag(f349c77f591a7878).); |
| 878 | } |
| 879 | } |
| 880 | |
| 881 | bool QTiffHandlercxx . . $ QTiffHandler#::supportsOptioncxx . . $ QTiffHandler#supportsOption(55c593ff6d26ae20).(ImageOptioncxx . . $ QImageIOHandler#ImageOption# option) const |
| 882 | { |
| 883 | return option == CompressionRatiocxx . . $ QImageIOHandler#CompressionRatio. |
| 884 | || option == Sizecxx . . $ QImageIOHandler#Size. |
| 885 | || option == ImageFormatcxx . . $ QImageIOHandler#ImageFormat. |
| 886 | || option == ImageTransformationcxx . . $ QImageIOHandler#ImageTransformation. |
| 887 | || option == TransformedByDefaultcxx . . $ QImageIOHandler#TransformedByDefault.; |
| 888 | } |
| 889 | |
| 890 | bool QTiffHandlercxx . . $ QTiffHandler#::jumpToNextImagecxx . . $ QTiffHandler#jumpToNextImage(c9857a73d68e59ba).() |
| 891 | { |
| 892 | if (!ensureHaveDirectoryCountcxx . . $ QTiffHandler#ensureHaveDirectoryCount(50ce9a9e25b4a850).()) |
| 893 | return false; |
| 894 | if (dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).currentDirectorycxx . . $ QTiffHandlerPrivate#currentDirectory. >= dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).directoryCountcxx . . $ QTiffHandlerPrivate#directoryCount. - 1) |
| 895 | return false; |
| 896 | |
| 897 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).headersReadcxx . . $ QTiffHandlerPrivate#headersRead. = false; |
| 898 | ++dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).currentDirectorycxx . . $ QTiffHandlerPrivate#currentDirectory.; |
| 899 | return true; |
| 900 | } |
| 901 | |
| 902 | bool QTiffHandlercxx . . $ QTiffHandler#::jumpToImagecxx . . $ QTiffHandler#jumpToImage(83c267b20bac841a).(int imageNumber) |
| 903 | { |
| 904 | if (!ensureHaveDirectoryCountcxx . . $ QTiffHandler#ensureHaveDirectoryCount(50ce9a9e25b4a850).()) |
| 905 | return false; |
| 906 | if (imageNumber < 0 || imageNumber >= dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).directoryCountcxx . . $ QTiffHandlerPrivate#directoryCount.) |
| 907 | return false; |
| 908 | |
| 909 | if (dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).currentDirectorycxx . . $ QTiffHandlerPrivate#currentDirectory. != imageNumber) { |
| 910 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).headersReadcxx . . $ QTiffHandlerPrivate#headersRead. = false; |
| 911 | dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).currentDirectorycxx . . $ QTiffHandlerPrivate#currentDirectory. = imageNumber; |
| 912 | } |
| 913 | return true; |
| 914 | } |
| 915 | |
| 916 | int QTiffHandlercxx . . $ QTiffHandler#::imageCountcxx . . $ QTiffHandler#imageCount(455f465bc33b4cdf).() const |
| 917 | { |
| 918 | if (!ensureHaveDirectoryCountcxx . . $ QTiffHandler#ensureHaveDirectoryCount(50ce9a9e25b4a850).()) |
| 919 | return 1; |
| 920 | |
| 921 | return dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).directoryCountcxx . . $ QTiffHandlerPrivate#directoryCount.; |
| 922 | } |
| 923 | |
| 924 | int QTiffHandlercxx . . $ QTiffHandler#::currentImageNumbercxx . . $ QTiffHandler#currentImageNumber(455f465bc33b4cdf).() const |
| 925 | { |
| 926 | return dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).currentDirectorycxx . . $ QTiffHandlerPrivate#currentDirectory.; |
| 927 | } |
| 928 | |
| 929 | void QTiffHandlercxx . . $ QTiffHandler#::convert32BitOrdercxx . . $ QTiffHandler#convert32BitOrder(d0320739773070f2).(void *buffer, int width) |
| 930 | { |
| 931 | uint32_tcxx . . $ uint32_t# *target = reinterpret_cast<uint32_tcxx . . $ uint32_t# *>(buffer); |
| 932 | for (int32_t x=0; x<width; ++x) { |
| 933 | uint32_tcxx . . $ uint32_t# p = target[x]; |
| 934 | // convert between ARGB and ABGR |
| 935 | target[x] = (p & 0xff000000) |
| 936 | | ((p & 0x00ff0000) >> 16) |
| 937 | | (p & 0x0000ff00) |
| 938 | | ((p & 0x000000ff) << 16); |
| 939 | } |
| 940 | } |
| 941 | |
| 942 | void QTiffHandlercxx . . $ QTiffHandler#::rgb48fixupcxx . . $ QTiffHandler#rgb48fixup(704f3a01150ff264).(QImagecxx . . $ QImage# *image) |
| 943 | { |
| 944 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!(image->depth() == 64); |
| 945 | const int h = image->heightcxx . . $ QImage#height(455f465bc33b4cdf).(); |
| 946 | const int w = image->widthcxx . . $ QImage#width(455f465bc33b4cdf).(); |
| 947 | ucharcxx . . $ uchar# *scanline = image->bitscxx . . $ QImage#bits(37d8967d10cb1e7b).(); |
| 948 | const qsizetypecxx . . $ qsizetype# bpl = image->bytesPerLinecxx . . $ QImage#bytesPerLine(455f465bc33b4cdf).(); |
| 949 | for (int y = 0; y < h; ++y) { |
| 950 | quint16cxx . . $ quint16# *dst = reinterpret_cast<uint16_tcxx . . $ uint16_t# *>(scanline); |
| 951 | for (int x = w - 1; x >= 0; --x) { |
| 952 | dst[x * 4 + 3] = 0xffff; |
| 953 | dst[x * 4 + 2] = dst[x * 3 + 2]; |
| 954 | dst[x * 4 + 1] = dst[x * 3 + 1]; |
| 955 | dst[x * 4 + 0] = dst[x * 3 + 0]; |
| 956 | } |
| 957 | scanline += bpl; |
| 958 | } |
| 959 | } |
| 960 | |
| 961 | bool QTiffHandlercxx . . $ QTiffHandler#::ensureHaveDirectoryCountcxx . . $ QTiffHandler#ensureHaveDirectoryCount(50ce9a9e25b4a850).() const |
| 962 | { |
| 963 | if (dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).directoryCountcxx . . $ QTiffHandlerPrivate#directoryCount. > 0) |
| 964 | return true; |
| 965 | |
| 966 | TIFF *tiff = TIFFClientOpen("foo", |
| 967 | "r", |
| 968 | devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).(), |
| 969 | qtiffReadProccxx . . $ qtiffReadProc(45df71ebdb98f7e0)., |
| 970 | qtiffWriteProccxx . . $ qtiffWriteProc(45df71ebdb98f7e0)., |
| 971 | qtiffSeekProccxx . . $ qtiffSeekProc(d07fab68d5b55d71)., |
| 972 | qtiffCloseProccxx . . $ qtiffCloseProc(dedf1e9b1c614a07)., |
| 973 | qtiffSizeProccxx . . $ qtiffSizeProc(751e5d26f8574c32)., |
| 974 | qtiffMapProccxx . . $ qtiffMapProc(75bc687cc19be944)., |
| 975 | qtiffUnmapProccxx . . $ qtiffUnmapProc(d02d295a36f87ec9).); |
| 976 | if (!tiff) { |
| 977 | devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).()->resetcxx . . $ QIODevice#reset(c9857a73d68e59ba).(); |
| 978 | return false; |
| 979 | } |
| 980 | |
| 981 | do { |
| 982 | ++dcxx . . $ QTiffHandler#d.->cxx . . $ QScopedPointer#`operator->`(34d6acfd341ba7ab).directoryCountcxx . . $ QTiffHandlerPrivate#directoryCount.; |
| 983 | } while (TIFFReadDirectory(tiff)); |
| 984 | TIFFClose(tiff); |
| 985 | devicecxx . . $ QImageIOHandler#device(84cdc49e7936af4f).()->resetcxx . . $ QIODevice#reset(c9857a73d68e59ba).(); |
| 986 | return true; |
| 987 | } |
| 988 | |
| 989 | QT_END_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:149:10`! |