[Libreoffice-commits] core.git: vcl/osx

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 14 06:47:30 UTC 2021


 vcl/osx/saldata.cxx |   25 +++----------------------
 1 file changed, 3 insertions(+), 22 deletions(-)

New commits:
commit 0918eade90e19dd8e9a246446dcb9463c6c7f7cc
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Wed Jan 13 20:25:11 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jan 14 07:46:51 2021 +0100

    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 at collabora.co.uk>

diff --git a/vcl/osx/saldata.cxx b/vcl/osx/saldata.cxx
index 7a9f7b42dcfe..9c3f04dbbc7b 100644
--- a/vcl/osx/saldata.cxx
+++ b/vcl/osx/saldata.cxx
@@ -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;


More information about the Libreoffice-commits mailing list