diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2013-03-21 13:42:05 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-22 07:16:25 +0100 |
commit | a8283fe4d9278cee1792587c7c842d3c7b04cf3d (patch) | |
tree | 09ece99f46b5be266c1f2964fd7d12c2e715c71e /src/plugins/platforms/cocoa/qcocoawindow.mm | |
parent | a87e8f7a1070b357185dbbe69bf0b98a8da247b8 (diff) |
Implement [QNSView isOpaque]
Re-use the QCocoaWindow implementation.
This gives a small performance boost since NSWindow
can skip drawing the background if it knows that the
content view will fill with opaque pixels.
Change-Id: I4a9a14135d890e9132dd1cb0af5a1c1a769d7e2f
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index a346dc9d4d..f9514f54d5 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -505,6 +505,14 @@ bool QCocoaWindow::isExposed() const return m_isExposed; } +bool QCocoaWindow::isOpaque() const +{ + bool translucent = (window()->format().alphaBufferSize() > 0 + || window()->opacity() < 1 + || (m_contentView && [m_contentView hasMask])); + return !translucent; +} + void QCocoaWindow::propagateSizeHints() { QCocoaAutoReleasePool pool; @@ -543,20 +551,11 @@ void QCocoaWindow::propagateSizeHints() } } -void QCocoaWindow::updateOpaque() -{ - bool translucent = window()->format().alphaBufferSize() > 0 - || window()->opacity() < 1 - || (m_contentView && [m_contentView hasMask]); - [m_nsWindow setOpaque:!translucent]; -} - - void QCocoaWindow::setOpacity(qreal level) { if (m_nsWindow) { [m_nsWindow setAlphaValue:level]; - updateOpaque(); + [m_nsWindow setOpaque: isOpaque()]; } } @@ -566,7 +565,7 @@ void QCocoaWindow::setMask(const QRegion ®ion) [m_nsWindow setBackgroundColor:[NSColor clearColor]]; [m_qtView setMaskRegion:®ion]; - updateOpaque(); + [m_nsWindow setOpaque: isOpaque()]; } bool QCocoaWindow::setKeyboardGrabEnabled(bool grab) |