coil-kt / coil

Image loading for Android and Compose Multiplatform.

Home Page:https://coil-kt.github.io/coil/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`RoundedCornersTransformation` is incompatible with certain `layout_height` and `layout_width` combinations.

MarinTolic opened this issue · comments

Issue Description

Hey Coil folks,

Recently we've noticed that an image not load if you apply RoundedCornersTransformation and target an ImageView containing the following attributes:

        android:layout_width="match_parent"
        android:layout_height="wrap_content"

Removing the transformation will make the image load.
Alternatively, it will also load if you keep the transformation but change the target ImageView attributes to the following ones:

        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

Any fixed size width and height work as well.

Issue Reproduction

For easier reproduction on your end, we've built a small repo that reproduces the error.
You can find it here.

All that you need to do is:

  1. Run the app
  2. Toggle the application of RoundedCornersTransformation by checking or unchecking the CheckBox

Issue Cause/ Origin

Furthermore, we've tracked the issue down to the following two lines inside the class that can be found here: 34e8f32#diff-69adc991fe716ce499831a830e2898c3133cbc76273221b05d1fd8c032ab042d

If you revert dstWidth and dstHeight to their previous values, the issue is resolved.

Coil Version

Version: 2.1.0

Thanks for reporting this! Feel free to send a PR that reverts those two lines, though I suspect there might be some failing tests. I’ll investigate more in a few weeks as well.