summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/configure.json2
-rw-r--r--src/gui/doc/src/paintsystem.qdoc3
-rw-r--r--src/gui/doc/src/richtext.qdoc6
-rw-r--r--src/gui/image/qimage_conversions.cpp1349
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp110
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h46
-rw-r--r--src/gui/painting/qcoregraphics.mm80
-rw-r--r--src/gui/painting/qcoregraphics_p.h11
-rw-r--r--src/gui/text/qharfbuzzng.cpp6
-rw-r--r--src/gui/text/qtextengine.cpp71
-rw-r--r--src/gui/text/qtextlayout.cpp29
-rw-r--r--src/gui/util/qshaderformat_p.h3
-rw-r--r--src/gui/util/qshadernodesloader.cpp3
14 files changed, 459 insertions, 1262 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json
index d2415f7d48..120539d277 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -1302,7 +1302,7 @@
"label": "VNC",
"section": "Platform plugins",
"condition": [
- "config.unix && !config.android && !config.darwin",
+ "config.unix && !config.android && !config.darwin && !config.wasm",
"features.regularexpression && features.network"
],
"output": [ "privateFeature" ]
diff --git a/src/gui/doc/src/paintsystem.qdoc b/src/gui/doc/src/paintsystem.qdoc
index 98d71e9e55..163c0252da 100644
--- a/src/gui/doc/src/paintsystem.qdoc
+++ b/src/gui/doc/src/paintsystem.qdoc
@@ -93,7 +93,6 @@
\page paintsystem-devices.html
\title Paint Devices and Backends
- \contentspage The Paint System
\nextpage Drawing and Filling
\section1 Creating a Paint Device
@@ -185,7 +184,6 @@
\title Drawing and Filling
\previouspage Paint Devices and Backends
- \contentspage The Paint System
\nextpage Coordinate System
\section1 Drawing
@@ -303,7 +301,6 @@
\title Reading and Writing Image Files
\previouspage Coordinate System
- \contentspage The Paint System
The most common way to read images is through QImage and QPixmap's
constructors, or by calling the QImage::load() and QPixmap::load()
diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc
index 31a2ebf05b..b7c731cf43 100644
--- a/src/gui/doc/src/richtext.qdoc
+++ b/src/gui/doc/src/richtext.qdoc
@@ -83,7 +83,6 @@
/*!
\page richtext-structure.html
- \contentspage richtext.html Contents
\previouspage Rich Text Processing
\nextpage The QTextCursor Interface
@@ -349,7 +348,6 @@
/*!
\page richtext-cursor.html
- \contentspage richtext.html Contents
\previouspage Rich Text Document Structure
\nextpage Document Layouts
@@ -656,7 +654,6 @@
/*!
\page richtext-layouts.html
- \contentspage richtext.html Contents
\previouspage The QTextCursor Interface
\nextpage Common Rich Text Editing Tasks
@@ -707,7 +704,6 @@
/*!
\page richtext-common-tasks.html
- \contentspage richtext.html Contents
\previouspage Document Layouts
\nextpage Advanced Rich Text Processing
@@ -800,7 +796,6 @@
/*!
\page richtext-advanced-processing.html
- \contentspage richtext.html Contents
\previouspage Common Rich Text Editing Tasks
\nextpage Supported HTML Subset
@@ -849,7 +844,6 @@
\title Supported HTML Subset
\brief Describes the support for HTML markup in text widgets.
- \contentspage richtext.html Contents
\previouspage Common Rich Text Editing Tasks
Qt's text widgets are able to display rich text, specified using a subset of \l {http://www.w3.org/TR/html401/}{HTML 4}
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index 4f570d8684..6ddd08d08d 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -365,7 +365,7 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
uint buf[BufferSize];
uint *buffer = buf;
uchar *srcData = data->data + data->bytes_per_line * yStart;
- uchar *destData = srcData;
+ uchar *destData = srcData; // This can be temporarily wrong if we doing a shrinking conversion
QDitherInfo dither;
QDitherInfo *ditherPtr = nullptr;
if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither)
@@ -403,6 +403,18 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
y += yn;
}
semaphore.acquire(segments);
+ if (data->bytes_per_line != params.bytesPerLine) {
+ // Compress segments to a continuous block
+ y = 0;
+ for (int i = 0; i < segments; ++i) {
+ int yn = (data->height - y) / (segments - i);
+ uchar *srcData = data->data + data->bytes_per_line * y;
+ uchar *destData = data->data + params.bytesPerLine * y;
+ if (srcData != destData)
+ memmove(destData, srcData, params.bytesPerLine * yn);
+ y += yn;
+ }
+ }
} else
#endif
convertSegment(0, data->height);
@@ -2128,1115 +2140,240 @@ static bool convert_Grayscale8_to_Indexed8_inplace(QImageData *data, Qt::ImageCo
// first index source, second dest
-Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormats] =
-{
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0,
- 0,
- swap_bit_order,
- convert_Mono_to_Indexed8,
- convert_Mono_to_X32,
- convert_Mono_to_X32,
- convert_Mono_to_X32,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_Mono
-
- {
- 0,
- swap_bit_order,
- 0,
- convert_Mono_to_Indexed8,
- convert_Mono_to_X32,
- convert_Mono_to_X32,
- convert_Mono_to_X32,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_MonoLSB
-
- {
- 0,
- convert_X_to_Mono,
- convert_X_to_Mono,
- 0,
- convert_Indexed8_to_X32,
- convert_Indexed8_to_X32,
- convert_Indexed8_to_X32,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0,
- convert_Indexed8_to_Alpha8,
- convert_Indexed8_to_Grayscale8,
- 0, 0, 0, 0, 0
- }, // Format_Indexed8
-
- {
- 0,
- convert_X_to_Mono,
- convert_X_to_Mono,
- convert_RGB_to_Indexed8,
- 0,
- mask_alpha_converter,
- mask_alpha_converter,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_RGB32
-
- {
- 0,
- convert_X_to_Mono,
- convert_X_to_Mono,
- convert_ARGB_to_Indexed8,
- mask_alpha_converter,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_ARGB_to_RGBx,
- convert_ARGB_to_RGBA,
- 0,
- 0,
- convert_ARGB_to_A2RGB30<PixelOrderBGR, false>,
- 0,
- convert_ARGB_to_A2RGB30<PixelOrderRGB, false>,
- 0, 0,
- 0,
- convert_ARGB32_to_RGBA64<false>,
- 0, 0, 0
- }, // Format_ARGB32
-
- {
- 0,
- convert_ARGB_PM_to_Mono,
- convert_ARGB_PM_to_Mono,
- convert_ARGB_PM_to_Indexed8,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_ARGB_to_RGBA,
- 0, 0, 0, 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_ARGB32_Premultiplied
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB16
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB8565_Premultiplied
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB666
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB6666_Premultiplied
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB555
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB8555_Premultiplied
-
- {
- 0,
- 0,
- 0,
- 0,
- convert_RGB888_to_RGB<false>,
- convert_RGB888_to_RGB<false>,
- convert_RGB888_to_RGB<false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, // self
- 0,
- 0,
- convert_RGB888_to_RGB<true>,
- convert_RGB888_to_RGB<true>,
- convert_RGB888_to_RGB<true>,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- convert_rgbswap_generic,
- }, // Format_RGB888
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB444
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB4444_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_RGB,
- convert_RGBA_to_ARGB,
- convert_RGBA_to_ARGB,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_passthrough,
- convert_passthrough,
- 0,
- 0,
- 0,
- 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_RGBX8888
- {
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_RGB,
- convert_RGBA_to_ARGB,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- mask_alpha_converter_RGBx,
- 0,
- 0,
- 0,
- convert_ARGB_to_A2RGB30<PixelOrderBGR, true>,
- 0,
- convert_ARGB_to_A2RGB30<PixelOrderRGB, true>,
- 0, 0,
- 0,
- convert_ARGB32_to_RGBA64<true>,
- 0, 0, 0
- }, // Format_RGBA8888
-
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_ARGB,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGBA8888_Premultiplied
+Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormats] = {};
+InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] = {};
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_passthrough,
- convert_rgbswap_generic,
- convert_rgbswap_generic,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_BGR30
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB<PixelOrderBGR, false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB<PixelOrderBGR, true>,
- 0,
- convert_A2RGB30_PM_to_RGB30<false>,
- 0,
- convert_A2RGB30_PM_to_RGB30<true>,
- convert_rgbswap_generic,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_A2BGR30_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_rgbswap_generic,
- convert_rgbswap_generic,
- 0,
- convert_passthrough,
- 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB30
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB<PixelOrderRGB, false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB<PixelOrderRGB, true>,
- 0,
- convert_A2RGB30_PM_to_RGB30<true>,
- convert_rgbswap_generic,
- convert_A2RGB30_PM_to_RGB30<false>,
- 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_A2RGB30_Premultiplied
- {
- 0,
- 0,
- 0,
- convert_Alpha8_to_Indexed8,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_Alpha8
- {
- 0,
- 0,
- 0,
- convert_Grayscale8_to_Indexed8,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_Grayscale8
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, // self
- convert_passthrough,
- convert_passthrough,
- convert_RGBA64_to_gray16,
- 0
- }, // Format_RGBX64
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_RGBA64_to_ARGB32<false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_RGBA64_to_ARGB32<true>,
- 0,
- 0, 0, 0, 0,
- 0, 0,
- convert_RGBA64_to_RGBx64,
- 0, // self
- convert_RGBA64_to_RGBA64PM,
- 0,
- 0
- }, // Format_RGBA64
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0,
- 0, 0,
- convert_RGBA64PM_to_RGBA64<true>,
- convert_RGBA64PM_to_RGBA64<false>,
- 0, // self
- convert_RGBA64_to_gray16,
- 0
- }, // Format_RGBA64_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0,
- convert_gray16_to_RGBA64,
- convert_gray16_to_RGBA64,
- convert_gray16_to_RGBA64,
- 0, // self
- 0
- }, // Format_Grayscale16
- {
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_rgbswap_generic,
- 0,
- 0,
+static void qInitImageConversions()
+{
+ // Some conversions can not be generic, other are just hard to make as fast in the generic converter.
+
+ // All conversions to and from indexed formats can not be generic and needs to go over RGB32 or ARGB32
+ qimage_converter_map[QImage::Format_Mono][QImage::Format_MonoLSB] = swap_bit_order;
+ qimage_converter_map[QImage::Format_Mono][QImage::Format_Indexed8] = convert_Mono_to_Indexed8;
+ qimage_converter_map[QImage::Format_Mono][QImage::Format_RGB32] = convert_Mono_to_X32;
+ qimage_converter_map[QImage::Format_Mono][QImage::Format_ARGB32] = convert_Mono_to_X32;
+ qimage_converter_map[QImage::Format_Mono][QImage::Format_ARGB32_Premultiplied] = convert_Mono_to_X32;
+
+ qimage_converter_map[QImage::Format_MonoLSB][QImage::Format_Mono] = swap_bit_order;
+ qimage_converter_map[QImage::Format_MonoLSB][QImage::Format_Indexed8] = convert_Mono_to_Indexed8;
+ qimage_converter_map[QImage::Format_MonoLSB][QImage::Format_RGB32] = convert_Mono_to_X32;
+ qimage_converter_map[QImage::Format_MonoLSB][QImage::Format_ARGB32] = convert_Mono_to_X32;
+ qimage_converter_map[QImage::Format_MonoLSB][QImage::Format_ARGB32_Premultiplied] = convert_Mono_to_X32;
+
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_Mono] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_MonoLSB] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_RGB32] = convert_Indexed8_to_X32;
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_ARGB32] = convert_Indexed8_to_X32;
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_ARGB32_Premultiplied] = convert_Indexed8_to_X32;
+ // Indexed8, Alpha8 and Grayscale8 have a special relationship that can be short-cut.
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_Grayscale8] = convert_Indexed8_to_Grayscale8;
+ qimage_converter_map[QImage::Format_Indexed8][QImage::Format_Alpha8] = convert_Indexed8_to_Alpha8;
+
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_Mono] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_MonoLSB] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_Indexed8] = convert_RGB_to_Indexed8;
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_ARGB32] = mask_alpha_converter;
+ qimage_converter_map[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = mask_alpha_converter;
+
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_Mono] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_MonoLSB] = convert_X_to_Mono;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_Indexed8] = convert_ARGB_to_Indexed8;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_RGB32] = mask_alpha_converter;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_RGBX8888] = convert_ARGB_to_RGBx;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_RGBA8888] = convert_ARGB_to_RGBA;
+ // ARGB32 has higher precision than ARGB32PM and needs explicit conversions to other higher color-precision formats with alpha
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_A2BGR30_Premultiplied] = convert_ARGB_to_A2RGB30<PixelOrderBGR, false>;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_A2RGB30_Premultiplied] = convert_ARGB_to_A2RGB30<PixelOrderRGB, false>;
+ qimage_converter_map[QImage::Format_ARGB32][QImage::Format_RGBA64] = convert_ARGB32_to_RGBA64<false>;
+
+ qimage_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_Mono] = convert_ARGB_PM_to_Mono;
+ qimage_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_MonoLSB] = convert_ARGB_PM_to_Mono;
+ qimage_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_Indexed8] = convert_ARGB_PM_to_Indexed8;
+ qimage_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = convert_ARGB_to_RGBA;
+
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB<false>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB<false>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB<false>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGBX8888] = convert_RGB888_to_RGB<true>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGBA8888] = convert_RGB888_to_RGB<true>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGBA8888_Premultiplied] = convert_RGB888_to_RGB<true>;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_BGR888] = convert_rgbswap_generic;
+
+ qimage_converter_map[QImage::Format_RGBX8888][QImage::Format_RGB32] = convert_RGBA_to_RGB;
+ qimage_converter_map[QImage::Format_RGBX8888][QImage::Format_ARGB32] = convert_RGBA_to_ARGB;
+ qimage_converter_map[QImage::Format_RGBX8888][QImage::Format_ARGB32_Premultiplied] = convert_RGBA_to_ARGB;
+ qimage_converter_map[QImage::Format_RGBX8888][QImage::Format_RGBA8888] = convert_passthrough;
+ qimage_converter_map[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = convert_passthrough;
+
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_RGB32] = convert_RGBA_to_RGB;
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_ARGB32] = convert_RGBA_to_ARGB;
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_RGBX8888] = mask_alpha_converter_RGBx;
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_A2BGR30_Premultiplied] = convert_ARGB_to_A2RGB30<PixelOrderBGR, true>;
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_A2RGB30_Premultiplied] = convert_ARGB_to_A2RGB30<PixelOrderRGB, true>;
+ qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_RGBA64] = convert_ARGB32_to_RGBA64<true>;
+
+ qimage_converter_map[QImage::Format_RGBA8888_Premultiplied][QImage::Format_ARGB32_Premultiplied] = convert_RGBA_to_ARGB;
+
+ qimage_converter_map[QImage::Format_BGR30][QImage::Format_A2BGR30_Premultiplied] = convert_passthrough;
+ qimage_converter_map[QImage::Format_BGR30][QImage::Format_RGB30] = convert_rgbswap_generic;
+ qimage_converter_map[QImage::Format_BGR30][QImage::Format_A2RGB30_Premultiplied] = convert_rgbswap_generic;
+
+ qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_ARGB32] = convert_A2RGB30_PM_to_ARGB<PixelOrderBGR, false>;
+ qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGBA8888] = convert_A2RGB30_PM_to_ARGB<PixelOrderBGR, true>;
+ qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_BGR30] = convert_A2RGB30_PM_to_RGB30<false>;
+ qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGB30] = convert_A2RGB30_PM_to_RGB30<true>;
+ qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_A2RGB30_Premultiplied] = convert_rgbswap_generic;
+
+ qimage_converter_map[QImage::Format_RGB30][QImage::Format_BGR30] = convert_rgbswap_generic;
+ qimage_converter_map[QImage::Format_RGB30][QImage::Format_A2BGR30_Premultiplied] = convert_rgbswap_generic;
+ qimage_converter_map[QImage::Format_RGB30][QImage::Format_A2RGB30_Premultiplied] = convert_passthrough;
+
+ qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_ARGB32] = convert_A2RGB30_PM_to_ARGB<PixelOrderRGB, false>;
+ qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_RGBA8888] = convert_A2RGB30_PM_to_ARGB<PixelOrderRGB, true>;
+ qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_BGR30] = convert_A2RGB30_PM_to_RGB30<true>;
+ qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_A2BGR30_Premultiplied] = convert_rgbswap_generic;
+ qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_RGB30] = convert_A2RGB30_PM_to_RGB30<false>;
+
+ qimage_converter_map[QImage::Format_Grayscale8][QImage::Format_Indexed8] = convert_Grayscale8_to_Indexed8;
+ qimage_converter_map[QImage::Format_Alpha8][QImage::Format_Indexed8] = convert_Alpha8_to_Indexed8;
+
+ qimage_converter_map[QImage::Format_RGBX64][QImage::Format_RGBA64] = convert_passthrough;
+ qimage_converter_map[QImage::Format_RGBX64][QImage::Format_RGBA64_Premultiplied] = convert_passthrough;
+ qimage_converter_map[QImage::Format_RGBX64][QImage::Format_Grayscale16] = convert_RGBA64_to_gray16;
+
+ qimage_converter_map[QImage::Format_RGBA64][QImage::Format_ARGB32] = convert_RGBA64_to_ARGB32<false>;
+ qimage_converter_map[QImage::Format_RGBA64][QImage::Format_RGBA8888] = convert_RGBA64_to_ARGB32<true>;
+ qimage_converter_map[QImage::Format_RGBA64][QImage::Format_RGBX64] = convert_RGBA64_to_RGBx64;
+ qimage_converter_map[QImage::Format_RGBA64][QImage::Format_RGBA64_Premultiplied] = convert_RGBA64_to_RGBA64PM;
+
+ qimage_converter_map[QImage::Format_RGBA64_Premultiplied][QImage::Format_RGBX64] = convert_RGBA64PM_to_RGBA64<true>;
+ qimage_converter_map[QImage::Format_RGBA64_Premultiplied][QImage::Format_RGBA64] = convert_RGBA64PM_to_RGBA64<false>;
+ qimage_converter_map[QImage::Format_RGBA64_Premultiplied][QImage::Format_Grayscale16] = convert_RGBA64_to_gray16;
+
+ qimage_converter_map[QImage::Format_Grayscale16][QImage::Format_RGBX64] = convert_gray16_to_RGBA64;
+ qimage_converter_map[QImage::Format_Grayscale16][QImage::Format_RGBA64] = convert_gray16_to_RGBA64;
+ qimage_converter_map[QImage::Format_Grayscale16][QImage::Format_RGBA64_Premultiplied] = convert_gray16_to_RGBA64;
+
+ qimage_converter_map[QImage::Format_BGR888][QImage::Format_RGB888] = convert_rgbswap_generic;
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- convert_RGB888_to_RGB<false>,
- convert_RGB888_to_RGB<false>,
- convert_RGB888_to_RGB<false>,
-#else
- 0, 0, 0,
+ qimage_converter_map[QImage::Format_BGR888][QImage::Format_RGBX8888] = convert_RGB888_to_RGB<false>;
+ qimage_converter_map[QImage::Format_BGR888][QImage::Format_RGBA8888] = convert_RGB888_to_RGB<false>;
+ qimage_converter_map[QImage::Format_BGR888][QImage::Format_RGBA8888_Premultiplied] = convert_RGB888_to_RGB<false>;
#endif
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, // self
- }, // Format_BGR888
-};
-InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] =
-{
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- },
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_Mono
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_MonoLSB
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0,
- convert_Indexed8_to_Alpha8_inplace,
- convert_Indexed8_to_Grayscale8_inplace,
- 0, 0, 0, 0, 0
- }, // Format_Indexed8
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- mask_alpha_converter_inplace<QImage::Format_ARGB32>,
- mask_alpha_converter_inplace<QImage::Format_ARGB32_Premultiplied>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_RGB32
- {
- 0,
- 0,
- 0,
- 0,
- mask_alpha_converter_inplace<QImage::Format_RGB32>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_ARGB_to_RGBA_inplace<QImage::Format_RGBX8888>,
- convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888>,
- 0,
- 0,
- convert_ARGB_to_A2RGB30_inplace<PixelOrderBGR, false>,
- 0,
- convert_ARGB_to_A2RGB30_inplace<PixelOrderRGB, false>,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_ARGB32
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888_Premultiplied>,
- 0, 0, 0, 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_ARGB32_Premultiplied
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB16
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB8565_Premultiplied
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB666
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB6666_Premultiplied
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB555
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB8555_Premultiplied
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- convert_rgbswap_generic_inplace
- }, // Format_RGB888
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB444
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_ARGB4444_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_ARGB_inplace<QImage::Format_RGB32>,
- convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32>,
- convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32_Premultiplied>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_passthrough_inplace<QImage::Format_RGBA8888>,
- convert_passthrough_inplace<QImage::Format_RGBA8888_Premultiplied>,
- 0,
- 0,
- 0,
- 0,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_RGBX8888
- {
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_ARGB_inplace<QImage::Format_RGB32>,
- convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- mask_alpha_converter_rgbx_inplace,
- 0,
- 0,
- 0,
- convert_ARGB_to_A2RGB30_inplace<PixelOrderBGR, true>,
- 0,
- convert_ARGB_to_A2RGB30_inplace<PixelOrderRGB, true>,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_RGBA8888
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32_Premultiplied>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGBA8888_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, // self
- convert_passthrough_inplace<QImage::Format_A2BGR30_Premultiplied>,
- convert_rgbswap_generic_inplace,
- convert_BGR30_to_A2RGB30_inplace,
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_BGR30
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR, false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR, true>,
- 0,
- convert_A2RGB30_PM_to_RGB30_inplace<false>,
- 0, // self
- convert_A2RGB30_PM_to_RGB30_inplace<true>,
- convert_rgbswap_generic_inplace,
- 0, 0, 0, 0, 0, 0, 0
- }, // Format_A2BGR30_Premultiplied
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_rgbswap_generic_inplace,
- convert_BGR30_to_A2RGB30_inplace,
- 0, // self
- convert_passthrough_inplace<QImage::Format_A2RGB30_Premultiplied>,
- 0, 0, 0, 0, 0, 0, 0
- }, // Format_RGB30
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB, false>,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB, true>,
- 0,
- convert_A2RGB30_PM_to_RGB30_inplace<true>,
- convert_rgbswap_generic_inplace,
- convert_A2RGB30_PM_to_RGB30_inplace<false>,
- 0, // self
- 0, 0,
- 0, 0, 0, 0, 0
- }, // Format_A2RGB30_Premultiplied
- {
- 0,
- 0,
- 0,
- convert_Alpha8_to_Indexed8_inplace,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0,
- 0, // self
- 0,
- 0, 0, 0, 0, 0
- }, // Format_Alpha8
- {
- 0,
- 0,
- 0,
- convert_Grayscale8_to_Indexed8_inplace,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0,
- 0,
- 0, // self
- 0, 0, 0, 0, 0
- }, // Format_Grayscale8
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, // self
- convert_passthrough_inplace<QImage::Format_RGBA64>,
- convert_passthrough_inplace<QImage::Format_RGBA64_Premultiplied>,
- 0, 0
- }, // Format_RGBX64
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- convert_RGBA64_to_RGBx64_inplace,
- 0, // self
- convert_RGBA64_to_RGBA64PM_inplace,
- 0, 0
- }, // Format_RGBA64
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- convert_RGBA64PM_to_RGBA64_inplace<true>,
- convert_RGBA64PM_to_RGBA64_inplace<false>,
- 0, // self
- 0, 0
- }, // Format_RGBA64_Premultiplied
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_Grayscale16
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- convert_rgbswap_generic_inplace,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }, // Format_BGR888
-};
-
-static void qInitImageConversions()
-{
+ // Inline converters:
+ qimage_inplace_converter_map[QImage::Format_Indexed8][QImage::Format_Grayscale8] =
+ convert_Indexed8_to_Grayscale8_inplace;
+ qimage_inplace_converter_map[QImage::Format_Indexed8][QImage::Format_Alpha8] =
+ convert_Indexed8_to_Alpha8_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_RGB32][QImage::Format_ARGB32] =
+ mask_alpha_converter_inplace<QImage::Format_ARGB32>;
+ qimage_inplace_converter_map[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] =
+ mask_alpha_converter_inplace<QImage::Format_ARGB32_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_RGB32] =
+ mask_alpha_converter_inplace<QImage::Format_RGB32>;
+ qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_RGBX8888] =
+ convert_ARGB_to_RGBA_inplace<QImage::Format_RGBX8888>;
+ qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_RGBA8888] =
+ convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888>;
+ qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_A2BGR30_Premultiplied] =
+ convert_ARGB_to_A2RGB30_inplace<PixelOrderBGR, false>;
+ qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_A2RGB30_Premultiplied] =
+ convert_ARGB_to_A2RGB30_inplace<PixelOrderRGB, false>;
+
+ qimage_inplace_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGBA8888_Premultiplied] =
+ convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_RGB888][QImage::Format_BGR888] =
+ convert_rgbswap_generic_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_RGB32] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_RGB32>;
+ qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_ARGB32] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32>;
+ qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_ARGB32_Premultiplied] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32_Premultiplied>;
+ qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_RGBA8888] =
+ convert_passthrough_inplace<QImage::Format_RGBA8888>;
+ qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] =
+ convert_passthrough_inplace<QImage::Format_RGBA8888_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_RGB32] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_RGB32>;
+ qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_ARGB32] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32>;
+ qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_RGBX8888] =
+ mask_alpha_converter_rgbx_inplace;
+ qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_A2BGR30_Premultiplied] =
+ convert_ARGB_to_A2RGB30_inplace<PixelOrderBGR, true>;
+ qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_A2RGB30_Premultiplied] =
+ convert_ARGB_to_A2RGB30_inplace<PixelOrderRGB, true>;
+
+ qimage_inplace_converter_map[QImage::Format_RGBA8888_Premultiplied][QImage::Format_ARGB32_Premultiplied] =
+ convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_BGR30][QImage::Format_A2BGR30_Premultiplied] =
+ convert_passthrough_inplace<QImage::Format_A2BGR30_Premultiplied>;
+ qimage_inplace_converter_map[QImage::Format_BGR30][QImage::Format_RGB30] =
+ convert_rgbswap_generic_inplace;
+ qimage_inplace_converter_map[QImage::Format_BGR30][QImage::Format_A2RGB30_Premultiplied] =
+ convert_BGR30_to_A2RGB30_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_ARGB32] =
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR, false>;
+ qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGBA8888] =
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR, true>;
+ qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_BGR30] =
+ convert_A2RGB30_PM_to_RGB30_inplace<false>;
+ qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGB30] =
+ convert_A2RGB30_PM_to_RGB30_inplace<true>;
+ qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_A2RGB30_Premultiplied] =
+ convert_rgbswap_generic_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_RGB30][QImage::Format_BGR30] =
+ convert_rgbswap_generic_inplace;
+ qimage_inplace_converter_map[QImage::Format_RGB30][QImage::Format_A2BGR30_Premultiplied] =
+ convert_BGR30_to_A2RGB30_inplace;
+ qimage_inplace_converter_map[QImage::Format_RGB30][QImage::Format_A2RGB30_Premultiplied] =
+ convert_passthrough_inplace<QImage::Format_A2RGB30_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_ARGB32] =
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB, false>;
+ qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_RGBA8888] =
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB, true>;
+ qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_BGR30] =
+ convert_A2RGB30_PM_to_RGB30_inplace<true>;
+ qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_A2BGR30_Premultiplied] =
+ convert_rgbswap_generic_inplace;
+ qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_RGB30] =
+ convert_A2RGB30_PM_to_RGB30_inplace<false>;
+
+ qimage_inplace_converter_map[QImage::Format_Grayscale8][QImage::Format_Indexed8] =
+ convert_Grayscale8_to_Indexed8_inplace;
+ qimage_inplace_converter_map[QImage::Format_Alpha8][QImage::Format_Indexed8] =
+ convert_Alpha8_to_Indexed8_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_RGBX64][QImage::Format_RGBA64] =
+ convert_passthrough_inplace<QImage::Format_RGBA64>;
+ qimage_inplace_converter_map[QImage::Format_RGBX64][QImage::Format_RGBA64_Premultiplied] =
+ convert_passthrough_inplace<QImage::Format_RGBA64_Premultiplied>;
+
+ qimage_inplace_converter_map[QImage::Format_RGBA64][QImage::Format_RGBX64] =
+ convert_RGBA64_to_RGBx64_inplace;
+ qimage_inplace_converter_map[QImage::Format_RGBA64][QImage::Format_RGBA64_Premultiplied] =
+ convert_RGBA64_to_RGBA64PM_inplace;
+
+ qimage_inplace_converter_map[QImage::Format_RGBA64_Premultiplied][QImage::Format_RGBX64] =
+ convert_RGBA64PM_to_RGBA64_inplace<true>;
+ qimage_inplace_converter_map[QImage::Format_RGBA64_Premultiplied][QImage::Format_RGBA64] =
+ convert_RGBA64PM_to_RGBA64_inplace<false>;
+
+ qimage_inplace_converter_map[QImage::Format_BGR888][QImage::Format_RGB888] =
+ convert_rgbswap_generic_inplace;
+
+ // Now architecture specific conversions:
#if defined(__SSE2__) && defined(QT_COMPILER_SUPPORTS_SSSE3)
if (qCpuHasFeature(SSSE3)) {
extern void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index 3c85481495..cbb05cf69e 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -279,7 +279,7 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW
const qreal scaleFactor = QHighDpiScaling::factor(window);
QRegion pointRegion;
- for (const QRectF &rect : pixelRegion) {
+ for (const QRectF rect: pixelRegion) {
const QPointF topLeftP = rect.topLeft() / scaleFactor;
const QSizeF sizeP = rect.size() / scaleFactor;
pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())),
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 6ecd908296..9d90bf5db2 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -368,41 +368,41 @@ QT_DEFINE_QPA_EVENT_HANDLER(bool, handleCloseEvent, QWindow *window)
*/
#if QT_DEPRECATED_SINCE(5, 11)
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
- handleMouseEvent<Delivery>(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
+ return handleMouseEvent<Delivery>(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
- handleMouseEvent<Delivery>(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
+ return handleMouseEvent<Delivery>(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
}
-void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
- handleFrameStrutMouseEvent(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
+ return handleFrameStrutMouseEvent(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
}
-void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
- handleFrameStrutMouseEvent(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
+ return handleFrameStrutMouseEvent(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
}
#endif // QT_DEPRECATED_SINCE(5, 11)
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window,
const QPointF &local, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
Qt::MouseEventSource source)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source);
+ return handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp,
const QPointF &local, const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
Qt::MouseEventSource source)
@@ -416,10 +416,10 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong times
QWindowSystemInterfacePrivate::MouseEvent *e =
new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos,
state, mods, button, type, source);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
-void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window,
+bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window,
const QPointF &local, const QPointF &global,
Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type,
@@ -427,10 +427,10 @@ void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window,
Qt::MouseEventSource source)
{
const unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleFrameStrutMouseEvent(window, time, local, global, state, button, type, mods, source);
+ return handleFrameStrutMouseEvent(window, time, local, global, state, button, type, mods, source);
}
-void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp,
+bool QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp,
const QPointF &local, const QPointF &global,
Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type,
@@ -443,7 +443,7 @@ void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong t
QWindowSystemInterfacePrivate::MouseEvent *e =
new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos,
state, mods, button, type, source, true);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestamp, int keyCode, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode,
@@ -549,28 +549,28 @@ QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *window, ulong tim
}
#if QT_DEPRECATED_SINCE(5, 10)
-void QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) {
+bool QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
- handleWheelEvent(window, time, local, global, d, o, mods);
+ return handleWheelEvent(window, time, local, global, d, o, mods);
QT_WARNING_POP
}
-void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods)
+bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods)
{
QPoint point = (o == Qt::Vertical) ? QPoint(0, d) : QPoint(d, 0);
- handleWheelEvent(window, timestamp, local, global, QPoint(), point, mods);
+ return handleWheelEvent(window, timestamp, local, global, QPoint(), point, mods);
}
#endif // QT_DEPRECATED_SINCE(5, 10)
-void QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
+bool QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleWheelEvent(window, time, local, global, pixelDelta, angleDelta, mods, phase, source);
+ return handleWheelEvent(window, time, local, global, pixelDelta, angleDelta, mods, phase, source);
}
-void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
+bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
Qt::MouseEventSource source, bool invertedScrolling)
{
// Qt 4 sends two separate wheel events for horizontal and vertical
@@ -585,33 +585,35 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp,
// Pass Qt::ScrollBegin and Qt::ScrollEnd through
// even if the wheel delta is null.
if (angleDelta.isNull() && phase == Qt::ScrollUpdate)
- return;
+ return false;
// Simple case: vertical deltas only:
if (angleDelta.y() != 0 && angleDelta.x() == 0) {
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical,
mods, phase, source, invertedScrolling);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
- return;
+
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
// Simple case: horizontal deltas only:
if (angleDelta.y() == 0 && angleDelta.x() != 0) {
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
- return;
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
+ bool acceptVert;
+ bool acceptHorz;
// Both horizontal and vertical deltas: Send two wheel events.
// The first event contains the Qt 5 pixel and angle delta as points,
// and in addition the Qt 4 compatibility vertical angle delta.
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ acceptVert = QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
// The second event contains null pixel and angle points and the
// Qt 4 compatibility horizontal angle delta.
e = new QWindowSystemInterfacePrivate::WheelEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ acceptHorz = QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return acceptVert || acceptHorz;
}
void QWindowSystemInterface::registerTouchDevice(const QTouchDevice *device)
@@ -758,21 +760,21 @@ QList<QWindowSystemInterface::TouchPoint>
return newList;
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *window, QTouchDevice *device,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, QTouchDevice *device,
const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTouchEvent<Delivery>(window, time, device, points, mods);
+ return handleTouchEvent<Delivery>(window, time, device, points, mods);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{
if (!points.size()) // Touch events must have at least one point
- return;
+ return false;
if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
- return;
+ return false;
QEvent::Type type;
QList<QTouchEvent::TouchPoint> touchPoints =
@@ -780,23 +782,23 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *window, ulong times
QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(window, timestamp, type, device, touchPoints, mods);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *window, QTouchDevice *device,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, QTouchDevice *device,
Qt::KeyboardModifiers mods)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTouchCancelEvent<Delivery>(window, time, device, mods);
+ return handleTouchCancelEvent<Delivery>(window, time, device, mods);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, ulong timestamp, QTouchDevice *device,
Qt::KeyboardModifiers mods)
{
QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(window, timestamp, QEvent::TouchCancel, device,
QList<QTouchEvent::TouchPoint>(), mods);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
/*!
@@ -970,7 +972,7 @@ void QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(boo
platformSynthesizesMouse = v;
}
-void QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
+bool QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers)
@@ -981,16 +983,16 @@ void QWindowSystemInterface::handleTabletEvent(QWindow *window, ulong timestamp,
QHighDpi::fromNativePixels(global, window),
device, pointerType, buttons, pressure,
xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
+bool QWindowSystemInterface::handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers)
{
ulong time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTabletEvent(window, time, local, global, device, pointerType, buttons, pressure,
+ return handleTabletEvent(window, time, local, global, device, pointerType, buttons, pressure,
xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
}
@@ -1014,11 +1016,11 @@ void QWindowSystemInterface::handleTabletEvent(QWindow *window, bool down, const
}
#endif // QT_DEPRECATED_SINCE(5, 10)
-void QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
+bool QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
{
QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e =
new QWindowSystemInterfacePrivate::TabletEnterProximityEvent(timestamp, device, pointerType, uid);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
void QWindowSystemInterface::handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid)
@@ -1027,11 +1029,11 @@ void QWindowSystemInterface::handleTabletEnterProximityEvent(int device, int poi
handleTabletEnterProximityEvent(time, device, pointerType, uid);
}
-void QWindowSystemInterface::handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
+bool QWindowSystemInterface::handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid)
{
QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e =
new QWindowSystemInterfacePrivate::TabletLeaveProximityEvent(timestamp, device, pointerType, uid);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid)
@@ -1041,31 +1043,31 @@ void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int poi
}
#ifndef QT_NO_GESTURES
-void QWindowSystemInterface::handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
+bool QWindowSystemInterface::handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
QPointF &local, QPointF &global)
{
QWindowSystemInterfacePrivate::GestureEvent *e =
new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
+bool QWindowSystemInterface::handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
qreal value, QPointF &local, QPointF &global)
{
QWindowSystemInterfacePrivate::GestureEvent *e =
new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
e->realValue = value;
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
+bool QWindowSystemInterface::handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
ulong sequenceId, quint64 value, QPointF &local, QPointF &global)
{
QWindowSystemInterfacePrivate::GestureEvent *e =
new QWindowSystemInterfacePrivate::GestureEvent(window, timestamp, type, device, local, global);
e->sequenceId = sequenceId;
e->intValue = value;
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
#endif // QT_NO_GESTURES
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 95e20f0f8b..f7f1dc3f4d 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -78,40 +78,40 @@ public:
#if QT_DEPRECATED_SINCE(5, 11)
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- QT_DEPRECATED static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+ QT_DEPRECATED static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- QT_DEPRECATED static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+ QT_DEPRECATED static bool handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
- QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+ QT_DEPRECATED static bool handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
- QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+ QT_DEPRECATED static bool handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
#endif
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
+ static bool handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
+ static bool handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
- static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local,
+ static bool handleFrameStrutMouseEvent(QWindow *window, const QPointF &local,
const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source =
Qt::MouseEventNotSynthesized);
- static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
+ static bool handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
const QPointF &global, Qt::MouseButtons state,
Qt::MouseButton button, QEvent::Type type,
Qt::KeyboardModifiers mods = Qt::NoModifier,
@@ -136,12 +136,12 @@ public:
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
ushort count = 1, bool tryShortcutOverride = true);
- static void handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global,
+ static bool handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global,
QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::ScrollPhase phase = Qt::NoScrollPhase,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
- static void handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
+ static bool handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
QPoint pixelDelta, QPoint angleDelta,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::ScrollPhase phase = Qt::NoScrollPhase,
@@ -149,8 +149,8 @@ public:
bool inverted = false);
#if QT_DEPRECATED_SINCE(5, 10)
- QT_DEPRECATED static void handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
- QT_DEPRECATED static void handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
+ QT_DEPRECATED static bool handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
+ QT_DEPRECATED static bool handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
#endif
struct TouchPoint {
@@ -175,15 +175,15 @@ public:
static bool isTouchDeviceRegistered(const QTouchDevice *device);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleTouchEvent(QWindow *window, QTouchDevice *device,
+ static bool handleTouchEvent(QWindow *window, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleTouchEvent(QWindow *window, ulong timestamp, QTouchDevice *device,
+ static bool handleTouchEvent(QWindow *window, ulong timestamp, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleTouchCancelEvent(QWindow *window, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
+ static bool handleTouchCancelEvent(QWindow *window, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleTouchCancelEvent(QWindow *window, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
+ static bool handleTouchCancelEvent(QWindow *window, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
// rect is relative to parent
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
@@ -255,11 +255,11 @@ public:
static void handleFileOpenEvent(const QString& fileName);
static void handleFileOpenEvent(const QUrl &url);
- static void handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
+ static bool handleTabletEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
- static void handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
+ static bool handleTabletEvent(QWindow *window, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
@@ -273,17 +273,17 @@ public:
qreal tangentialPressure, qreal rotation, int z, qint64 uid,
Qt::KeyboardModifiers modifiers = Qt::NoModifier);
#endif
- static void handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
+ static bool handleTabletEnterProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
static void handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid);
- static void handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
+ static bool handleTabletLeaveProximityEvent(ulong timestamp, int device, int pointerType, qint64 uid);
static void handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid);
#ifndef QT_NO_GESTURES
- static void handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
+ static bool handleGestureEvent(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
QPointF &local, QPointF &global);
- static void handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
+ static bool handleGestureEventWithRealValue(QWindow *window, QTouchDevice *device, ulong timestamp, Qt::NativeGestureType type,
qreal value, QPointF &local, QPointF &global);
- static void handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp,Qt::NativeGestureType type,
+ static bool handleGestureEventWithSequenceIdAndValue(QWindow *window, QTouchDevice *device, ulong timestamp,Qt::NativeGestureType type,
ulong sequenceId, quint64 value, QPointF &local, QPointF &global);
#endif // QT_NO_GESTURES
diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm
index e2497eaadb..94ba004c93 100644
--- a/src/gui/painting/qcoregraphics.mm
+++ b/src/gui/painting/qcoregraphics.mm
@@ -47,6 +47,8 @@
#include <QtCore/qcoreapplication.h>
#include <QtCore/qoperatingsystemversion.h>
+QT_USE_NAMESPACE
+
QT_BEGIN_NAMESPACE
// ---------------------- Images ----------------------
@@ -124,46 +126,72 @@ QImage qt_mac_toQImage(CGImageRef image)
#ifdef Q_OS_MACOS
-static NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image)
+QT_END_NAMESPACE
+
+@implementation NSImage (QtExtras)
++ (instancetype)imageFromQImage:(const QImage &)image
{
- NSImage *newImage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize];
- return newImage;
+ if (image.isNull())
+ return nil;
+
+ QCFType<CGImageRef> cgImage = image.toCGImage();
+ if (!cgImage)
+ return nil;
+
+ // We set up the NSImage using an explicit NSBitmapImageRep, instead of
+ // [NSImage initWithCGImage:size:], as the former allows us to correctly
+ // set the size of the representation to account for the device pixel
+ // ratio of the original image, which in turn will be reflected by the
+ // NSImage.
+ auto nsImage = [[NSImage alloc] initWithSize:NSZeroSize];
+ auto *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
+ imageRep.size = (image.size() / image.devicePixelRatioF()).toCGSize();
+ [nsImage addRepresentation:[imageRep autorelease]];
+ Q_ASSERT(CGSizeEqualToSize(nsImage.size, imageRep.size));
+
+ return [nsImage autorelease];
}
-NSImage *qt_mac_create_nsimage(const QPixmap &pm)
++ (instancetype)imageFromQIcon:(const QIcon &)icon
{
- if (pm.isNull())
- return 0;
- QImage image = pm.toImage();
- CGImageRef cgImage = qt_mac_toCGImage(image);
- NSImage *nsImage = qt_mac_cgimage_to_nsimage(cgImage);
- nsImage.size = (pm.size() / pm.devicePixelRatioF()).toCGSize();
- CGImageRelease(cgImage);
- return nsImage;
+ return [NSImage imageFromQIcon:icon withSize:0];
}
-NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize)
++ (instancetype)imageFromQIcon:(const QIcon &)icon withSize:(int)size
{
if (icon.isNull())
return nil;
- NSImage *nsImage = [[NSImage alloc] init];
- QList<QSize> availableSizes = icon.availableSizes();
- if (availableSizes.isEmpty() && defaultSize > 0)
- availableSizes << QSize(defaultSize, defaultSize);
+ auto nsImage = [[NSImage alloc] initWithSize:NSZeroSize];
+
+ auto availableSizes = icon.availableSizes();
+ if (availableSizes.isEmpty() && size > 0)
+ availableSizes << QSize(size, size);
+
for (QSize size : qAsConst(availableSizes)) {
- QPixmap pm = icon.pixmap(size);
- if (pm.isNull())
+ QImage image = icon.pixmap(size).toImage();
+ if (image.isNull())
continue;
- QImage image = pm.toImage();
- CGImageRef cgImage = qt_mac_toCGImage(image);
- NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
- [nsImage addRepresentation:imageRep];
- [imageRep release];
- CGImageRelease(cgImage);
+
+ QCFType<CGImageRef> cgImage = image.toCGImage();
+ if (!cgImage)
+ continue;
+
+ auto *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
+ imageRep.size = (image.size() / image.devicePixelRatioF()).toCGSize();
+ [nsImage addRepresentation:[imageRep autorelease]];
}
- return nsImage;
+
+ [nsImage setTemplate:icon.isMask()];
+
+ if (size)
+ nsImage.size = CGSizeMake(size, size);
+
+ return [nsImage autorelease];
}
+@end
+
+QT_BEGIN_NAMESPACE
QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size)
{
diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h
index ba2cde8325..db012d3cda 100644
--- a/src/gui/painting/qcoregraphics_p.h
+++ b/src/gui/painting/qcoregraphics_p.h
@@ -69,9 +69,16 @@ QT_BEGIN_NAMESPACE
Q_GUI_EXPORT CGBitmapInfo qt_mac_bitmapInfoForImage(const QImage &image);
#ifdef HAVE_APPKIT
-Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QPixmap &pm);
-Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0);
Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
+
+QT_END_NAMESPACE
+@interface NSImage (QtExtras)
++ (instancetype)imageFromQImage:(const QT_PREPEND_NAMESPACE(QImage) &)image;
++ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon;
++ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon withSize:(int)size;
+@end
+QT_BEGIN_NAMESPACE
+
#endif
Q_GUI_EXPORT CGImageRef qt_mac_toCGImage(const QImage &qImage);
Q_GUI_EXPORT CGImageRef qt_mac_toCGImageMask(const QImage &qImage);
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp
index 397e6cc49f..4613aff9e8 100644
--- a/src/gui/text/qharfbuzzng.cpp
+++ b/src/gui/text/qharfbuzzng.cpp
@@ -230,6 +230,12 @@ static const hb_script_t _qtscript_to_hbscript[] = {
hb_script_t(HB_TAG('N', 'a', 'n', 'd')), // Script_Nandinagari
hb_script_t(HB_TAG('H', 'm', 'n', 'p')), // Script_NyiakengPuachueHmong
hb_script_t(HB_TAG('W', 'c', 'h', 'o')), // Script_Wancho
+
+ // Unicode 13.0 additions (as above)
+ hb_script_t(HB_TAG('C', 'h', 'o', 'r')), // Script_Chorasmian
+ hb_script_t(HB_TAG('D', 'i', 'v', 'e')), // Script_DivesAkuru
+ hb_script_t(HB_TAG('K', 'h', 'i', 't')), // Script_KhitanSmallScript
+ hb_script_t(HB_TAG('Y', 'e', 'z', 'i')), // Script_Yezidi
};
Q_STATIC_ASSERT(QChar::ScriptCount == sizeof(_qtscript_to_hbscript) / sizeof(_qtscript_to_hbscript[0]));
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 6a5c443455..f9c4a3949c 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1358,6 +1358,37 @@ void QTextEngine::shapeLine(const QScriptLine &line)
extern bool qt_useHarfbuzzNG(); // defined in qfontengine.cpp
#endif
+static void applyVisibilityRules(ushort ucs, QGlyphLayout *glyphs, uint glyphPosition, QFontEngine *fontEngine)
+{
+ // hide characters that should normally be invisible
+ switch (ucs) {
+ case QChar::LineFeed:
+ case 0x000c: // FormFeed
+ case QChar::CarriageReturn:
+ case QChar::LineSeparator:
+ case QChar::ParagraphSeparator:
+ glyphs->attributes[glyphPosition].dontPrint = true;
+ break;
+ case QChar::SoftHyphen:
+ if (!fontEngine->symbol) {
+ // U+00AD [SOFT HYPHEN] is a default ignorable codepoint,
+ // so we replace its glyph and metrics with ones for
+ // U+002D [HYPHEN-MINUS] and make it visible if it appears at line-break
+ const uint engineIndex = glyphs->glyphs[glyphPosition] & 0xff000000;
+ glyphs->glyphs[glyphPosition] = fontEngine->glyphIndex('-');
+ if (Q_LIKELY(glyphs->glyphs[glyphPosition] != 0)) {
+ glyphs->glyphs[glyphPosition] |= engineIndex;
+ QGlyphLayout tmp = glyphs->mid(glyphPosition, 1);
+ fontEngine->recalcAdvances(&tmp, { });
+ }
+ glyphs->attributes[glyphPosition].dontPrint = true;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
void QTextEngine::shapeText(int item) const
{
Q_ASSERT(item < layoutData->items.size());
@@ -1491,6 +1522,20 @@ void QTextEngine::shapeText(int item) const
&& QChar::isLowSurrogate(string[i + 1])) {
++i;
log_clusters[i] = glyph_pos;
+
+ initialGlyphs.attributes[glyph_pos].dontPrint = !QChar::isPrint(QChar::surrogateToUcs4(string[i], string[i + 1]));
+ } else {
+ initialGlyphs.attributes[glyph_pos].dontPrint = !QChar::isPrint(string[i]);
+ }
+
+ if (Q_UNLIKELY(!initialGlyphs.attributes[glyph_pos].dontPrint)) {
+ QFontEngine *actualFontEngine = fontEngine;
+ if (actualFontEngine->type() == QFontEngine::Multi) {
+ const uint engineIdx = initialGlyphs.glyphs[glyph_pos] >> 24;
+ actualFontEngine = static_cast<QFontEngineMulti *>(fontEngine)->engine(engineIdx);
+ }
+
+ applyVisibilityRules(string[i], &initialGlyphs, glyph_pos, actualFontEngine);
}
}
@@ -1702,31 +1747,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
last_glyph_pos = i + glyphs_shaped;
last_cluster = cluster;
- // hide characters that should normally be invisible
- switch (string[item_pos + str_pos]) {
- case QChar::LineFeed:
- case 0x000c: // FormFeed
- case QChar::CarriageReturn:
- case QChar::LineSeparator:
- case QChar::ParagraphSeparator:
- g.attributes[i].dontPrint = true;
- break;
- case QChar::SoftHyphen:
- if (!actualFontEngine->symbol) {
- // U+00AD [SOFT HYPHEN] is a default ignorable codepoint,
- // so we replace its glyph and metrics with ones for
- // U+002D [HYPHEN-MINUS] and make it visible if it appears at line-break
- g.glyphs[i] = actualFontEngine->glyphIndex('-');
- if (Q_LIKELY(g.glyphs[i] != 0)) {
- QGlyphLayout tmp = g.mid(i, 1);
- actualFontEngine->recalcAdvances(&tmp, { });
- }
- g.attributes[i].dontPrint = true;
- }
- break;
- default:
- break;
- }
+ applyVisibilityRules(string[item_pos + str_pos], &g, i, actualFontEngine);
}
}
while (str_pos < item_length)
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 3d7a097cd9..4d0a9e3a7c 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1667,7 +1667,8 @@ namespace {
QFontEngine *previousGlyphFontEngine;
QFixed minw;
- QFixed softHyphenWidth;
+ QFixed currentSoftHyphenWidth;
+ QFixed commitedSoftHyphenWidth;
QFixed rightBearing;
QFixed minimumRightBearing;
@@ -1681,7 +1682,7 @@ namespace {
QFixed calculateNewWidth(const QScriptLine &line) const {
return line.textWidth + tmpData.textWidth + spaceData.textWidth
- + softHyphenWidth + negativeRightBearing();
+ + (line.textWidth > 0 ? currentSoftHyphenWidth : QFixed()) + negativeRightBearing();
}
inline glyph_t currentGlyph() const
@@ -1755,6 +1756,7 @@ inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line)
if (line.length && !manualWrap && (newWidth > line.width || glyphCount > maxGlyphs))
return true;
+ const QFixed oldTextWidth = line.textWidth;
minw = qMax(minw, tmpData.textWidth);
line += tmpData;
line.textWidth += spaceData.textWidth;
@@ -1765,6 +1767,11 @@ inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line)
spaceData.textWidth = 0;
spaceData.length = 0;
+ if (oldTextWidth != line.textWidth || currentSoftHyphenWidth > 0) {
+ commitedSoftHyphenWidth = currentSoftHyphenWidth;
+ currentSoftHyphenWidth = 0;
+ }
+
return false;
}
@@ -1837,7 +1844,6 @@ void QTextLine::layout_helper(int maxGlyphs)
while (newItem < eng->layoutData->items.size()) {
lbh.resetRightBearing();
- lbh.softHyphenWidth = 0;
if (newItem != item) {
item = newItem;
const QScriptItem &current = eng->layoutData->items.at(item);
@@ -1975,9 +1981,9 @@ void QTextLine::layout_helper(int maxGlyphs)
} while (lbh.currentPosition < end);
lbh.minw = qMax(lbh.tmpData.textWidth, lbh.minw);
- if (lbh.currentPosition > 0 && lbh.currentPosition < end
- && attributes[lbh.currentPosition].lineBreak
- && eng->layoutData->string.at(lbh.currentPosition - 1).unicode() == QChar::SoftHyphen) {
+ if (lbh.currentPosition > 0 && lbh.currentPosition <= end
+ && (lbh.currentPosition == end || attributes[lbh.currentPosition].lineBreak)
+ && eng->layoutData->string.at(lbh.currentPosition - 1) == QChar::SoftHyphen) {
// if we are splitting up a word because of
// a soft hyphen then we ...
//
@@ -1994,10 +2000,7 @@ void QTextLine::layout_helper(int maxGlyphs)
// want the soft-hyphen to slip into the next line
// and thus become invisible again.
//
- if (line.length)
- lbh.softHyphenWidth = lbh.glyphs.advances[lbh.logClusters[lbh.currentPosition - 1]];
- else if (breakany)
- lbh.tmpData.textWidth += lbh.glyphs.advances[lbh.logClusters[lbh.currentPosition - 1]];
+ lbh.currentSoftHyphenWidth = lbh.glyphs.advances[lbh.logClusters[lbh.currentPosition - 1]];
}
if (sb_or_ws|breakany) {
@@ -2023,6 +2026,7 @@ void QTextLine::layout_helper(int maxGlyphs)
lbh.calculateRightBearing();
if (lbh.checkFullOtherwiseExtend(line)) {
+
// We are too wide to accept the next glyph with its bearing, so we restore the
// right bearing to that of the previous glyph (the one that was already accepted),
// so that the bearing can be be applied to the final width of the text below.
@@ -2031,9 +2035,7 @@ void QTextLine::layout_helper(int maxGlyphs)
else
lbh.calculateRightBearingForPreviousGlyph();
- if (!breakany) {
- line.textWidth += lbh.softHyphenWidth;
- }
+ line.textWidth += lbh.commitedSoftHyphenWidth;
goto found;
}
@@ -2045,6 +2047,7 @@ void QTextLine::layout_helper(int maxGlyphs)
}
LB_DEBUG("reached end of line");
lbh.checkFullOtherwiseExtend(line);
+ line.textWidth += lbh.commitedSoftHyphenWidth;
found:
line.textAdvance = line.textWidth;
diff --git a/src/gui/util/qshaderformat_p.h b/src/gui/util/qshaderformat_p.h
index c50d7d5729..d9d0378f63 100644
--- a/src/gui/util/qshaderformat_p.h
+++ b/src/gui/util/qshaderformat_p.h
@@ -66,7 +66,8 @@ public:
OpenGLNoProfile,
OpenGLCoreProfile,
OpenGLCompatibilityProfile,
- OpenGLES
+ OpenGLES,
+ VulkanFlavoredGLSL
};
enum ShaderType : int {
diff --git a/src/gui/util/qshadernodesloader.cpp b/src/gui/util/qshadernodesloader.cpp
index 922479332c..349f11c541 100644
--- a/src/gui/util/qshadernodesloader.cpp
+++ b/src/gui/util/qshadernodesloader.cpp
@@ -217,9 +217,10 @@ void QShaderNodesLoader::load(const QJsonObject &prototypesObject)
: api == QStringLiteral("OpenGLNoProfile") ? QShaderFormat::OpenGLNoProfile
: api == QStringLiteral("OpenGLCoreProfile") ? QShaderFormat::OpenGLCoreProfile
: api == QStringLiteral("OpenGLCompatibilityProfile") ? QShaderFormat::OpenGLCompatibilityProfile
+ : api == QStringLiteral("VulkanFlavoredGLSL") ? QShaderFormat::VulkanFlavoredGLSL
: QShaderFormat::NoApi);
if (format.api() == QShaderFormat::NoApi) {
- qWarning() << "Format API must be one of: OpenGLES, OpenGLNoProfile, OpenGLCoreProfile or OpenGLCompatibilityProfile";
+ qWarning() << "Format API must be one of: OpenGLES, OpenGLNoProfile, OpenGLCoreProfile or OpenGLCompatibilityProfile, VulkanFlavoredGLSL";
hasError = true;
break;
}