Skip to content

Commit

Permalink
Enable paintFilterBitmap when rendering images with rounded corners
Browse files Browse the repository at this point in the history
Summary:
Per Android docs (https://developer.android.com/reference/android/graphics/Paint#FILTER_BITMAP_FLAG):

> This should generally be on when drawing bitmaps, unless performance-bound (rendering to software canvas) or preferring pixelation artifacts to blurriness when scaling significantly.

Changelog:
[Android][Fixed] - Improve rendering of images when resampled and corner radius applied

Reviewed By: genkikondo

Differential Revision: D34551184

fbshipit-source-id: 649da53af816be829e5b7f8e2a100f07a8b412b7
  • Loading branch information
javache authored and facebook-github-bot committed Mar 2, 2022
1 parent cfb11ca commit f743bed
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ public CloseableReference<Bitmap> process(Bitmap source, PlatformBitmapFactory b

// We can't specify rounding in XML, so have to do so here
private static GenericDraweeHierarchy buildHierarchy(Context context) {
RoundingParams roundingParams = RoundingParams.fromCornersRadius(0);
roundingParams.setPaintFilterBitmap(true);
return new GenericDraweeHierarchyBuilder(context.getResources())
.setRoundingParams(RoundingParams.fromCornersRadius(0))
.setRoundingParams(roundingParams)
.build();
}

Expand Down

0 comments on commit f743bed

Please sign in to comment.