Repository navigation
Fix GaussianBlur(radius: 0) blurring instead of being an identity transform - #893
Merged
Merged
Conversation
`blurred(radius:)` clamped the radius with `max(Double(radius), 2.0)`, so a radius of `0` - or any negative value - produced a kernel of 5 across three box passes, a clearly visible blur. The clamp also made every radius in `0...2` render identically while `identifier` and `Hashable` treated them as distinct processors, which populated the caches with duplicate entries holding the same bytes. The radius is now clamped to `0` at the low end, a radius of `0` returns the image unchanged, and the kernel is derived from the radius as given.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
blurred(radius:)clamped the radius withmax(Double(radius), 2.0), soGaussianBlur(radius: 0)produced a kernel of 5 across three box passes — a clearly visible blur — instead of returning the image unchanged. Negative radii behaved the same way.The clamp also made every radius in
0...2render identically whileidentifierandHashabletreated them as distinct processors, so they populated the caches with duplicate entries holding the same bytes.radiusis clamped to0at the low end, soGaussianBlur(radius: -8)andGaussianBlur(radius: 0)are the same processor.0returns the image unchanged.1,2, and3produce different output, matching their different identifiers.