macOS: Send expose event with individual rects instead of bounding rect

Change-Id: I914521e1dfecb0157a8b9e1c9d9a86ca45e0826e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Tor Arne Vestbø 2017-07-11 18:19:08 +02:00
parent 73176d2922
commit 1828caad33

View File

@ -428,11 +428,19 @@ static QTouchDevice *touchDevice = 0;
- (void)drawRect:(NSRect)dirtyRect
{
Q_UNUSED(dirtyRect);
if (!m_platformWindow)
return;
qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:]" << m_platformWindow->window()
<< QRectF::fromCGRect(NSRectToCGRect(dirtyRect));
QRegion exposedRegion;
const NSRect *dirtyRects;
NSInteger numDirtyRects;
[self getRectsBeingDrawn:&dirtyRects count:&numDirtyRects];
for (int i = 0; i < numDirtyRects; ++i)
exposedRegion += QRectF::fromCGRect(dirtyRects[i]).toRect();
qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:]" << m_platformWindow->window() << exposedRegion;
#ifndef QT_NO_OPENGL
if (m_glContext && m_shouldSetGLContextinDrawRect) {
@ -441,7 +449,7 @@ static QTouchDevice *touchDevice = 0;
}
#endif
m_platformWindow->handleExposeEvent(QRectF::fromCGRect(dirtyRect).toRect());
m_platformWindow->handleExposeEvent(exposedRegion);
}
// Draws the backing store content to the QNSView using Core Graphics.