Hello, I've found a problem with scaling up images with Fresco with rounding params in Android 9.0.
When image is small and it need to be scaled up to fill View (with CENTER_CROP ScaleType for example) it displays with artifacts. Looks like pixels are not interpolated to fill the view, but scaled separately and image looks pixelated
At the screenshot: top picture looks as expected, and the bottom one (with rounding) pixelated

run code on Android 9 device (reprodused on Samsung Galaxy S 9 and Pixel 2)
public class MainActivity extends AppCompatActivity {
private static final String SMALL_IMAGE_URL = "https://www.dropbox.com/s/5mxb5a2mae773c9/small.jpg?dl=1";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fresco.initialize(this);
LinearLayout root = new LinearLayout(this);
root.setOrientation(LinearLayout.VERTICAL);
root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
//first view without rounding
SimpleDraweeView firstImage = new SimpleDraweeView(this);
firstImage.setImageURI(SMALL_IMAGE_URL);
firstImage.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);
root.addView(firstImage, paramsForImage());
//same view, but with rounding
SimpleDraweeView secondImage = new SimpleDraweeView(this);
secondImage.setImageURI(SMALL_IMAGE_URL);
secondImage.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);
secondImage.getHierarchy().setRoundingParams(RoundingParams.fromCornersRadius(24));
root.addView(secondImage, paramsForImage());
setContentView(root);
}
private LinearLayout.LayoutParams paramsForImage() {
LinearLayout.LayoutParams result = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
result.weight = 1;
return result;
}
}
May be BitmapShader, which is used for rounding, works unexpected at Android 9.0
Rounding with overlay color works fine
cc: @oprisnik
That's odd... Definitely looks like a bug. Thanks for reporting!
This is likely caused by the bitmap shader used to draw rounded bitmaps, which likely doesn't properly upscale:
Do you need this for fully circular images or just for rounded corners @dmitrychistyakov ? As a workaround, if it's fully circular, you can use a BitmapTransformation that uses the native rounding filter instead, which is much more performant.
@oprisnik I use both rounding corners and circle rounding. Thank you for BitmapTransformation hint, I'll try it
This should be fixed with 6d3a538525d2eab10bd59400ee1fcaf9569bdf79. Thanks @otopba!
Most helpful comment
This should be fixed with 6d3a538525d2eab10bd59400ee1fcaf9569bdf79. Thanks @otopba!