summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/doc/src/qtgui.qdoc5
-rw-r--r--src/gui/painting/qdrawhelper.cpp58
-rw-r--r--src/gui/vulkan/qvulkanwindow.cpp14
3 files changed, 58 insertions, 19 deletions
diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc
index a425c8a84d..53fd55bd39 100644
--- a/src/gui/doc/src/qtgui.qdoc
+++ b/src/gui/doc/src/qtgui.qdoc
@@ -46,11 +46,12 @@
\snippet code/doc_src_qtgui.pro 0
+ \if !defined(qtforpython)
If you use \l qmake to build your projects, \l{Qt GUI} is included by
default. To disable Qt GUI, add the following line to your \c .pro file:
\snippet code/doc_src_qtgui.pro 1
-
+ \endif
*/
/*!
@@ -75,10 +76,12 @@
\snippet code/doc_src_qtgui.pro 0
+ \if !defined(qtforpython)
If you use \l qmake to build your projects, Qt GUI is included by
default. To disable Qt GUI, add the following line to your \c .pro file:
\snippet code/doc_src_qtgui.pro 1
+ \endif
\section1 Application Windows
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 8f189994f1..582e403e4c 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5689,6 +5689,46 @@ static inline int qRgbAvg(QRgb rgb)
return (qRed(rgb) * 5 + qGreen(rgb) * 6 + qBlue(rgb) * 5) / 16;
}
+static inline QRgb rgbBlend(QRgb d, QRgb s, uint rgbAlpha)
+{
+#if defined(__SSE2__)
+ __m128i vd = _mm_cvtsi32_si128(d);
+ __m128i vs = _mm_cvtsi32_si128(s);
+ __m128i va = _mm_cvtsi32_si128(rgbAlpha);
+ const __m128i vz = _mm_setzero_si128();
+ vd = _mm_unpacklo_epi8(vd, vz);
+ vs = _mm_unpacklo_epi8(vs, vz);
+ va = _mm_unpacklo_epi8(va, vz);
+ __m128i vb = _mm_xor_si128(_mm_set1_epi16(255), va);
+ vs = _mm_mullo_epi16(vs, va);
+ vd = _mm_mullo_epi16(vd, vb);
+ vd = _mm_add_epi16(vd, vs);
+ vd = _mm_add_epi16(vd, _mm_srli_epi16(vd, 8));
+ vd = _mm_add_epi16(vd, _mm_set1_epi16(0x80));
+ vd = _mm_srli_epi16(vd, 8);
+ vd = _mm_packus_epi16(vd, vd);
+ return _mm_cvtsi128_si32(vd);
+#else
+ const int dr = qRed(d);
+ const int dg = qGreen(d);
+ const int db = qBlue(d);
+
+ const int sr = qRed(s);
+ const int sg = qGreen(s);
+ const int sb = qBlue(s);
+
+ const int mr = qRed(rgbAlpha);
+ const int mg = qGreen(rgbAlpha);
+ const int mb = qBlue(rgbAlpha);
+
+ const int nr = qt_div_255(sr * mr + dr * (255 - mr));
+ const int ng = qt_div_255(sg * mg + dg * (255 - mg));
+ const int nb = qt_div_255(sb * mb + db * (255 - mb));
+
+ return 0xff000000 | (nr << 16) | (ng << 8) | nb;
+#endif
+}
+
static inline void alphargbblend_generic(uint coverage, QRgba64 *dest, int x, const QRgba64 &srcLinear, const QRgba64 &src, const QColorProfile *colorProfile)
{
if (coverage == 0xff000000) {
@@ -5711,20 +5751,20 @@ static inline void alphargbblend_generic(uint coverage, QRgba64 *dest, int x, co
}
}
-static inline void alphargbblend_argb32(quint32 *dst, uint coverage, QRgba64 srcLinear, quint32 src, const QColorProfile *colorProfile)
+static inline void alphargbblend_argb32(quint32 *dst, uint coverage, const QRgba64 &srcLinear, quint32 src, const QColorProfile *colorProfile)
{
if (coverage == 0xff000000) {
// nothing
} else if (coverage == 0xffffffff) {
*dst = src;
- } else {
- if (*dst >= 0xff000000) {
- rgbBlendPixel(dst, coverage, srcLinear, colorProfile);
- } else {
- // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
- const int a = qRgbAvg(coverage);
- *dst = INTERPOLATE_PIXEL_255(src, a, *dst, 255 - a);
- }
+ } else if (*dst < 0xff000000) {
+ // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
+ const int a = qRgbAvg(coverage);
+ *dst = INTERPOLATE_PIXEL_255(src, a, *dst, 255 - a);
+ } else if (!colorProfile) {
+ *dst = rgbBlend(*dst, src, coverage);
+ } else {
+ rgbBlendPixel(dst, coverage, srcLinear, colorProfile);
}
}
diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp
index 7dea743ea8..e45a16170e 100644
--- a/src/gui/vulkan/qvulkanwindow.cpp
+++ b/src/gui/vulkan/qvulkanwindow.cpp
@@ -2694,15 +2694,11 @@ QImage QVulkanWindow::grab()
system differences between OpenGL and Vulkan.
By pre-multiplying the projection matrix with this matrix, applications can
- continue to assume OpenGL-style Y coordinates in clip space (i.e. Y pointing
- upwards), and can set minDepth and maxDepth to 0 and 1, respectively,
- without any further corrections to the vertex Z positions, while using the
- projection matrices retrieved from the QMatrix4x4 functions, such as
- QMatrix4x4::perspective(), as-is.
-
- \note With vertex data following the default OpenGL rules (that is, the
- front face being CCW), the correct winding order in the rasterization state
- after applying this matrix is clockwise (\c{VK_FRONT_FACE_CLOCKWISE}).
+ continue to assume that Y is pointing upwards, and can set minDepth and
+ maxDepth in the viewport to 0 and 1, respectively, without having to do any
+ further corrections to the vertex Z positions. Geometry from OpenGL
+ applications can then be used as-is, assuming a rasterization state matching
+ the OpenGL culling and front face settings.
*/
QMatrix4x4 QVulkanWindow::clipCorrectionMatrix()
{