macOS: Share view update code between layered and non-layered mode

Change-Id: I8eaf0607c1ede18ed20180fd43cc93744c99962d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Tor Arne Vestbø 2018-01-22 17:34:03 +01:00
parent 35f6f530bf
commit 28cf5ae000

View File

@ -334,7 +334,11 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
exposedRegion += QRectF::fromCGRect(dirtyRects[i]).toRect(); exposedRegion += QRectF::fromCGRect(dirtyRects[i]).toRect();
qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:]" << m_platformWindow->window() << exposedRegion; qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:]" << m_platformWindow->window() << exposedRegion;
[self updateRegion:exposedRegion];
}
- (void)updateRegion:(QRegion)dirtyRegion
{
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
if (m_glContext && m_shouldSetGLContextinDrawRect) { if (m_glContext && m_shouldSetGLContextinDrawRect) {
[m_glContext->nsOpenGLContext() setView:self]; [m_glContext->nsOpenGLContext() setView:self];
@ -350,7 +354,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
windowPrivate->deliverUpdateRequest(); windowPrivate->deliverUpdateRequest();
m_updateRequested = false; m_updateRequested = false;
} else { } else {
m_platformWindow->handleExposeEvent(exposedRegion); m_platformWindow->handleExposeEvent(dirtyRegion);
} }
if (windowPrivate->updateRequestPending) { if (windowPrivate->updateRequestPending) {
@ -376,7 +380,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
qCDebug(lcQpaCocoaWindow) << "[QNSView updateLayer]" << m_platformWindow->window(); qCDebug(lcQpaCocoaWindow) << "[QNSView updateLayer]" << m_platformWindow->window();
// FIXME: Find out if there's a way to resolve the dirty rect like in drawRect: // FIXME: Find out if there's a way to resolve the dirty rect like in drawRect:
m_platformWindow->handleExposeEvent(QRectF::fromCGRect(self.bounds).toRect()); [self updateRegion:QRectF::fromCGRect(self.bounds).toRect()];
} }
- (void)viewDidChangeBackingProperties - (void)viewDidChangeBackingProperties