summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2021-05-04 14:09:43 +0200
committerEirik Aavitsland <eirik.aavitsland@qt.io>2021-05-25 11:02:09 +0200
commit2d8573f44106bda16466c210d32cc867d2bea227 (patch)
treed28ad6f403ca8fffbf5a661d3648c44f9d75ec5f /src/plugins
parent313d1812d37b4a5f7ca5c5adc7e2c5d3ca7be01f (diff)
downloadqtimageformats-2d8573f44106bda16466c210d32cc867d2bea227.tar.gz
Update bundled libtiff to version 4.3.0
[ChangeLog][Third-Party Code] Bundled libtiff was updated to version 4.3.0 Pick-to: 6.1 5.15 5.12 Change-Id: I4be8884394db6de7a2aedd4c41abc49a1e565917 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/imageformats/tiff/CMakeLists.txt6
-rw-r--r--src/plugins/imageformats/tiff/qtiffhandler.cpp58
2 files changed, 29 insertions, 35 deletions
diff --git a/src/plugins/imageformats/tiff/CMakeLists.txt b/src/plugins/imageformats/tiff/CMakeLists.txt
index acf81f7..0b87d4a 100644
--- a/src/plugins/imageformats/tiff/CMakeLists.txt
+++ b/src/plugins/imageformats/tiff/CMakeLists.txt
@@ -71,7 +71,6 @@ qt_internal_extend_target(QTiffPlugin CONDITION NOT QT_FEATURE_system_tiff
../../../3rdparty/libtiff/libtiff/tif_warning.c
../../../3rdparty/libtiff/libtiff/tif_write.c
../../../3rdparty/libtiff/libtiff/tif_zip.c
- ../../../3rdparty/libtiff/port/snprintf.c
INCLUDE_DIRECTORIES
../../../3rdparty/libtiff/libtiff
)
@@ -86,11 +85,6 @@ qt_internal_extend_target(QTiffPlugin CONDITION UNIX AND NOT QT_FEATURE_system_t
../../../3rdparty/libtiff/libtiff/tif_unix.c
)
-qt_internal_extend_target(QTiffPlugin CONDITION ANDROID AND NOT QT_FEATURE_system_tiff
- SOURCES
- ../../../3rdparty/libtiff/port/lfind.c
-)
-
qt_internal_extend_target(QTiffPlugin CONDITION QT_FEATURE_system_zlib AND NOT QT_FEATURE_system_tiff
LIBRARIES
WrapZLIB::WrapZLIB
diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp
index 417d89f..0897fa1 100644
--- a/src/plugins/imageformats/tiff/qtiffhandler.cpp
+++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp
@@ -116,7 +116,7 @@ public:
QImageIOHandler::Transformations transformation;
QImage::Format format;
QSize size;
- uint16 photometric;
+ uint16_t photometric;
bool grayscale;
bool headersRead;
int currentDirectory;
@@ -250,8 +250,8 @@ bool QTiffHandlerPrivate::readHeaders(QIODevice *device)
TIFFSetDirectory(tiff, currentDirectory);
- uint32 width;
- uint32 height;
+ uint32_t width;
+ uint32_t height;
if (!TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width)
|| !TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height)
|| !TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric)) {
@@ -260,15 +260,15 @@ bool QTiffHandlerPrivate::readHeaders(QIODevice *device)
}
size = QSize(width, height);
- uint16 orientationTag;
+ uint16_t orientationTag;
if (TIFFGetField(tiff, TIFFTAG_ORIENTATION, &orientationTag))
transformation = exif2Qt(orientationTag);
// BitsPerSample defaults to 1 according to the TIFF spec.
- uint16 bitPerSample;
+ uint16_t bitPerSample;
if (!TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitPerSample))
bitPerSample = 1;
- uint16 samplesPerPixel; // they may be e.g. grayscale with 2 samples per pixel
+ uint16_t samplesPerPixel; // they may be e.g. grayscale with 2 samples per pixel
if (!TIFFGetField(tiff, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel))
samplesPerPixel = 1;
@@ -288,8 +288,8 @@ bool QTiffHandlerPrivate::readHeaders(QIODevice *device)
else
format = QImage::Format_RGB32;
else {
- uint16 count;
- uint16 *extrasamples;
+ uint16_t count;
+ uint16_t *extrasamples;
// If there is any definition of the alpha-channel, libtiff will return premultiplied
// data to us. If there is none, libtiff will not touch it and we assume it to be
// non-premultiplied, matching behavior of tested image editors, and how older Qt
@@ -371,7 +371,7 @@ bool QTiffHandler::read(QImage *image)
}
image->setColorTable(colortable);
} else if (format == QImage::Format_Indexed8) {
- const uint16 tableSize = 256;
+ const uint16_t tableSize = 256;
QList<QRgb> qtColorTable(tableSize);
if (d->grayscale) {
for (int i = 0; i<tableSize; ++i) {
@@ -380,9 +380,9 @@ bool QTiffHandler::read(QImage *image)
}
} else {
// create the color table
- uint16 *redTable = 0;
- uint16 *greenTable = 0;
- uint16 *blueTable = 0;
+ uint16_t *redTable = 0;
+ uint16_t *greenTable = 0;
+ uint16_t *blueTable = 0;
if (!TIFFGetField(tiff, TIFFTAG_COLORMAP, &redTable, &greenTable, &blueTable)) {
d->close();
return false;
@@ -454,7 +454,7 @@ bool QTiffHandler::read(QImage *image)
d->close();
return false;
}
- for (uint32 y=0; y<height; ++y) {
+ for (uint32_t y=0; y<height; ++y) {
if (TIFFReadScanline(tiff, image->scanLine(y), y, 0) < 0) {
d->close();
return false;
@@ -465,8 +465,8 @@ bool QTiffHandler::read(QImage *image)
rgb48fixup(image);
} else {
const int stopOnError = 1;
- if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(image->bits()), qt2Exif(d->transformation), stopOnError)) {
- for (uint32 y=0; y<height; ++y)
+ if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32_t *>(image->bits()), qt2Exif(d->transformation), stopOnError)) {
+ for (uint32_t y=0; y<height; ++y)
convert32BitOrder(image->scanLine(y), width);
} else {
d->close();
@@ -477,7 +477,7 @@ bool QTiffHandler::read(QImage *image)
float resX = 0;
float resY = 0;
- uint16 resUnit;
+ uint16_t resUnit;
if (!TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit))
resUnit = RESUNIT_INCH;
@@ -500,7 +500,7 @@ bool QTiffHandler::read(QImage *image)
}
}
- uint32 count;
+ uint32_t count;
void *profile;
if (TIFFGetField(tiff, TIFFTAG_ICCPROFILE, &count, &profile)) {
QByteArray iccProfile(reinterpret_cast<const char *>(profile), count);
@@ -624,7 +624,7 @@ bool QTiffHandler::write(const QImage &image)
// configure image depth
const QImage::Format format = image.format();
if (format == QImage::Format_Mono || format == QImage::Format_MonoLSB) {
- uint16 photometric = PHOTOMETRIC_MINISBLACK;
+ uint16_t photometric = PHOTOMETRIC_MINISBLACK;
if (image.colorTable().at(0) == 0xffffffff)
photometric = PHOTOMETRIC_MINISWHITE;
if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric)
@@ -646,7 +646,7 @@ bool QTiffHandler::write(const QImage &image)
int chunkStart = y;
int chunkEnd = y + chunk.height();
while (y < chunkEnd) {
- if (TIFFWriteScanline(tiff, reinterpret_cast<uint32 *>(chunk.scanLine(y - chunkStart)), y) != 1) {
+ if (TIFFWriteScanline(tiff, reinterpret_cast<uint32_t *>(chunk.scanLine(y - chunkStart)), y) != 1) {
TIFFClose(tiff);
return false;
}
@@ -661,7 +661,7 @@ bool QTiffHandler::write(const QImage &image)
QList<QRgb> colorTable = effectiveColorTable(image);
bool isGrayscale = checkGrayscale(colorTable);
if (isGrayscale) {
- uint16 photometric = PHOTOMETRIC_MINISBLACK;
+ uint16_t photometric = PHOTOMETRIC_MINISBLACK;
if (colorTable.at(0) == 0xffffffff)
photometric = PHOTOMETRIC_MINISWHITE;
if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric)
@@ -683,9 +683,9 @@ bool QTiffHandler::write(const QImage &image)
// allocate the color tables
const int tableSize = colorTable.size();
Q_ASSERT(tableSize <= 256);
- QVarLengthArray<uint16> redTable(tableSize);
- QVarLengthArray<uint16> greenTable(tableSize);
- QVarLengthArray<uint16> blueTable(tableSize);
+ QVarLengthArray<uint16_t> redTable(tableSize);
+ QVarLengthArray<uint16_t> greenTable(tableSize);
+ QVarLengthArray<uint16_t> blueTable(tableSize);
// set the color table
for (int i = 0; i<tableSize; ++i) {
@@ -738,7 +738,7 @@ bool QTiffHandler::write(const QImage &image)
} else if (format == QImage::Format_RGBA64
|| format == QImage::Format_RGBA64_Premultiplied) {
const bool premultiplied = image.format() != QImage::Format_RGBA64;
- const uint16 extrasamples = premultiplied ? EXTRASAMPLE_ASSOCALPHA : EXTRASAMPLE_UNASSALPHA;
+ const uint16_t extrasamples = premultiplied ? EXTRASAMPLE_ASSOCALPHA : EXTRASAMPLE_UNASSALPHA;
if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)
|| !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
|| !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 4)
@@ -786,7 +786,7 @@ bool QTiffHandler::write(const QImage &image)
} else {
const bool premultiplied = image.format() != QImage::Format_ARGB32
&& image.format() != QImage::Format_RGBA8888;
- const uint16 extrasamples = premultiplied ? EXTRASAMPLE_ASSOCALPHA : EXTRASAMPLE_UNASSALPHA;
+ const uint16_t extrasamples = premultiplied ? EXTRASAMPLE_ASSOCALPHA : EXTRASAMPLE_UNASSALPHA;
if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)
|| !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
|| !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 4)
@@ -899,9 +899,9 @@ int QTiffHandler::currentImageNumber() const
void QTiffHandler::convert32BitOrder(void *buffer, int width)
{
- uint32 *target = reinterpret_cast<uint32 *>(buffer);
- for (int32 x=0; x<width; ++x) {
- uint32 p = target[x];
+ uint32_t *target = reinterpret_cast<uint32_t *>(buffer);
+ for (int32_t x=0; x<width; ++x) {
+ uint32_t p = target[x];
// convert between ARGB and ABGR
target[x] = (p & 0xff000000)
| ((p & 0x00ff0000) >> 16)
@@ -918,7 +918,7 @@ void QTiffHandler::rgb48fixup(QImage *image)
uchar *scanline = image->bits();
const qsizetype bpl = image->bytesPerLine();
for (int y = 0; y < h; ++y) {
- quint16 *dst = reinterpret_cast<uint16 *>(scanline);
+ quint16 *dst = reinterpret_cast<uint16_t *>(scanline);
for (int x = w - 1; x >= 0; --x) {
dst[x * 4 + 3] = 0xffff;
dst[x * 4 + 2] = dst[x * 3 + 2];