diff options
author | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2014-10-28 11:41:34 +0100 |
---|---|---|
committer | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2014-10-28 13:32:02 +0100 |
commit | 916dfcb8275bcce6b39606cd0b930239a60dc5df (patch) | |
tree | 1e079bf0eff8a42072f9727ec91cc4b4e83f7992 /src/plugins/platforms/cocoa/qcocoabackingstore.mm | |
parent | 148aa0e3e35f9bdf3e68fdf2c9cc509d2e093275 (diff) |
OS X - Cocoa backing store and drawRect
m_backingStore pointer has a limited 'lifetime' - usually
it is set in -flushBackingStore:region:offset: method, then -drawRect:
is invoked/forced by -setNeedsDisplayInRect:, after that it's dangerous to
have a non-null pointer to a backing store (and we reset it).
But if Cocoa invokes drawRect (due to some reason) our null backing store pointer is also
not good. This patch instead is using a shared resource (QImage) from a backing store.
This patch also makes getBackingStoreCGImage() redundant - -drawRect: was the only
place we called it.
Task-number: QTBUG-42206
Change-Id: Ie7726336f05d07c52f660f6326ae5cef114201dd
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoabackingstore.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoabackingstore.mm | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index e13e295511..ba1198c19c 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -96,12 +96,10 @@ void QCocoaBackingStore::flush(QWindow *win, const QRegion ®ion, const QPoint } } -#ifndef QT_NO_OPENGL QImage QCocoaBackingStore::toImage() const { return m_qImage; } -#endif void QCocoaBackingStore::resize(const QSize &size, const QRegion &) { @@ -121,17 +119,6 @@ bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy) return true; } -CGImageRef QCocoaBackingStore::getBackingStoreCGImage() -{ - if (!m_cgImage) - m_cgImage = qt_mac_toCGImage(m_qImage); - - // Warning: do not retain/release/cache the returned image from - // outside the backingstore since it shares data with a QImage and - // needs special memory considerations. - return m_cgImage; -} - qreal QCocoaBackingStore::getBackingStoreDevicePixelRatio() { return m_qImage.devicePixelRatio(); |