Skip to content

Commit

Permalink
macOS: Don't blend the backingstore unless the window has a background
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Morten Johan Sørvig <[email protected]>
  • Loading branch information
torarnv committed Aug 7, 2018
1 parent 3068b18 commit bedf50a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/plugins/platforms/cocoa/qcocoabackingstore.mm
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@

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<QCocoaWindow *>(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]
Expand Down

0 comments on commit bedf50a

Please sign in to comment.