macOS: Don't blend the backingstore unless the window has a background

If there's no background, we should copy the backingstore, so that the
backingstore is not blended with the result of the previous flush.

The unified toolbar case is covered by the window having a textured
background.

Task-number: QTBUG-69773
Change-Id: I2f4eed9f44a60ebe7495ce68cf5a54d3d2424b0c
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Tor Arne Vestbø 2018-08-06 17:05:30 +02:00
parent 3068b185c5
commit bedf50a5bb

View File

@ -162,13 +162,13 @@ void QCocoaBackingStore::flush(QWindow *window, const QRegion &region, const QPo
const qreal devicePixelRatio = m_image.devicePixelRatio(); const qreal devicePixelRatio = m_image.devicePixelRatio();
// If the flushed window is a content view, and not in unified toolbar mode, // If the flushed window is a content view, and we're filling the drawn area
// and is fully opaque, we can get away with copying the backingstore instead // completely, or it doesn't have a window background we need to preserve,
// of blending. // we can get away with copying instead of blending the backing store.
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle()); QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
const NSCompositingOperation compositingOperation = cocoaWindow->isContentView() const NSCompositingOperation compositingOperation = cocoaWindow->isContentView()
&& cocoaWindow->isOpaque() && !windowHasUnifiedToolbar() ? && (cocoaWindow->isOpaque() || view.window.backgroundColor == NSColor.clearColor)
NSCompositingOperationCopy : NSCompositingOperationSourceOver; ? NSCompositingOperationCopy : NSCompositingOperationSourceOver;
#ifdef QT_DEBUG #ifdef QT_DEBUG
static bool debugBackingStoreFlush = [[NSUserDefaults standardUserDefaults] static bool debugBackingStoreFlush = [[NSUserDefaults standardUserDefaults]