rhi: metal: Configure the layer's opaque property as appropriate

Task-number: QTBUG-78089
Change-Id: I6cd95e24d38562cf1931c107bb6b719e340583a8
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
This commit is contained in:
Laszlo Agocs 2019-09-09 15:48:09 +02:00
parent ef78a2e8f9
commit 3d7207414b

View File

@ -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;