Skip to content

Commit 5501843

Browse files
committed
fix some deprecation notices on macos
1 parent 50b3978 commit 5501843

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/nsimage.mm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ bool ResizeGivenImage(const char *filePath,
8282

8383
NSImage *source = [[NSImage alloc]
8484
initWithContentsOfFile:[NSString stringWithUTF8String:filePath]];
85-
[source setScalesWhenResized:YES];
8685
if (source == nil) {
8786
fprintf(stderr, "Image '%s' could not be loaded.\n", filePath);
8887
exit(1);
@@ -192,7 +191,7 @@ bool ResizeGivenImage(const char *filePath,
192191
NSEraseRect(destinationRect);
193192
[source drawInRect:destinationRect
194193
fromRect:destinationRect
195-
operation:NSCompositeCopy
194+
operation:NSCompositingOperationCopy
196195
fraction:1.0];
197196

198197
NSBitmapImageRep *bitmap =
@@ -201,11 +200,11 @@ bool ResizeGivenImage(const char *filePath,
201200
NSDictionary *props;
202201

203202
if ((isPNG && !myPicPrefs.allJPEG) || myPicPrefs.allPNG) {
204-
filetype = NSPNGFileType;
203+
filetype = NSBitmapImageFileTypePNG;
205204
props = nil;
206205

207206
} else {
208-
filetype = NSJPEGFileType;
207+
filetype = NSBitmapImageFileTypeJPEG;
209208
props = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:0.7]
210209
forKey:NSImageCompressionFactor];
211210
}
@@ -215,7 +214,8 @@ bool ResizeGivenImage(const char *filePath,
215214

216215
int iter = 0;
217216
float compression = 0.65;
218-
if ((myPicPrefs.max_Kbytes != 0) && (filetype == NSJPEGFileType)) {
217+
if ((myPicPrefs.max_Kbytes != 0) &&
218+
(filetype == NSBitmapImageFileTypeJPEG)) {
219219
while ((dataLength > (unsigned)myPicPrefs.max_Kbytes) && (iter < 10)) {
220220
props = [NSDictionary
221221
dictionaryWithObject:[NSNumber numberWithFloat:compression]

0 commit comments

Comments
 (0)