From 3d7207414b07104c1ea03ef341301a7390d7b0ad Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 9 Sep 2019 15:48:09 +0200 Subject: rhi: metal: Configure the layer's opaque property as appropriate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-78089 Change-Id: I6cd95e24d38562cf1931c107bb6b719e340583a8 Reviewed-by: Christian Strømme --- src/gui/rhi/qrhimetal.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/gui/rhi/qrhimetal.mm') diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index 770786db98..2d85c86bf0 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -3596,6 +3596,18 @@ bool QMetalSwapChain::buildOrResize() } #endif + if (m_flags.testFlag(SurfaceHasPreMulAlpha)) { + d->layer.opaque = NO; + } else if (m_flags.testFlag(SurfaceHasNonPreMulAlpha)) { + // The CoreAnimation compositor is said to expect premultiplied alpha, + // so this is then wrong when it comes to the blending operations but + // there's nothing we can do. Fortunately Qt Quick always outputs + // premultiplied alpha so it is not a problem there. + d->layer.opaque = NO; + } else { + d->layer.opaque = YES; + } + m_currentPixelSize = surfacePixelSize(); pixelSize = m_currentPixelSize; -- cgit v1.2.3