summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoacursor.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoacursor.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.mm20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm
index e0d623fc4c..c10ada1ada 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.mm
+++ b/src/plugins/platforms/cocoa/qcocoacursor.mm
@@ -335,24 +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 = static_cast<NSImage *>(qt_mac_create_nsimage(scaledPixmap));
- CGImageRef cgImage = qt_mac_toCGImage(pixmap.toImage());
- NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
- [nsimage addRepresentation:imageRep];
- [imageRep release];
- CGImageRelease(cgImage);
- } else {
- nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
- }
-
- NSCursor *nsCursor = [[NSCursor alloc] initWithImage:nsimage hotSpot: hotSpot];
- [nsimage release];
- return nsCursor;
+ auto *image = [NSImage imageFromQImage:pixmap.toImage()];
+ return [[NSCursor alloc] initWithImage:image hotSpot:hotSpot];
}
QT_END_NAMESPACE