     }
 }
 
-extension CGBitmapInfo {
-    var fixed: CGBitmapInfo {
-        var fixed = self
-        let alpha = (rawValue & CGBitmapInfo.alphaInfoMask.rawValue)
-        if alpha == CGImageAlphaInfo.none.rawValue {
-            fixed.remove(.alphaInfoMask)
-            fixed = CGBitmapInfo(rawValue: fixed.rawValue | CGImageAlphaInfo.noneSkipFirst.rawValue)
-        } else if !(alpha == CGImageAlphaInfo.noneSkipFirst.rawValue) || !(alpha == CGImageAlphaInfo.noneSkipLast.rawValue) {
-            fixed.remove(.alphaInfoMask)
-            fixed = CGBitmapInfo(rawValue: fixed.rawValue | CGImageAlphaInfo.premultipliedFirst.rawValue)
-        }
-        return fixed
-    }
-}
-
 extension Kingfisher where Base: Image {
     
     func beginContext() -> CGContext? {

            return base
        }
        let colorSpace = CGColorSpaceCreateDeviceRGB()
        let bitmapInfo = imageRef.bitmapInfo.fixed
        
        guard let context = CGContext(data: nil, width: imageRef.width, height: imageRef.height, bitsPerComponent: 8, bytesPerRow: 0, space: colorSpace, bitmapInfo: bitmapInfo.rawValue) else {
            assertionFailure("[Kingfisher] Decoding fails to create a valid context.")
            return base
        }
        
        let rect = CGRect(x: 0, y: 0, width: imageRef.width, height: imageRef.height)
        context.draw(imageRef, in: rect)

    #endif
}

extension Double {
    var isEven: Bool {
        return truncatingRemainder(dividingBy: 2.0) == 0
