diff options
author | Olli Werwolff <qt-info@nokia.com> | 2011-07-12 13:02:54 +0200 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@nokia.com> | 2011-07-12 14:15:35 +0200 |
commit | 992ef929dff21e079f7d8a207c07dbfd0c3c8f78 (patch) | |
tree | 32c286aff3e501e704e02dc114228da5d032d5df /src/widgets | |
parent | 54ec6d177e0e8fb04cd01e70461484a80ca1f7a4 (diff) |
Use PlatformNativeInterface to obtain backingStore's dc
Change-Id: I6ec2fc0b8e7696fdfe4468920228df2d21c933fd
Reviewed-on: http://codereview.qt.nokia.com/1501
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dialogs/qwizard_win.cpp | 10 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsxpstyle.cpp | 19 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsxpstyle_p.h | 2 |
3 files changed, 20 insertions, 11 deletions
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index ab59e0109a..6c2a67639b 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -232,7 +232,9 @@ void QVistaBackButton::paintEvent(QPaintEvent *) else if (underMouse()) state = WIZ_NAV_BB_HOT; - pDrawThemeBackground(theme, p.paintEngine()->getDC(), WIZ_NAV_BACKBUTTON, state, &clipRect, &clipRect); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + HDC hdc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore())); + pDrawThemeBackground(theme, hdc, WIZ_NAV_BACKBUTTON, state, &clipRect, &clipRect); } /****************************************************************************** @@ -318,12 +320,14 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type) void QVistaHelper::drawTitleBar(QPainter *painter) { - HDC hdc = static_cast<QRasterPaintEngine *>(painter->paintEngine())->getDC(); + Q_ASSERT(backButton_); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + QBackingStore *backingStore = backButton_->backingStore(); + HDC hdc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore)); if (vistaState() == VistaAero) drawBlackRect(QRect(0, 0, wizard->width(), titleBarSize() + topOffset()), hdc); - Q_ASSERT(backButton_); const int btnTop = backButton_->mapToParent(QPoint()).y(); const int btnHeight = backButton_->size().height(); const int verticalCenter = (btnTop + btnHeight / 2) - 1; diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 36e0852462..ce5694c181 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -190,17 +190,17 @@ RECT XPThemeData::toRECT(const QRect &qr) Returns the native region of a part, if the part is considered transparent. The region is scaled to the parts size (rect). */ -HRGN XPThemeData::mask() +HRGN XPThemeData::mask(QWidget *widget) { if (!pIsThemeBackgroundPartiallyTransparent(handle(), partId, stateId)) return 0; HRGN hrgn; - HDC dc = painter == 0 ? 0 : painter->paintEngine()->getDC(); + QBackingStore *backingStore = widget->backingStore(); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + HDC dc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore)); RECT nativeRect = toRECT(rect); pGetThemeBackgroundRegion(handle(), dc, partId, stateId, &nativeRect, &hrgn); - if (dc) - painter->paintEngine()->releaseDC(dc); return hrgn; } @@ -505,7 +505,7 @@ QRegion QWindowsXPStylePrivate::region(XPThemeData &themeData) */ void QWindowsXPStylePrivate::setTransparency(QWidget *widget, XPThemeData &themeData) { - HRGN hrgn = themeData.mask(); + HRGN hrgn = themeData.mask(widget); if (hrgn && widget) SetWindowRgn(winId(widget), hrgn, true); } @@ -657,7 +657,10 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) translucentToplevel = win->testAttribute(Qt::WA_TranslucentBackground); } - bool useFallback = painter->paintEngine()->getDC() == 0 + QBackingStore *backingStore = themeData.widget->backingStore(); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + HDC dc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore )); + bool useFallback = dc == 0 || painter->opacity() != 1.0 || themeData.rotate || complexXForm @@ -681,7 +684,9 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) { QPainter *painter = themeData.painter; - HDC dc = painter->paintEngine()->getDC(); + QBackingStore *backingStore= themeData.widget->backingStore(); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + HDC dc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore)); QPoint redirectionDelta(int(painter->deviceMatrix().dx()), int(painter->deviceMatrix().dy())); diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h index 73803607a1..05ab2ec2e4 100644 --- a/src/widgets/styles/qwindowsxpstyle_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p.h @@ -216,7 +216,7 @@ public: noContent(false), rotate(0), rect(r) {} - HRGN mask(); + HRGN mask(QWidget *widget); HTHEME handle(); RECT toRECT(const QRect &qr); |