summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-10-28 10:55:31 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-10-28 10:55:47 +0100
commit416cb155b16d8ab44a4a0313ab07ee6af6913208 (patch)
treef542eadf7c5b1e3a5ae1a5ea865e3ee50ab13a13
parent5a6f87a2d368639673e1527c2efc03e236ac1812 (diff)
parent5c5e5405df70d397ccd67d0dc3833afa2a2d068c (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Also removed dependencies.yaml. Change-Id: I02217c47ceccd121ba3a88dff4d5c4986bcd87f3
-rw-r--r--dependencies.yaml4
-rw-r--r--src/plugins/imageformats/tiff/qtiffhandler.cpp28
2 files changed, 8 insertions, 24 deletions
diff --git a/dependencies.yaml b/dependencies.yaml
deleted file mode 100644
index e81522d..0000000
--- a/dependencies.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-dependencies:
- ../qtbase:
- ref: e164d61ca8263fc4b46fdd916e1ea77c7dd2b735
- required: true
diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp
index 57def2c..49edcdf 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