Skip to content

Commit

Permalink
RN: Adjust Image Blur on Android
Browse files Browse the repository at this point in the history
Summary:
Adjusts the behavior of `blurRadius` for `Image` on Android so that it behaves more closely to other platforms (web and iOS).

Changelog:
[Android][Changed] - Effect of `blurRadius` now more closely matches other platforms.

Reviewed By: shergin

Differential Revision: D22118680

fbshipit-source-id: c6d14aef29b4a086e43badfa78407bfa07f9fee2
  • Loading branch information
yungsters authored and facebook-github-bot committed Jun 18, 2020
1 parent a69bd9d commit 6486097
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,12 @@ public void onFailure(String id, Throwable throwable) {
}

public void setBlurRadius(float blurRadius) {
int pixelBlurRadius = (int) PixelUtil.toPixelFromDIP(blurRadius);
// Divide `blurRadius` by 2 to more closely match other platforms.
int pixelBlurRadius = (int) PixelUtil.toPixelFromDIP(blurRadius) / 2;
if (pixelBlurRadius == 0) {
mIterativeBoxBlurPostProcessor = null;
} else {
mIterativeBoxBlurPostProcessor = new IterativeBoxBlurPostProcessor(pixelBlurRadius);
mIterativeBoxBlurPostProcessor = new IterativeBoxBlurPostProcessor(2, pixelBlurRadius);
}
mIsDirty = true;
}
Expand Down

0 comments on commit 6486097

Please sign in to comment.