Skip to content

Commit

Permalink
Merge pull request onevcat#576 from onevcat/fix/swift-built-in-pi
Browse files Browse the repository at this point in the history
Use Float.pi instead of M_PI
  • Loading branch information
onevcat authored Feb 4, 2017
2 parents 625c6f0 + 9178148 commit 5eaf3de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/Image.swift
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,9 @@ extension Kingfisher where Base: Image {
// http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement
// let d = floor(s * 3*sqrt(2*pi)/4 + 0.5)
// if d is odd, use three box-blurs of size 'd', centered on the output pixel.
let s = max(radius, 2.0)
let s = Float(max(radius, 2.0))
// We will do blur on a resized image (*0.5), so the blur radius could be half as well.
var targetRadius = floor((Double(s * 3.0) * sqrt(2 * M_PI) / 4.0 + 0.5))
var targetRadius = floor(s * 3.0 * sqrt(2 * Float.pi) / 4.0 + 0.5)

if targetRadius.isEven {
targetRadius += 1
Expand Down Expand Up @@ -798,7 +798,7 @@ extension Kingfisher where Base: Image {
#endif
}

extension Double {
extension Float {
var isEven: Bool {
return truncatingRemainder(dividingBy: 2.0) == 0
}
Expand Down

0 comments on commit 5eaf3de

Please sign in to comment.