From be6c70ed7f9a5fed98d44f9993492ab9d2fc16df Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 19 Mar 2019 13:34:52 +0100 Subject: macOS: Don't scale advances to 0 when stretch is AnyStretch If the stretch is set to AnyStretch, then this is taken to mean we should accept the font as it is. But on mac, there is a special code path to scale the advances since the shaper doesn't do it for us, and this neglected to check the stretch, thus it would scale the advances by 0%. This happened when loading a file directly in QRawFont and using this in a QTextLayout, since no part of the code path will attempt to calculate the stretch in that case. Reproducible in q3dsviewer in Qt 3D Runtime 2.3. Task-number: QT3DS-3132 Change-Id: I8f934f3fac41bf7a93c01cca0416d44003119907 Reviewed-by: Lars Knoll Reviewed-by: Konstantin Ritt Reviewed-by: Allan Sandfeld Jensen --- src/gui/text/qtextengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index a83ef95c79..22c93d7ec2 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1754,7 +1754,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, #ifdef Q_OS_DARWIN if (actualFontEngine->type() == QFontEngine::Mac) { - if (actualFontEngine->fontDef.stretch != 100) { + if (actualFontEngine->fontDef.stretch != 100 && actualFontEngine->fontDef.stretch != QFont::AnyStretch) { QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100); for (uint i = 0; i < num_glyphs; ++i) g.advances[i] *= stretch; -- cgit v1.2.3 From ff8d9ad5bcae7c29a49ed895dbfcf49061aaed39 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 24 Jan 2019 14:59:51 +0100 Subject: Speculative fix for building on INTEGRITY with ARM NEON Avoid using inline assembler Task-number: QTBUG-72716 Change-Id: I696efb5a787416eb4fc5ba3a250461aaa9a4afc2 Reviewed-by: Janne Koskinen --- src/gui/image/qimage_neon.cpp | 66 +++++++++++------------------------ src/gui/painting/painting.pri | 6 ++-- src/gui/painting/qdrawhelper_neon.cpp | 41 ++++++++++++++-------- 3 files changed, 51 insertions(+), 62 deletions(-) (limited to 'src/gui') diff --git a/src/gui/image/qimage_neon.cpp b/src/gui/image/qimage_neon.cpp index 57a24edeca..9dbcb11db5 100644 --- a/src/gui/image/qimage_neon.cpp +++ b/src/gui/image/qimage_neon.cpp @@ -52,65 +52,41 @@ Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, cons const quint32 *const end = dst + len; - // align dst on 64 bits - const int offsetToAlignOn8Bytes = (reinterpret_cast(dst) >> 2) & 0x1; - for (int i = 0; i < offsetToAlignOn8Bytes; ++i) { + // align dst on 128 bits + const int offsetToAlignOn16Bytes = (reinterpret_cast(dst) >> 2) & 0x3; + for (int i = 0; i < offsetToAlignOn16Bytes; ++i) { *dst++ = qRgb(src[0], src[1], src[2]); src += 3; } - if ((len - offsetToAlignOn8Bytes) >= 8) { - const quint32 *const simdEnd = end - 7; -#if !defined(Q_PROCESSOR_ARM_64) - register uint8x8_t fullVector asm ("d3") = vdup_n_u8(0xff); - do { + if ((len - offsetToAlignOn16Bytes) >= 16) { + const quint32 *const simdEnd = end - 15; + uint8x16x4_t dstVector; #if Q_BYTE_ORDER == Q_BIG_ENDIAN - asm volatile ( - "vld3.8 { d4, d5, d6 }, [%[SRC]] !\n\t" - "vst4.8 { d3, d4, d5, d6 }, [%[DST],:64] !\n\t" - : [DST]"+r" (dst), [SRC]"+r" (src) - : "w"(fullVector) - : "memory", "d4", "d5", "d6" - ); + dstVector.val[0] = vdupq_n_u8(0xff); #else - asm volatile ( - "vld3.8 { d0, d1, d2 }, [%[SRC]] !\n\t" - "vswp d0, d2\n\t" - "vst4.8 { d0, d1, d2, d3 }, [%[DST],:64] !\n\t" - : [DST]"+r" (dst), [SRC]"+r" (src) - : "w"(fullVector) - : "memory", "d0", "d1", "d2" - ); + dstVector.val[3] = vdupq_n_u8(0xff); #endif - } while (dst < simdEnd); -#else - register uint8x8_t fullVector asm ("v3") = vdup_n_u8(0xff); do { + uint8x16x3_t srcVector = vld3q_u8(src); + src += 3 * 16; #if Q_BYTE_ORDER == Q_BIG_ENDIAN - asm volatile ( - "ld3 { v4.8b, v5.8b, v6.8b }, [%[SRC]], #24 \n\t" - "st4 { v3.8b, v4.8b, v5.8b, v6.8b }, [%[DST]], #32 \n\t" - : [DST]"+r" (dst), [SRC]"+r" (src) - : "w"(fullVector) - : "memory", "v4", "v5", "v6" - ); + dstVector.val[1] = srcVector.val[0]; + dstVector.val[2] = srcVector.val[1]; + dstVector.val[3] = srcVector.val[2]; #else - asm volatile ( - "ld3 { v0.8b, v1.8b, v2.8b }, [%[SRC]], #24 \n\t" - "mov v4.8b, v2.8b\n\t" - "mov v2.8b, v0.8b\n\t" - "mov v0.8b, v4.8b\n\t" - "st4 { v0.8b, v1.8b, v2.8b, v3.8b }, [%[DST]], #32 \n\t" - : [DST]"+r" (dst), [SRC]"+r" (src) - : "w"(fullVector) - : "memory", "v0", "v1", "v2", "v4" - ); + dstVector.val[0] = srcVector.val[2]; + dstVector.val[1] = srcVector.val[1]; + dstVector.val[2] = srcVector.val[0]; #endif + vst4q_u8(reinterpret_cast(dst), dstVector); + dst += 16; } while (dst < simdEnd); -#endif } - while (dst != end) { + int i = 0; + int length = end - dst; + SIMD_EPILOGUE(i, length, 15) { *dst++ = qRgb(src[0], src[1], src[2]); src += 3; } diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index c3585a4647..a90abed4c0 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -131,9 +131,11 @@ ARCH_HASWELL_SOURCES += painting/qdrawhelper_avx2.cpp NEON_SOURCES += painting/qdrawhelper_neon.cpp painting/qimagescale_neon.cpp NEON_HEADERS += painting/qdrawhelper_neon_p.h -NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S !uikit:!win32:contains(QT_ARCH, "arm"): CONFIG += no_clang_integrated_as -!uikit:!win32:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS +!uikit:!win32:!integrity:!contains(QT_ARCH, "arm64") { + NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S + DEFINES += ENABLE_PIXMAN_DRAWHELPERS +} MIPS_DSP_SOURCES += painting/qdrawhelper_mips_dsp.cpp MIPS_DSP_HEADERS += painting/qdrawhelper_mips_dsp_p.h painting/qt_mips_asm_dsp_p.h diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index 629dfe2358..3fbd651f96 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -50,7 +50,18 @@ QT_BEGIN_NAMESPACE void qt_memfill32(quint32 *dest, quint32 value, int count) { const int epilogueSize = count % 16; -#if !defined(Q_PROCESSOR_ARM_64) +#if defined(Q_CC_GHS) || defined(Q_CC_MSVC) + // inline assembler free version: + if (count >= 16) { + quint32 *const neonEnd = dest + count - epilogueSize; + const uint32x4_t valueVector1 = vdupq_n_u32(value); + const uint32x4x4_t valueVector4 = { valueVector1, valueVector1, valueVector1, valueVector1 }; + do { + vst4q_u32(dest, valueVector4); + dest += 16; + } while (dest != neonEnd); + } +#elif !defined(Q_PROCESSOR_ARM_64) if (count >= 16) { quint32 *const neonEnd = dest + count - epilogueSize; register uint32x4_t valueVector1 asm ("q0") = vdupq_n_u32(value); @@ -84,20 +95,20 @@ void qt_memfill32(quint32 *dest, quint32 value, int count) switch (epilogueSize) { - case 15: *dest++ = value; - case 14: *dest++ = value; - case 13: *dest++ = value; - case 12: *dest++ = value; - case 11: *dest++ = value; - case 10: *dest++ = value; - case 9: *dest++ = value; - case 8: *dest++ = value; - case 7: *dest++ = value; - case 6: *dest++ = value; - case 5: *dest++ = value; - case 4: *dest++ = value; - case 3: *dest++ = value; - case 2: *dest++ = value; + case 15: *dest++ = value; Q_FALLTHROUGH(); + case 14: *dest++ = value; Q_FALLTHROUGH(); + case 13: *dest++ = value; Q_FALLTHROUGH(); + case 12: *dest++ = value; Q_FALLTHROUGH(); + case 11: *dest++ = value; Q_FALLTHROUGH(); + case 10: *dest++ = value; Q_FALLTHROUGH(); + case 9: *dest++ = value; Q_FALLTHROUGH(); + case 8: *dest++ = value; Q_FALLTHROUGH(); + case 7: *dest++ = value; Q_FALLTHROUGH(); + case 6: *dest++ = value; Q_FALLTHROUGH(); + case 5: *dest++ = value; Q_FALLTHROUGH(); + case 4: *dest++ = value; Q_FALLTHROUGH(); + case 3: *dest++ = value; Q_FALLTHROUGH(); + case 2: *dest++ = value; Q_FALLTHROUGH(); case 1: *dest++ = value; } } -- cgit v1.2.3 From 28a264cfe2d161f2eba3b1efa3ea4985445cd2de Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 8 Mar 2019 10:55:14 +0100 Subject: Fix alpha blending regression with WA_StacksOnTop QOpenGLWidgets 0bc42886898 in Qt 5.6 introduced support for premultiplied alpha in the raster-rendered QWidget content. Unfortunately this introduced a regression for OpenGL content from QOpenGLWidgets with WA_StacksOnTop set: these used standard alpha blending in 5.5 and earlier, and switching them to premultiplied (in case the - unrelated - raster content has a _Premultiplied QImage format) breaks all content that was done with non-premultiplied alpha in mind, for example the qopenglwidget example's "Transparent background" checkbox. Restore the pre-5.6 behavior. Fixes: QTBUG-74285 Change-Id: I76fcadd53cd436efa2b619b8d6739270995d044f Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qplatformbackingstore.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gui') diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index afb4613ba5..c71d82546a 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -446,6 +446,11 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i d_ptr->blitter->setRedBlueSwizzle(false); } + // There is no way to tell if the OpenGL-rendered content is premultiplied or not. + // For compatibility, assume that it is not, and use normal alpha blend always. + if (d_ptr->premultiplied) + funcs->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE); + // Textures for renderToTexture widgets that have WA_AlwaysStackOnTop set. for (int i = 0; i < textures->count(); ++i) { if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) -- cgit v1.2.3