summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qimagescale.cpp5
-rw-r--r--src/gui/painting/qimagescale_neon.cpp5
-rw-r--r--src/gui/painting/qimagescale_sse4.cpp5
3 files changed, 9 insertions, 6 deletions
diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp
index 2395c891ce..aac1e20f7b 100644
--- a/src/gui/painting/qimagescale.cpp
+++ b/src/gui/painting/qimagescale.cpp
@@ -307,12 +307,13 @@ static inline void multithread_pixels_function(QImageScaleInfo *isi, int dh, con
#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
int segments = (qsizetype(isi->sh) * isi->sw) / (1<<16);
segments = std::min(segments, dh);
- if (segments > 1) {
+ QThreadPool *threadPool = QThreadPool::globalInstance();
+ if (segments > 1 && !threadPool->contains(QThread::currentThread())) {
QSemaphore semaphore;
int y = 0;
for (int i = 0; i < segments; ++i) {
int yn = (dh - y) / (segments - i);
- QThreadPool::globalInstance()->start([&, y, yn]() {
+ threadPool->start([&, y, yn]() {
scaleSection(y, y + yn);
semaphore.release(1);
});
diff --git a/src/gui/painting/qimagescale_neon.cpp b/src/gui/painting/qimagescale_neon.cpp
index 65fe3fac3c..046e56b419 100644
--- a/src/gui/painting/qimagescale_neon.cpp
+++ b/src/gui/painting/qimagescale_neon.cpp
@@ -58,12 +58,13 @@ static inline void multithread_pixels_function(QImageScaleInfo *isi, int dh, con
#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
int segments = (qsizetype(isi->sh) * isi->sw) / (1<<16);
segments = std::min(segments, dh);
- if (segments > 1) {
+ QThreadPool *threadPool = QThreadPool::globalInstance();
+ if (segments > 1 && !threadPool->contains(QThread::currentThread())) {
QSemaphore semaphore;
int y = 0;
for (int i = 0; i < segments; ++i) {
int yn = (dh - y) / (segments - i);
- QThreadPool::globalInstance()->start([&, y, yn]() {
+ threadPool->start([&, y, yn]() {
scaleSection(y, y + yn);
semaphore.release(1);
});
diff --git a/src/gui/painting/qimagescale_sse4.cpp b/src/gui/painting/qimagescale_sse4.cpp
index 1760e72f65..70cfa08d95 100644
--- a/src/gui/painting/qimagescale_sse4.cpp
+++ b/src/gui/painting/qimagescale_sse4.cpp
@@ -59,12 +59,13 @@ static inline void multithread_pixels_function(QImageScaleInfo *isi, int dh, con
#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
int segments = (qsizetype(isi->sh) * isi->sw) / (1<<16);
segments = std::min(segments, dh);
- if (segments > 1) {
+ QThreadPool *threadPool = QThreadPool::globalInstance();
+ if (segments > 1 && !threadPool->contains(QThread::currentThread())) {
QSemaphore semaphore;
int y = 0;
for (int i = 0; i < segments; ++i) {
int yn = (dh - y) / (segments - i);
- QThreadPool::globalInstance()->start([&, y, yn]() {
+ threadPool->start([&, y, yn]() {
scaleSection(y, y + yn);
semaphore.release(1);
});