|
|
@@ -506,7 +506,7 @@ extension Kingfisher where Base: Image {
|
|
|
return vImage_Buffer(data: data, height: height, width: width, rowBytes: rowBytes)
|
|
|
}
|
|
|
|
|
|
- guard let context = beginContext(size: size) else {
|
|
|
+ guard let context = beginContext(size: size, scale: scale) else {
|
|
|
assertionFailure("[Kingfisher] Failed to create CG context for blurring image.")
|
|
|
return base
|
|
|
}
|
|
|
@@ -516,7 +516,7 @@ extension Kingfisher where Base: Image {
|
|
|
|
|
|
var inBuffer = createEffectBuffer(context)
|
|
|
|
|
|
- guard let outContext = beginContext(size: size) else {
|
|
|
+ guard let outContext = beginContext(size: size, scale: scale) else {
|
|
|
assertionFailure("[Kingfisher] Failed to create CG context for blurring image.")
|
|
|
return base
|
|
|
}
|
|
|
@@ -615,7 +615,7 @@ extension Kingfisher where Base: Image {
|
|
|
|
|
|
// MARK: - Decode
|
|
|
extension Kingfisher where Base: Image {
|
|
|
- var decoded: Image? {
|
|
|
+ var decoded: Image {
|
|
|
return decoded(scale: scale)
|
|
|
}
|
|
|
|
|
|
@@ -632,14 +632,15 @@ extension Kingfisher where Base: Image {
|
|
|
return base
|
|
|
}
|
|
|
|
|
|
- guard let context = beginContext(size: CGSize(width: imageRef.width, height: imageRef.height)) else {
|
|
|
+ // Draw CGImage in a plain context with scale of 1.0.
|
|
|
+ guard let context = beginContext(size: CGSize(width: imageRef.width, height: imageRef.height), scale: 1.0) else {
|
|
|
assertionFailure("[Kingfisher] Decoding fails to create a valid context.")
|
|
|
return base
|
|
|
}
|
|
|
|
|
|
defer { endContext() }
|
|
|
|
|
|
- let rect = CGRect(x: 0, y: 0, width: imageRef.width, height: imageRef.height)
|
|
|
+ let rect = CGRect(x: 0, y: 0, width: CGFloat(imageRef.width), height: CGFloat(imageRef.height))
|
|
|
context.draw(imageRef, in: rect)
|
|
|
let decompressedImageRef = context.makeImage()
|
|
|
return Kingfisher<Image>.image(cgImage: decompressedImageRef!, scale: scale, refImage: base)
|
|
|
@@ -767,7 +768,7 @@ extension Comparable {
|
|
|
|
|
|
extension Kingfisher where Base: Image {
|
|
|
|
|
|
- func beginContext(size: CGSize) -> CGContext? {
|
|
|
+ func beginContext(size: CGSize, scale: CGFloat) -> CGContext? {
|
|
|
#if os(macOS)
|
|
|
guard let rep = NSBitmapImageRep(
|
|
|
bitmapDataPlanes: nil,
|