From 66e5f8e9dcd11d136b707d13c7597019c99c54b8 Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Tue, 25 Feb 2014 23:37:06 +1100 Subject: eglfs: Improve cursors and hotspots Improvements * Cursor atlas has been recreated using 32x32 cursors which avoids artifacts introduced from downscaling of the busy cursor * A white outline has been added to the cursors to improve visibility on black backgrounds * Hot spot positions have been tweaked; in particular, Qt::PointingHandCursor now has a correct hot spot at the tip of the index finger instead of the center The assert which checks that the number of hot spots equals the number of cursors had an off-by-one error as the first cursor is Qt::ArrowCursor which has an enum value of 0. To determine the number of cursors, 1 needs to be added to Qt::LastCursor. Change-Id: I266b6d4cc47d42219854aa5b7e2d8344eb3a920a Reviewed-by: Laszlo Agocs --- src/platformsupport/eglconvenience/qeglplatformcursor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp index 1c87e1d27d..70e7c4e4db 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp @@ -210,7 +210,7 @@ void QEGLPlatformCursor::initCursorAtlas() m_cursorAtlas.cursorsPerRow = cursorsPerRow; const QJsonArray hotSpots = object.value(QLatin1String("hotSpots")).toArray(); - Q_ASSERT(hotSpots.count() == Qt::LastCursor); + Q_ASSERT(hotSpots.count() == Qt::LastCursor + 1); for (int i = 0; i < hotSpots.count(); i++) { QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble()); m_cursorAtlas.hotSpots << hotSpot; @@ -218,7 +218,7 @@ void QEGLPlatformCursor::initCursorAtlas() QImage image = QImage(atlas).convertToFormat(QImage::Format_ARGB32_Premultiplied); m_cursorAtlas.cursorWidth = image.width() / m_cursorAtlas.cursorsPerRow; - m_cursorAtlas.cursorHeight = image.height() / ((Qt::LastCursor + cursorsPerRow - 1) / cursorsPerRow); + m_cursorAtlas.cursorHeight = image.height() / ((Qt::LastCursor + cursorsPerRow) / cursorsPerRow); m_cursorAtlas.width = image.width(); m_cursorAtlas.height = image.height(); m_cursorAtlas.image = image; -- cgit v1.2.3