diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-10-04 00:42:24 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-10-04 00:44:18 +0200 |
commit | d8fc0da235b2bd566b2b6f1e21218afdf2f34eb3 (patch) | |
tree | c0ca819521ed6901a83ab476fa822a886691d806 /src/plugins/platforms/windows/qwindowscursor.cpp | |
parent | 3649a6e61d823289d18be19387d7e3923dd90bd0 (diff) | |
parent | cdf0c5905b3477c6cd01c519f883b7bb55447120 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/plugins/platforms/minimal/qminimalintegration.cpp
src/plugins/platforms/offscreen/qoffscreenintegration.cpp
Change-Id: Ica85deeab5c5038ac004718e25194b1157343480
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscursor.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscursor.cpp | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index 5b2a3acbae..5e7944a4cf 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -45,7 +45,7 @@ #include "qwindowswindow.h" #include "qwindowsscreen.h" -#include <QtGui/QPixmap> +#include <QtGui/QBitmap> #include <QtGui/QImage> #include <QtGui/QBitmap> #include <QtGui/QGuiApplication> @@ -61,6 +61,30 @@ Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = Q_GUI_EXPORT HBITMAP qt_createIconMask(const QBitmap &bitmap); /*! + \class QWindowsCursorCacheKey + \brief Cache key for storing values in a QHash with a QCursor as key. + + \internal + \ingroup qt-lighthouse-win +*/ + +QWindowsCursorCacheKey::QWindowsCursorCacheKey(const QCursor &c) + : shape(c.shape()), bitmapCacheKey(0), maskCacheKey(0) +{ + if (shape == Qt::BitmapCursor) { + const qint64 pixmapCacheKey = c.pixmap().cacheKey(); + if (pixmapCacheKey) { + bitmapCacheKey = pixmapCacheKey; + } else { + Q_ASSERT(c.bitmap()); + Q_ASSERT(c.mask()); + bitmapCacheKey = c.bitmap()->cacheKey(); + maskCacheKey = c.mask()->cacheKey(); + } + } +} + +/*! \class QWindowsCursor \brief Platform cursor implementation @@ -388,9 +412,10 @@ HCURSOR QWindowsCursor::createSystemCursor(const QCursor &c) QWindowsWindowCursor QWindowsCursor::standardWindowCursor(Qt::CursorShape shape) { - StandardCursorCache::iterator it = m_standardCursorCache.find(shape); - if (it == m_standardCursorCache.end()) - it = m_standardCursorCache.insert(shape, QWindowsWindowCursor(QCursor(shape))); + const QWindowsCursorCacheKey key(shape); + CursorCache::iterator it = m_cursorCache.find(key); + if (it == m_cursorCache.end()) + it = m_cursorCache.insert(key, QWindowsWindowCursor(QCursor(shape))); return it.value(); } @@ -400,10 +425,10 @@ QWindowsWindowCursor QWindowsCursor::standardWindowCursor(Qt::CursorShape shape) QWindowsWindowCursor QWindowsCursor::pixmapWindowCursor(const QCursor &c) { - const qint64 cacheKey = c.pixmap().cacheKey(); - PixmapCursorCache::iterator it = m_pixmapCursorCache.find(cacheKey); - if (it == m_pixmapCursorCache.end()) - it = m_pixmapCursorCache.insert(cacheKey, QWindowsWindowCursor(c)); + const QWindowsCursorCacheKey cacheKey(c); + CursorCache::iterator it = m_cursorCache.find(cacheKey); + if (it == m_cursorCache.end()) + it = m_cursorCache.insert(cacheKey, QWindowsWindowCursor(c)); return it.value(); } |