Inconsistency between compose `Image` and coil `AsyncImage` (ContentScale)
janbina opened this issue · comments
Describe the bug
AsyncImage
shows different result then standard Image
, while it should be presumably the same.
See the minimal example and resulting screenshot below. AsyncImage
doesn't respect ContentScale.None
and scales drawable to the full size. We can also omit contentScale
and use wrapContentSize()
modifier in standard Image
for the same result, which also works differently in AsyncImage
.
I was able to achieve desired result by creating ImageRequest
manually and specifying size(Size.ORIGINAL)
, but should this be needed?
To Reproduce
Row {
Image(
modifier = Modifier
.size(60.dp)
.background(Color.Gray, CircleShape),
painter = painterResource(id = R.drawable.ic_star_full),
contentScale = ContentScale.None,
contentDescription = null,
)
AsyncImage(
modifier = Modifier
.size(60.dp)
.background(Color.Gray, CircleShape),
model = R.drawable.ic_star_full,
contentScale = ContentScale.None,
contentDescription = null,
)
}
Version
Using coil 2.0.0-rc02
and compose 1.1.1
Yep, we should probably handle ContentScale.None
as expected. It won't be possible to handle all ContentScale
s (especially custom ones), but ContentScale.None
can be handled similar to ScaleType.CENTER
.