From 4c7077c3f0b190e5c9ddc4a3557f2b926f183e0a Mon Sep 17 00:00:00 2001 From: Adrian Robert Date: Wed, 21 Jan 2009 17:28:05 +0000 Subject: * nsimage.m (EmacsImage+allocInitFromFile:): Set to ignore DPI. (Bug#1316) --- src/nsimage.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/nsimage.m') diff --git a/src/nsimage.m b/src/nsimage.m index 05e6737c95c..f99a9d2a03e 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -163,6 +163,7 @@ static EmacsImage *ImageList = nil; + allocInitFromFile: (Lisp_Object)file { EmacsImage *image = ImageList; + NSImageRep *imgRep; Lisp_Object found; /* look for an existing image of the same name */ @@ -185,12 +186,18 @@ static EmacsImage *ImageList = nil; image = [[EmacsImage alloc] initByReferencingFile: [NSString stringWithUTF8String: SDATA (found)]]; - if ([image bestRepresentationForDevice: nil] == nil) + imgRep = [image bestRepresentationForDevice: nil]; + if (imgRep == nil) { [image release]; return nil; } + /* The next two lines cause the DPI of the image to be ignored. + This seems to be the behavior users expect. */ + [image setScalesWhenResized: YES]; + [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; + [image setName: [NSString stringWithUTF8String: SDATA (file)]]; [image reference]; ImageList = [image imageListSetNext: ImageList]; -- cgit v1.2.1