diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2012-11-21 13:57:00 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-23 17:04:00 +0100 |
commit | 4bddcf9c41f6954a66f07af12a824a2b8fb0d196 (patch) | |
tree | 0cb6e2021dfcd45df9899fc5e7eb67231e44d89e /src/plugins/platforms/cocoa/qnsview.h | |
parent | 1b8dcec81a0879843f5c3781c3b067ddb6542cbf (diff) |
Cocoa: QGLWidget draws wrong within QMainWindow on Mac OS
The resons for this bug is that Qt can share the same backingstore
between several windows (if they exist in the same hierarchy), but
this was just not supported by the Cocoa plugin.
This patch will make sure that we pay attention to which window
the QCocoaBackingStore is told to flush, and forward this information
to the QNSView that backs it up. Inside the views drawRect
function we then take some extra steps to get the correct sub-part
of the possibly shared backingstore image.
This patch also does some effort to ensure that we recreate the
backingstore image as little as possible, as we can often get
several resizes to the backingstore before we actually draw anything.
Moreover, by being a bit careful on how we tell UiKit to update
the view upon a flush, we can minimize the number of drawRect calls
(and then CGImageRef creations) we need to do. This patch actually
ends up improving resize/repaint performance a lot as well.
QT-BUG: 27390
Change-Id: I2c2a26b149fa855411b6bff8b9cc9a61694ae72f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 246d311f7b..1ee3697858 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -50,10 +50,12 @@ QT_BEGIN_NAMESPACE class QCocoaWindow; +class QCocoaBackingStore; QT_END_NAMESPACE @interface QNSView : NSView <NSTextInputClient> { - CGImageRef m_cgImage; + QCocoaBackingStore* m_backingStore; + QPoint m_backingStoreOffset; CGImageRef m_maskImage; uchar *m_maskData; QWindow *m_window; @@ -69,7 +71,7 @@ QT_END_NAMESPACE - (id)init; - (id)initWithQWindow:(QWindow *)window platformWindow:(QCocoaWindow *) platformWindow; -- (void)setImage:(QImage *)image; +- (void)flushBackingStore:(QCocoaBackingStore *)backingStore region:(const QRegion &)region offset:(QPoint)offset; - (void)setMaskRegion:(const QRegion *)region; - (void)drawRect:(NSRect)dirtyRect; - (void)updateGeometry; |