Optimize image drawing

This commit is contained in:
Ali
2021-06-16 22:35:34 +04:00
parent d0830b3c00
commit 0f9648fb6c
17 changed files with 137 additions and 148 deletions

View File

@@ -46,7 +46,7 @@ public func qrCode(string: String, color: UIColor, backgroundColor: UIColor? = n
if let output = filter.outputImage {
let size = Int(output.extent.width)
let bytesPerRow = (4 * Int(size) + 15) & (~15)
let bytesPerRow = DeviceGraphicsContextSettings.shared.bytesPerRow(forWidth: Int(size))
let length = bytesPerRow * size
let bitmapInfo = CGBitmapInfo(rawValue: CGBitmapInfo.byteOrder32Little.rawValue | CGImageAlphaInfo.noneSkipFirst.rawValue)