From bedf50a5bb9656a64ec609536366f90929a63c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 6 Aug 2018 17:05:30 +0200 Subject: macOS: Don't blend the backingstore unless the window has a background MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoabackingstore.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index 091453785e..1343fbc45a 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -162,13 +162,13 @@ void QCocoaBackingStore::flush(QWindow *window, const QRegion ®ion, const QPo const qreal devicePixelRatio = m_image.devicePixelRatio(); - // If the flushed window is a content view, and not in unified toolbar mode, - // and is fully opaque, we can get away with copying the backingstore instead - // of blending. + // If the flushed window is a content view, and we're filling the drawn area + // completely, or it doesn't have a window background we need to preserve, + // we can get away with copying instead of blending the backing store. QCocoaWindow *cocoaWindow = static_cast(window->handle()); const NSCompositingOperation compositingOperation = cocoaWindow->isContentView() - && cocoaWindow->isOpaque() && !windowHasUnifiedToolbar() ? - NSCompositingOperationCopy : NSCompositingOperationSourceOver; + && (cocoaWindow->isOpaque() || view.window.backgroundColor == NSColor.clearColor) + ? NSCompositingOperationCopy : NSCompositingOperationSourceOver; #ifdef QT_DEBUG static bool debugBackingStoreFlush = [[NSUserDefaults standardUserDefaults] -- cgit v1.2.3