Skip to content

Commit

Permalink
fix some deprecation notices on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
wez committed Jan 15, 2021
1 parent 50b3978 commit 5501843
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/nsimage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ bool ResizeGivenImage(const char *filePath,

NSImage *source = [[NSImage alloc]
initWithContentsOfFile:[NSString stringWithUTF8String:filePath]];
[source setScalesWhenResized:YES];
if (source == nil) {
fprintf(stderr, "Image '%s' could not be loaded.\n", filePath);
exit(1);
Expand Down Expand Up @@ -192,7 +191,7 @@ bool ResizeGivenImage(const char *filePath,
NSEraseRect(destinationRect);
[source drawInRect:destinationRect
fromRect:destinationRect
operation:NSCompositeCopy
operation:NSCompositingOperationCopy
fraction:1.0];

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

if ((isPNG && !myPicPrefs.allJPEG) || myPicPrefs.allPNG) {
filetype = NSPNGFileType;
filetype = NSBitmapImageFileTypePNG;
props = nil;

} else {
filetype = NSJPEGFileType;
filetype = NSBitmapImageFileTypeJPEG;
props = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:0.7]
forKey:NSImageCompressionFactor];
}
Expand All @@ -215,7 +214,8 @@ bool ResizeGivenImage(const char *filePath,

int iter = 0;
float compression = 0.65;
if ((myPicPrefs.max_Kbytes != 0) && (filetype == NSJPEGFileType)) {
if ((myPicPrefs.max_Kbytes != 0) &&
(filetype == NSBitmapImageFileTypeJPEG)) {
while ((dataLength > (unsigned)myPicPrefs.max_Kbytes) && (iter < 10)) {
props = [NSDictionary
dictionaryWithObject:[NSNumber numberWithFloat:compression]
Expand Down

0 comments on commit 5501843

Please sign in to comment.