Skip to content

Commit

Permalink
Merge pull request BradLarson#147 from wallerdev/master
Browse files Browse the repository at this point in the history
Fix for crashing in GaussianBlur filter with Swift 3.1
  • Loading branch information
BradLarson authored Apr 12, 2017
2 parents 8c3bdee + b322f86 commit 4494a80
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions framework/Source/Operations/GaussianBlur.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ func optimizedGaussianOffsetsForRadius(_ blurRadius:UInt, sigma:Double) -> [Doub
let numberOfOptimizedOffsets = min(blurRadius / 2 + (blurRadius % 2), 7)

var optimizedOffsets = [Double]()
for currentOptimizedOffset in 0..<numberOfOptimizedOffsets {
let firstWeight = Double(standardWeights[Int(currentOptimizedOffset * 2 + 1)])
let secondWeight = Double(standardWeights[Int(currentOptimizedOffset * 2 + 2)])
for currentOptimizedOffset in 0..<Int(numberOfOptimizedOffsets) {
let firstWeight = Double(standardWeights[currentOptimizedOffset * 2 + 1])
let secondWeight = Double(standardWeights[currentOptimizedOffset * 2 + 2])
let optimizedWeight = firstWeight + secondWeight

optimizedOffsets.append((firstWeight * (Double(currentOptimizedOffset) * 2.0 + 1.0) + secondWeight * (Double(currentOptimizedOffset) * 2.0 + 2.0)) / optimizedWeight)
Expand Down

0 comments on commit 4494a80

Please sign in to comment.