Skip to content

Commit

Permalink
♻️ Do not resize the wallpaper image when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkulman committed Nov 1, 2022
1 parent 05f35f6 commit 27fb4ef
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ extension NSImage {
}

func crop(size: NSSize) -> NSImage? {
// only resize when the size actually differs
guard size != self.size else {
return self
}

// Resize the current image, while preserving the aspect ratio.
guard let resized = self.resizeWhileMaintainingAspectRatioToSize(size: size) else {
return nil
Expand Down

0 comments on commit 27fb4ef

Please sign in to comment.