From d9ca61bf0f6e544ad1fe2908e84c4a4966e5d0a1 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 2 Mar 2020 17:40:11 +0100 Subject: Add the include for QPointer to avoid MSVC compilation error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It has been reported that 7447e2b337f12b4d04935d0f30fc673e4327d5a0 needs amending to build on MSVC 2019, although it was OK in CI. Change-Id: Id22c2a3608529abebd66c0e8f401bc6f26f45e18 Reviewed-by: Mårten Nordheim --- src/gui/text/qtextmarkdownimporter_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gui') diff --git a/src/gui/text/qtextmarkdownimporter_p.h b/src/gui/text/qtextmarkdownimporter_p.h index e3b4bcd0f2..f12b725d8e 100644 --- a/src/gui/text/qtextmarkdownimporter_p.h +++ b/src/gui/text/qtextmarkdownimporter_p.h @@ -56,6 +56,7 @@ #include #include #include +#include #include QT_BEGIN_NAMESPACE -- cgit v1.2.3 From bd3c82f8db4391fc1d6d3338827356143fd598dd Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 24 Feb 2020 11:07:29 +0100 Subject: Fix non-trivial soft-hyphen line breaks The effect of the soft-hyphen needs to be updated once the final the break point has been found. This change cleans the logic by using two variables keeping track of soft-hyphen at current evaluated position and at last confirmed break point. Also adds tests for supression of soft-hyphens in the tight WrapAnywhere case. Fixes: QTBUG-35940 Fixes: QTBUG-44257 Change-Id: I7a89a8ef991b87691879bb7ce40cec4a3605fdd5 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextlayout.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index a3e194f835..aaca1061b7 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 ¤t = 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; -- cgit v1.2.3 From ee259ff60b6af94d9480ab6c3e3ffbbf7728e4a4 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 22 Nov 2019 16:09:40 +0100 Subject: Replace initialization of sparse table of converts with setters This is similar to how the similar table in qblendfunctions.cpp is now set, and is easier to read and maintain. Change-Id: I43a885fae7b1a92110bb33f0b22a5b02fddc0115 Reviewed-by: Eirik Aavitsland --- src/gui/image/qimage_conversions.cpp | 1335 ++++++---------------------------- 1 file changed, 230 insertions(+), 1105 deletions(-) (limited to 'src/gui') diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 4f570d8684..c02c0c0d97 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -2128,1115 +2128,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, - 0, - convert_ARGB_to_A2RGB30, - 0, 0, - 0, - convert_ARGB32_to_RGBA64, - 0, 0, 0 - }, // Format_ARGB32 +Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormats] = {}; +InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] = {}; - { - 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, - convert_RGB888_to_RGB, - convert_RGB888_to_RGB, - 0, - 0, - 0, - 0, - 0, - 0, - 0, // self - 0, - 0, - convert_RGB888_to_RGB, - convert_RGB888_to_RGB, - convert_RGB888_to_RGB, - 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, - 0, - convert_ARGB_to_A2RGB30, - 0, 0, - 0, - convert_ARGB32_to_RGBA64, - 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 - - { - 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, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - convert_A2RGB30_PM_to_ARGB, - 0, - convert_A2RGB30_PM_to_RGB30, - 0, - convert_A2RGB30_PM_to_RGB30, - 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, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - convert_A2RGB30_PM_to_ARGB, - 0, - convert_A2RGB30_PM_to_RGB30, - convert_rgbswap_generic, - convert_A2RGB30_PM_to_RGB30, - 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, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - convert_RGBA64_to_ARGB32, - 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, - convert_RGBA64PM_to_RGBA64, - 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; + qimage_converter_map[QImage::Format_ARGB32][QImage::Format_A2RGB30_Premultiplied] = convert_ARGB_to_A2RGB30; + qimage_converter_map[QImage::Format_ARGB32][QImage::Format_RGBA64] = convert_ARGB32_to_RGBA64; + + 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; + qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB; + qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB; + qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGBX8888] = convert_RGB888_to_RGB; + qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGBA8888] = convert_RGB888_to_RGB; + qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGBA8888_Premultiplied] = convert_RGB888_to_RGB; + 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; + qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_A2RGB30_Premultiplied] = convert_ARGB_to_A2RGB30; + qimage_converter_map[QImage::Format_RGBA8888][QImage::Format_RGBA64] = convert_ARGB32_to_RGBA64; + + 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; + qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGBA8888] = convert_A2RGB30_PM_to_ARGB; + qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_BGR30] = convert_A2RGB30_PM_to_RGB30; + qimage_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGB30] = convert_A2RGB30_PM_to_RGB30; + 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; + qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_RGBA8888] = convert_A2RGB30_PM_to_ARGB; + qimage_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_BGR30] = convert_A2RGB30_PM_to_RGB30; + 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; + + 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; + qimage_converter_map[QImage::Format_RGBA64][QImage::Format_RGBA8888] = convert_RGBA64_to_ARGB32; + 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; + qimage_converter_map[QImage::Format_RGBA64_Premultiplied][QImage::Format_RGBA64] = convert_RGBA64PM_to_RGBA64; + 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, - convert_RGB888_to_RGB, - convert_RGB888_to_RGB, -#else - 0, 0, 0, + qimage_converter_map[QImage::Format_BGR888][QImage::Format_RGBX8888] = convert_RGB888_to_RGB; + qimage_converter_map[QImage::Format_BGR888][QImage::Format_RGBA8888] = convert_RGB888_to_RGB; + qimage_converter_map[QImage::Format_BGR888][QImage::Format_RGBA8888_Premultiplied] = convert_RGB888_to_RGB; #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, - mask_alpha_converter_inplace, - 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, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - convert_ARGB_to_RGBA_inplace, - convert_ARGB_to_RGBA_inplace, - 0, - 0, - convert_ARGB_to_A2RGB30_inplace, - 0, - convert_ARGB_to_A2RGB30_inplace, - 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, - 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, - convert_RGBA_to_ARGB_inplace, - convert_RGBA_to_ARGB_inplace, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - convert_passthrough_inplace, - convert_passthrough_inplace, - 0, - 0, - 0, - 0, - 0, 0, - 0, 0, 0, 0, 0 - }, // Format_RGBX8888 - { - 0, - 0, - 0, - 0, - convert_RGBA_to_ARGB_inplace, - convert_RGBA_to_ARGB_inplace, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - mask_alpha_converter_rgbx_inplace, - 0, - 0, - 0, - convert_ARGB_to_A2RGB30_inplace, - 0, - convert_ARGB_to_A2RGB30_inplace, - 0, 0, - 0, 0, 0, 0, 0 - }, // Format_RGBA8888 - { - 0, - 0, - 0, - 0, - 0, - 0, - convert_RGBA_to_ARGB_inplace, - 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, - 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, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - convert_A2RGB30_PM_to_ARGB_inplace, - 0, - convert_A2RGB30_PM_to_RGB30_inplace, - 0, // self - convert_A2RGB30_PM_to_RGB30_inplace, - 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, - 0, 0, 0, 0, 0, 0, 0 - }, // Format_RGB30 - { - 0, - 0, - 0, - 0, - 0, - convert_A2RGB30_PM_to_ARGB_inplace, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - convert_A2RGB30_PM_to_ARGB_inplace, - 0, - convert_A2RGB30_PM_to_RGB30_inplace, - convert_rgbswap_generic_inplace, - convert_A2RGB30_PM_to_RGB30_inplace, - 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, - convert_passthrough_inplace, - 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, - convert_RGBA64PM_to_RGBA64_inplace, - 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_inplace_converter_map[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = + mask_alpha_converter_inplace; + + qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_RGB32] = + mask_alpha_converter_inplace; + qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_RGBX8888] = + convert_ARGB_to_RGBA_inplace; + qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_RGBA8888] = + convert_ARGB_to_RGBA_inplace; + qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_A2BGR30_Premultiplied] = + convert_ARGB_to_A2RGB30_inplace; + qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_A2RGB30_Premultiplied] = + convert_ARGB_to_A2RGB30_inplace; + + qimage_inplace_converter_map[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = + convert_ARGB_to_RGBA_inplace; + + 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_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_ARGB32] = + convert_RGBA_to_ARGB_inplace; + qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_ARGB32_Premultiplied] = + convert_RGBA_to_ARGB_inplace; + qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_RGBA8888] = + convert_passthrough_inplace; + qimage_inplace_converter_map[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = + convert_passthrough_inplace; + + qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_RGB32] = + convert_RGBA_to_ARGB_inplace; + qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_ARGB32] = + convert_RGBA_to_ARGB_inplace; + 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; + qimage_inplace_converter_map[QImage::Format_RGBA8888][QImage::Format_A2RGB30_Premultiplied] = + convert_ARGB_to_A2RGB30_inplace; + + qimage_inplace_converter_map[QImage::Format_RGBA8888_Premultiplied][QImage::Format_ARGB32_Premultiplied] = + convert_RGBA_to_ARGB_inplace; + + qimage_inplace_converter_map[QImage::Format_BGR30][QImage::Format_A2BGR30_Premultiplied] = + convert_passthrough_inplace; + 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; + qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGBA8888] = + convert_A2RGB30_PM_to_ARGB_inplace; + qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_BGR30] = + convert_A2RGB30_PM_to_RGB30_inplace; + qimage_inplace_converter_map[QImage::Format_A2BGR30_Premultiplied][QImage::Format_RGB30] = + convert_A2RGB30_PM_to_RGB30_inplace; + 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_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_ARGB32] = + convert_A2RGB30_PM_to_ARGB_inplace; + qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_RGBA8888] = + convert_A2RGB30_PM_to_ARGB_inplace; + qimage_inplace_converter_map[QImage::Format_A2RGB30_Premultiplied][QImage::Format_BGR30] = + convert_A2RGB30_PM_to_RGB30_inplace; + 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; + + 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_inplace_converter_map[QImage::Format_RGBX64][QImage::Format_RGBA64_Premultiplied] = + convert_passthrough_inplace; + + 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; + qimage_inplace_converter_map[QImage::Format_RGBA64_Premultiplied][QImage::Format_RGBA64] = + convert_RGBA64PM_to_RGBA64_inplace; + + 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); -- cgit v1.2.3 From 198d8eb5d093db233d7354bb6451e3cb9113fe61 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 11 Mar 2020 14:29:03 +0100 Subject: Fix multi-threaded shrinking conversion The conversion takes place in separate blocks, but may need to be compressed after converting. Fixes: QTBUG-82818 Change-Id: I71431af3d41e1bfe1f9b3d8cd7c1e0a2020846cd Reviewed-by: Lars Knoll Reviewed-by: Eirik Aavitsland --- src/gui/image/qimage_conversions.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index c02c0c0d97..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); -- cgit v1.2.3 From 52e9c8b4be6718bda1a46859d6b1c13664c57c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 9 Mar 2020 18:05:14 +0100 Subject: macOS: Streamline QImage to NSImage conversion The conversion uses NSBitmapImageRep and correctly sets the display pixel ratio and size of the resulting image, reducing the need for clients to deal with this. The function returns an auto-released object, as is customary for class-functions like these. Change-Id: I5124d1d8145a7f5266921b22fda1987798771ec1 Reviewed-by: Timur Pocheptsov --- src/gui/painting/qcoregraphics.mm | 41 +++++++++++++++++++++++++------------- src/gui/painting/qcoregraphics_p.h | 8 +++++++- 2 files changed, 34 insertions(+), 15 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm index e2497eaadb..b5620535fb 100644 --- a/src/gui/painting/qcoregraphics.mm +++ b/src/gui/painting/qcoregraphics.mm @@ -47,6 +47,8 @@ #include #include +QT_USE_NAMESPACE + QT_BEGIN_NAMESPACE // ---------------------- Images ---------------------- @@ -124,23 +126,34 @@ QImage qt_mac_toQImage(CGImageRef image) #ifdef Q_OS_MACOS -static NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image) -{ - NSImage *newImage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize]; - return newImage; -} +QT_END_NAMESPACE -NSImage *qt_mac_create_nsimage(const QPixmap &pm) +@implementation NSImage (QtExtras) ++ (instancetype)imageFromQImage:(const QImage &)image { - 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; + if (image.isNull()) + return nil; + + QCFType 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]; } +@end + +QT_BEGIN_NAMESPACE NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize) { diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h index ba2cde8325..e1697b0f38 100644 --- a/src/gui/painting/qcoregraphics_p.h +++ b/src/gui/painting/qcoregraphics_p.h @@ -69,9 +69,15 @@ 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; +@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); -- cgit v1.2.3 From bee3d0fc1310da6685dce9cf9b1334fb8295aa9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 9 Mar 2020 18:43:52 +0100 Subject: macOS: Streamline QIcon to NSImage conversion The conversion uses NSBitmapImageRep and correctly sets the display pixel ratio and size of the resulting image, reducing the need for clients to deal with this. It also propagates the isMask property of the icon to the NSImage. The function returns an auto-released object, as is customary for class-functions like these. Change-Id: If97f3d383959cd0f58a0d1249f5c26e52c1da9cd Reviewed-by: Timur Pocheptsov --- src/gui/painting/qcoregraphics.mm | 47 +++++++++++++++++++++++++------------- src/gui/painting/qcoregraphics_p.h | 3 ++- 2 files changed, 33 insertions(+), 17 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm index b5620535fb..94ba004c93 100644 --- a/src/gui/painting/qcoregraphics.mm +++ b/src/gui/painting/qcoregraphics.mm @@ -151,32 +151,47 @@ QT_END_NAMESPACE return [nsImage autorelease]; } -@end -QT_BEGIN_NAMESPACE ++ (instancetype)imageFromQIcon:(const QIcon &)icon +{ + 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 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; + + QCFType cgImage = image.toCGImage(); + if (!cgImage) continue; - QImage image = pm.toImage(); - CGImageRef cgImage = qt_mac_toCGImage(image); - NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage]; - [nsImage addRepresentation:imageRep]; - [imageRep release]; - CGImageRelease(cgImage); + + 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 e1697b0f38..db012d3cda 100644 --- a/src/gui/painting/qcoregraphics_p.h +++ b/src/gui/painting/qcoregraphics_p.h @@ -69,12 +69,13 @@ 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 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 -- cgit v1.2.3 From 6dbe03c4d15261d0b860d76acaf6d64243213d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Thu, 12 Mar 2020 15:20:47 +0100 Subject: Make vulkan-flavored GLSL known to QShaderFormat Change-Id: I6a3799c35aafa38095b316ee01d14b9db3af5e04 Reviewed-by: Paul Lemire --- src/gui/util/qshaderformat_p.h | 3 ++- src/gui/util/qshadernodesloader.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/gui') 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; } -- cgit v1.2.3 From 36325f9d86249a4f17f7efbbc1122c462708d909 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 5 Mar 2020 09:26:42 +0100 Subject: Hide default-invisible characters when shaping is disabled When shaping is disabled we also skipped the step which set dontPrint to true for soft hyphens, line separators, and similar characters. This caused boxes to appear in text with e.g. line separators. There is a minor modification to the code that is moved: In the case on unshaped text and only the CMAP able is used, the font engine for the soft hyphen can be a fallback engine, so we need to also set the correct engine index when changing the glyph index. [ChangeLog][QtGui][Text] Fixed an issue with QFont::PreferNoShaping where boxes would appear in place of unprintable characters. Fixes: QTBUG-81994 Change-Id: Ifc9f4f89d928475ca0487a92b4480bd5db5918fd Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll --- src/gui/text/qtextengine.cpp | 71 ++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 25 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 81ed8fa97a..26e8141184 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(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) -- cgit v1.2.3 From ef5c747abafa54aa830e3ba4d64a4c407e1bd1d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 13 Mar 2020 12:11:46 +0100 Subject: Fix range-loop implicit copy warning Make the copy explicit. qhighdpiscaling_p.h:282:24: warning: loop variable 'rect' has type 'const QRectF &' but is initialized with type 'const QRect' resulting in a copy [-Wrange-loop-analysis] for (const QRectF &rect : pixelRegion) { ^ Change-Id: I4080ff42c41e464d081ab2b01cb2d010867b041b Reviewed-by: Friedemann Kleint --- src/gui/kernel/qhighdpiscaling_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') 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())), -- cgit v1.2.3 From 7ddbd179a191c45946959fa0a898ba3e1f1c0cea Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Mon, 10 Sep 2018 15:43:56 +1000 Subject: qpa: Return accepted state from mouse, touch and wheel handlers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return the value from handleWindowSystemEvent so platform plugins can detect whether it was accepted or not. Change-Id: I53ffb713afc8e0ec1789107c912433133cfaa11a Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindowsysteminterface.cpp | 110 +++++++++++++++--------------- src/gui/kernel/qwindowsysteminterface.h | 46 ++++++------- 2 files changed, 79 insertions(+), 77 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 7e43594366..b20578940c 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(window, local, global, b, Qt::NoButton, QEvent::None, mods, source); + return handleMouseEvent(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(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source); + return handleMouseEvent(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(window, time, local, global, state, button, type, mods, source); + return handleMouseEvent(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(e); + return QWindowSystemInterfacePrivate::handleWindowSystemEvent(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 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 &points, Qt::KeyboardModifiers mods) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); - handleTouchEvent(window, time, device, points, mods); + return handleTouchEvent(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 &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 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(e); + return QWindowSystemInterfacePrivate::handleWindowSystemEvent(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(window, time, device, mods); + return handleTouchCancelEvent(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(), mods); - QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); + return QWindowSystemInterfacePrivate::handleWindowSystemEvent(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 - 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 - 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 - 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 - 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 - static void handleTouchEvent(QWindow *window, QTouchDevice *device, + static bool handleTouchEvent(QWindow *window, QTouchDevice *device, const QList &points, Qt::KeyboardModifiers mods = Qt::NoModifier); template - static void handleTouchEvent(QWindow *window, ulong timestamp, QTouchDevice *device, + static bool handleTouchEvent(QWindow *window, ulong timestamp, QTouchDevice *device, const QList &points, Qt::KeyboardModifiers mods = Qt::NoModifier); template - 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 - 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 @@ -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 -- cgit v1.2.3 From 54f8be6cc0e53bcd8b2e67d302b7cbcaed9387b9 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 13 Mar 2020 17:26:53 +0100 Subject: Update UCD to Revision 26 Include WordBreakTest.html, since a test uses sample strings from it, albeit without actually reading the file. Had to comment out more of the new tests, as at Revision 24, pending an update to harfbuzz and the text boundary detection code. Task-number: QTBUG-79631 Task-number: QTBUG-79418 Task-number: QTBUG-82747 Change-Id: I0082294b09d67ffdc6a9b5c15acf77ad3b86f65f Reviewed-by: Lars Knoll --- src/gui/text/qharfbuzzng.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gui') 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])); -- cgit v1.2.3 From 26ed956cbc5b081b972fe0c435e77e62d3f7944b Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Sat, 14 Mar 2020 22:31:42 +0100 Subject: Doc: Remove \contentspage commands The command is deprecated and has no effect apart from generating a documentation warning. Change-Id: I30871bfd6975f8268930cce99993a8579242fdb8 Reviewed-by: Paul Wicking --- src/gui/doc/src/paintsystem.qdoc | 3 --- src/gui/doc/src/richtext.qdoc | 6 ------ 2 files changed, 9 deletions(-) (limited to 'src/gui') 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} -- cgit v1.2.3 From d6ddd2125715f8251e1cfec99109f789a1aaaffb Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Tue, 3 Mar 2020 20:37:43 +1000 Subject: wasm: remove uneeded platform plugins from build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wasm does not use minimal, offscreen or qvnc platform plugins. Change-Id: I3a1919a260280ffdff33b68502d488f71f2b0c13 Reviewed-by: Morten Johan Sørvig --- src/gui/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/configure.json b/src/gui/configure.json index 4de159d97a..5ebcdb99b5 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -1292,7 +1292,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" ] -- cgit v1.2.3