summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimage_conversions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image/qimage_conversions.cpp')
-rw-r--r--src/gui/image/qimage_conversions.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index 6ddd08d08d..34d2b8d8c7 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -48,6 +48,11 @@
#if QT_CONFIG(thread)
#include <qsemaphore.h>
#include <qthreadpool.h>
+#ifdef Q_OS_WASM
+// WebAssembly has threads; however we can't block the main thread.
+#else
+#define QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
+#endif
#endif
QT_BEGIN_NAMESPACE
@@ -227,7 +232,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
}
};
-#if QT_CONFIG(thread)
+#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
int segments = src->nbytes / (1<<16);
segments = std::min(segments, src->height);
@@ -281,7 +286,7 @@ void convert_generic_to_rgb64(QImageData *dest, const QImageData *src, Qt::Image
destData += dest->bytes_per_line;
}
};
-#if QT_CONFIG(thread)
+#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
int segments = src->nbytes / (1<<16);
segments = std::min(segments, src->height);
@@ -388,7 +393,7 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
destData += params.bytesPerLine;
}
};
-#if QT_CONFIG(thread)
+#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
int segments = data->nbytes / (1<<16);
segments = std::min(segments, data->height);
if (segments > 1) {
@@ -426,8 +431,8 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
data->nbytes = params.totalSize;
}
data->bytes_per_line = params.bytesPerLine;
- data->depth = destDepth;
}
+ data->depth = destDepth;
data->format = dst_format;
return true;
}