summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-12 03:07:56 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-12 03:07:56 +0200
commit2a10b412605a3f812de99f70ed0cb1bd92b633b2 (patch)
treeed679c352277bcfb42fb41267bdeafc0cc19a9de
parentac8a82f5ffd08b0b9f8f76be29158ce7e113cb46 (diff)
parentab09c9dd9a93932feedbc99e9e965be5bc852c02 (diff)
Merge remote-tracking branch 'origin/5.13' into 5.14v5.14.0-beta2
-rw-r--r--src/plugins/imageformats/tiff/qtiffhandler.cpp28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp
index 0d0a133..d7e46cd 100644
--- a/src/plugins/imageformats/tiff/qtiffhandler.cpp
+++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp
@@ -624,8 +624,8 @@ bool QTiffHandler::write(const QImage &image)
}
// try to do the conversion in chunks no greater than 16 MB
- int chunks = (width * height / (1024 * 1024 * 16)) + 1;
- int chunkHeight = qMax(height / chunks, 1);
+ const int chunks = int(image.sizeInBytes() / (1024 * 1024 * 16)) + 1;
+ const int chunkHeight = qMax(height / chunks, 1);
int y = 0;
while (y < height) {
@@ -692,22 +692,10 @@ bool QTiffHandler::write(const QImage &image)
}
//// write the data
- // try to do the conversion in chunks no greater than 16 MB
- int chunks = (width * height/ (1024 * 1024 * 16)) + 1;
- int chunkHeight = qMax(height / chunks, 1);
-
- int y = 0;
- while (y < height) {
- QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y));
-
- int chunkStart = y;
- int chunkEnd = y + chunk.height();
- while (y < chunkEnd) {
- if (TIFFWriteScanline(tiff, reinterpret_cast<uint32 *>(chunk.scanLine(y - chunkStart)), y) != 1) {
- TIFFClose(tiff);
- return false;
- }
- ++y;
+ for (int y = 0; y < height; ++y) {
+ if (TIFFWriteScanline(tiff, const_cast<uchar *>(image.scanLine(y)), y) != 1) {
+ TIFFClose(tiff);
+ return false;
}
}
TIFFClose(tiff);
@@ -765,7 +753,7 @@ bool QTiffHandler::write(const QImage &image)
return false;
}
// try to do the RGB888 conversion in chunks no greater than 16 MB
- const int chunks = (width * height * 3 / (1024 * 1024 * 16)) + 1;
+ const int chunks = int(image.sizeInBytes() / (1024 * 1024 * 16)) + 1;
const int chunkHeight = qMax(height / chunks, 1);
int y = 0;
@@ -797,7 +785,7 @@ bool QTiffHandler::write(const QImage &image)
return false;
}
// try to do the RGBA8888 conversion in chunks no greater than 16 MB
- const int chunks = (width * height * 4 / (1024 * 1024 * 16)) + 1;
+ const int chunks = int(image.sizeInBytes() / (1024 * 1024 * 16)) + 1;
const int chunkHeight = qMax(height / chunks, 1);
const QImage::Format format = premultiplied ? QImage::Format_RGBA8888_Premultiplied