Skip to content

Commit

Permalink
Fixes crash in Swift 3.1 when looping over UInts.
Browse files Browse the repository at this point in the history
This applies to anything that uses the GaussianBlur filter.
  • Loading branch information
wallerdev committed Apr 12, 2017
1 parent 8c3bdee commit b322f86
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 b322f86

Please sign in to comment.