Cocoa: Add drawBackingStoreUsingCoreGraphics

drawRect is a general “repaint now” function, which
we should handle also for OpenGL content. Make that
clearer by moving the implementation details of drawing
the raster backing store using CoreGraphics to a
separate function.

Behavior change: Call invalidateWindowShadowIfNeeded
also for the OpenGL case.

Change-Id: I158ebef548e063f826db2dc708c14ab1d784b095
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
bb10
Morten Johan Sørvig 2016-08-16 14:52:14 +02:00 committed by Tor Arne Vestbø
parent 0deb0796a4
commit 3bd5876c89
2 changed files with 13 additions and 2 deletions

View File

@ -101,6 +101,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
- (void)setMaskRegion:(const QRegion *)region;
- (void)invalidateWindowShadowIfNeeded;
- (void)drawRect:(NSRect)dirtyRect;
- (void)drawBackingStoreUsingCoreGraphics:(NSRect)dirtyRect;
- (void)updateGeometry;
- (void)notifyWindowStateChanged:(Qt::WindowState)newState;
- (void)windowNotification : (NSNotification *) windowNotification;

View File

@ -569,6 +569,18 @@ static bool _q_dontOverrideCtrlLMB = false;
if (m_platformWindow->m_drawContentBorderGradient)
NSDrawWindowBackground(dirtyRect);
if (m_backingStore)
[self drawBackingStoreUsingCoreGraphics:dirtyRect];
[self invalidateWindowShadowIfNeeded];
}
// Draws the backing store content to the QNSView using Core Graphics.
// This function assumes that the QNSView is in a configuration that
// supports Core Graphics, such as "classic" mode or layer mode with
// the default layer.
- (void)drawBackingStoreUsingCoreGraphics:(NSRect)dirtyRect
{
if (!m_backingStore)
return;
@ -623,8 +635,6 @@ static bool _q_dontOverrideCtrlLMB = false;
CGImageRelease(cleanImg);
CGImageRelease(subMask);
CGImageRelease(bsCGImage);
[self invalidateWindowShadowIfNeeded];
}
- (BOOL) isFlipped