Make DrawingContext initializer failable

This commit is contained in:
Ali
2022-11-15 13:40:31 +04:00
parent 59e2c74d42
commit f07c30bd5b
39 changed files with 624 additions and 415 deletions

View File

@@ -88,7 +88,7 @@ final class ImageBasedPasscodeBackground: PasscodeBackground {
self.size = size
let contextSize = size.aspectFilled(CGSize(width: 320.0, height: 320.0))
let foregroundContext = DrawingContext(size: contextSize, scale: 1.0)
let foregroundContext = DrawingContext(size: contextSize, scale: 1.0)!
let bounds = CGRect(origin: CGPoint(), size: contextSize)
let filledImageSize = image.size.aspectFilled(contextSize)
@@ -109,7 +109,7 @@ final class ImageBasedPasscodeBackground: PasscodeBackground {
}
self.foregroundImage = foregroundContext.generateImage()!
let backgroundContext = DrawingContext(size: contextSize, scale: 1.0)
let backgroundContext = DrawingContext(size: contextSize, scale: 1.0)!
backgroundContext.withFlippedContext { c in
c.interpolationQuality = .medium
c.draw(image.cgImage!, in: filledImageRect)