remove unnecessary macos cursor code

certainly on my Catalina macOS install it makes no difference
with or without this code. I could have sworn it was
necessary back when I added it, but since I'm going on
snippets of hacking scattered around the net (because Apple
's documentation is rather lacking), who knows.

Change-Id: I8a66a5179ab7ca8138e54a57564b8d453848c0e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109241
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2021-01-13 20:25:11 +02:00
committed by Noel Grandin
parent 8b4f13e152
commit 0918eade90

View File

@@ -135,9 +135,9 @@ NSImage* load_icon_by_name(const OUString& rIconName)
auto length = xMemStm->TellEnd();
NSData * byteData = [NSData dataWithBytes:data length:length];
NSBitmapImageRep * imageRep = [NSBitmapImageRep imageRepWithData:byteData];
NSSize imageSize = NSMakeSize(CGImageGetWidth([imageRep CGImage]), CGImageGetHeight([imageRep CGImage]));
// NSSize imageSize = NSMakeSize(imageRep.size;
NSImage * image = [[NSImage alloc] initWithSize:imageSize];
NSImage * image = [[NSImage alloc] initWithSize:imageRep.size];
[image addRepresentation:imageRep];
return image;
}
@@ -248,26 +248,7 @@ NSCursor* SalData::getCursor( PointerStyle i_eStyle )
}
NSImage* theImage = load_icon_by_name(aIconName);
assert ([theImage size].width == 256 || [theImage size].width == 128 || [theImage size].width == 32);
if ([theImage size].width == 256 || [theImage size].width == 128)
{
// If we have a 256x256 or 128x128 image, generate scaled versions of it.
// This will result in macOS picking a reasonably sized image for different screen dpi.
NSSize cursorSize = NSMakeSize(32,32);
NSImage *multiResImage = [[NSImage alloc] initWithSize:cursorSize];
for (int scale = 1; scale <= 4; scale++) {
NSAffineTransform *xform = [[NSAffineTransform alloc] init];
[xform scaleBy:scale];
id hints = @{ NSImageHintCTM: xform };
CGImageRef rasterCGImage = [theImage CGImageForProposedRect:nullptr context:nil hints:hints];
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithCGImage:rasterCGImage];
[rep setSize:cursorSize];
[multiResImage addRepresentation:rep];
}
pCurs = [[NSCursor alloc] initWithImage: multiResImage hotSpot: aHotSpot];
}
else
pCurs = [[NSCursor alloc] initWithImage: theImage hotSpot: aHotSpot];
pCurs = [[NSCursor alloc] initWithImage: theImage hotSpot: aHotSpot];
maCursors[ i_eStyle ] = pCurs;
return pCurs;