diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-01 10:24:35 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-02 09:32:36 +0100 |
commit | feb6711a7962c210a2c88f416200e266fb30597a (patch) | |
tree | ba298c370fbe4aeab7648bc8e6336224225cc00a /src/gui/image/qimage_conversions.cpp | |
parent | b23f5621d7e5275dbb3f96f6b46f691c8b19a13d (diff) |
Segment qimage conversion block irrelevant of depth
Always try segments from 64k to 128k pixels, this matches
qimagescale logic, and gives a one percent speedup locally.
Change-Id: I3ef468eac9dca4b84f04850e970f3d15a4f16255
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/image/qimage_conversions.cpp')
-rw-r--r-- | src/gui/image/qimage_conversions.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 3f9eb08fdf..ffb018f09f 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -234,7 +234,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio }; #ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS - int segments = src->nbytes / (1<<16); + int segments = (qsizetype(src->width) * src->height) >> 16; segments = std::min(segments, src->height); QThreadPool *threadPool = QThreadPool::globalInstance(); @@ -289,7 +289,7 @@ void convert_generic_over_rgb64(QImageData *dest, const QImageData *src, Qt::Ima } }; #ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS - int segments = src->nbytes / (1<<16); + int segments = (qsizetype(src->width) * src->height) >> 16; segments = std::min(segments, src->height); QThreadPool *threadPool = QThreadPool::globalInstance(); @@ -396,7 +396,7 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im } }; #ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS - int segments = data->nbytes / (1<<16); + int segments = (qsizetype(data->width) * data->height) >> 16; segments = std::min(segments, data->height); QThreadPool *threadPool = QThreadPool::globalInstance(); if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) { @@ -490,7 +490,7 @@ bool convert_generic_inplace_over_rgb64(QImageData *data, QImage::Format dst_for } }; #ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS - int segments = data->nbytes / (1<<16); + int segments = (qsizetype(data->width) * data->height) >> 16; segments = std::min(segments, data->height); QThreadPool *threadPool = QThreadPool::globalInstance(); if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) { |