No need to compareAndSet

set to the same value is a no-op
This commit is contained in:
tarsin committed 2023-05-14 14:48:07 +08:00
1 parent 41991b8f22
commit b820159736
2 files changed
+3 -5

No files matched your search

@@ -46,7 +46,7 @@ fun EhAsyncCropThumb(
if (it is AsyncImagePainter.State.Success) {
it.result.drawable.run {
if (intrinsicWidth.toFloat() / intrinsicHeight in 0.5..0.8) {
if (contentScale == ContentScale.Fit) contentScale = ContentScale.Crop
contentScale = ContentScale.Crop
}
}
}
@@ -68,14 +68,12 @@ fun EhAsyncPreview(
model.run {
if (this is NormalGalleryPreview) {
if (clipWidth.toFloat() / clipHeight in 0.5..0.8) {
if (contentScale == ContentScale.Fit) contentScale = ContentScale.Crop
contentScale = ContentScale.Crop
}
} else {
it.result.drawable.run {
if (intrinsicWidth.toFloat() / intrinsicHeight in 0.5..0.8) {
if (contentScale == ContentScale.Fit) {
contentScale = ContentScale.Crop
}
contentScale = ContentScale.Crop
}
}
}