summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-10-22 12:53:17 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-10-22 12:59:09 (GMT)
commitb63fc1726fe3df49c6577d8ac26095d0c8738925 (patch)
tree8af9833387102f2bc9962f7129ef7c6d38aa4c6b /src
parent62cf25df02d2cce8957c5942b467dbbf050a763d (diff)
downloadQt-b63fc1726fe3df49c6577d8ac26095d0c8738925.zip
Qt-b63fc1726fe3df49c6577d8ac26095d0c8738925.tar.gz
Qt-b63fc1726fe3df49c6577d8ac26095d0c8738925.tar.bz2
Honor graphics system on Mac/Cocoa when exposing and resizing window
When exposing or resizing a previously hidden window on Cocoa, we would go through the CoreGraphicsPaintEngine even when a different graphics system was set. This was because there were two different paths from the windowing system into our paint event. The one going through the virtual drawRect function in QCocoaView did not honor the graphics system. This patch makes sure the backing store is used for these types of events as well. Done with: Gunnar Reviewed-by: MortenS
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm8
-rw-r--r--src/gui/painting/qbackingstore_p.h13
2 files changed, 15 insertions, 6 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 4c2a14a..417d54c 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -51,6 +51,7 @@
#include <private/qmacinputcontext_p.h>
#include <private/qmultitouch_mac_p.h>
#include <private/qevent_p.h>
+#include <private/qbackingstore_p.h>
#include <qscrollarea.h>
#include <qhash.h>
@@ -503,6 +504,13 @@ extern "C" {
- (void)drawRect:(NSRect)aRect
{
+ qDebug("drawRect");
+ if (QApplicationPrivate::graphicsSystem() != 0) {
+ if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore())
+ bs->markDirty(qwidget->rect(), qwidget);
+ qwidgetprivate->syncBackingStore(qwidget->rect());
+ return;
+ }
CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
qwidgetprivate->hd = cg;
CGContextSaveGState(cg);
diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h
index 94d756e..63518fb 100644
--- a/src/gui/painting/qbackingstore_p.h
+++ b/src/gui/painting/qbackingstore_p.h
@@ -1,4 +1,4 @@
-/****************************************************************************
+ /****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
@@ -97,6 +97,12 @@ public:
);
}
+ // ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore).
+ void markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately = false,
+ bool invalidateBuffer = false);
+ void markDirty(const QRect &rect, QWidget *widget, bool updateImmediately = false,
+ bool invalidateBuffer = false);
+
private:
QWidget *tlw;
QRegion dirtyOnScreen; // needsFlush
@@ -126,11 +132,6 @@ private:
QRegion dirtyRegion(QWidget *widget = 0) const;
QRegion staticContents(QWidget *widget = 0, const QRect &withinClipRect = QRect()) const;
- // ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore).
- void markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately = false,
- bool invalidateBuffer = false);
- void markDirty(const QRect &rect, QWidget *widget, bool updateImmediately = false,
- bool invalidateBuffer = false);
void markDirtyOnScreen(const QRegion &dirtyOnScreen, QWidget *widget, const QPoint &topLevelOffset);
void removeDirtyWidget(QWidget *w);