diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-03-09 19:23:39 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-03-12 11:49:18 +0100 |
commit | 67c3999e02d2961e32cf9e6adae20e86f45d84d9 (patch) | |
tree | 25d4becd89874eb6b5faaa299bd7ca51b7dab62d /src/plugins/platforms/cocoa/qcocoacursor.mm | |
parent | 059c3ae66adc1732f1d50ec5183a54b7bb97c347 (diff) |
macOS: Pass on QCursor pixmap with original scale
There's no need to scale the cursor down to 1x, since we're now passing
the correct device pixel ratio on to the NSImage by setting its size.
Letting macOS deal with the scaling produces a higher resolution cursor.
Change-Id: Icdb3d59998f9a32094c2973c3b222cf22b6398ac
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoacursor.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoacursor.mm | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm index 658a7670f0..c10ada1ada 100644 --- a/src/plugins/platforms/cocoa/qcocoacursor.mm +++ b/src/plugins/platforms/cocoa/qcocoacursor.mm @@ -335,17 +335,8 @@ NSCursor *QCocoaCursor::createCursorFromBitmap(const QBitmap *bitmap, const QBit NSCursor *QCocoaCursor::createCursorFromPixmap(const QPixmap pixmap, const QPoint hotspot) { NSPoint hotSpot = NSMakePoint(hotspot.x(), hotspot.y()); - NSImage *nsimage; - if (pixmap.devicePixelRatio() > 1.0) { - QSize layoutSize = pixmap.size() / pixmap.devicePixelRatio(); - QPixmap scaledPixmap = pixmap.scaled(layoutSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - scaledPixmap.setDevicePixelRatio(1.0); - nsimage = [NSImage imageFromQImage:scaledPixmap.toImage()]; - } else { - nsimage = [NSImage imageFromQImage:pixmap.toImage()]; - } - - return [[NSCursor alloc] initWithImage:nsimage hotSpot:hotSpot]; + auto *image = [NSImage imageFromQImage:pixmap.toImage()]; + return [[NSCursor alloc] initWithImage:image hotSpot:hotSpot]; } QT_END_NAMESPACE |