From b8201597366f464655ee9bdb3dac0d31a0afec8a Mon Sep 17 00:00:00 2001 From: tarsin Date: Sun, 14 May 2023 14:48:07 +0800 Subject: [PATCH] No need to compareAndSet set to the same value is a no-op --- .../main/java/com/hippo/ehviewer/ui/compose/EhAsyncThumb.kt | 2 +- .../com/hippo/ehviewer/ui/compose/data/GalleryPreview.kt | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/compose/EhAsyncThumb.kt b/app/src/main/java/com/hippo/ehviewer/ui/compose/EhAsyncThumb.kt index 73b350e2f..28f7ba7d7 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/compose/EhAsyncThumb.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/compose/EhAsyncThumb.kt @@ -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 } } } diff --git a/app/src/main/java/com/hippo/ehviewer/ui/compose/data/GalleryPreview.kt b/app/src/main/java/com/hippo/ehviewer/ui/compose/data/GalleryPreview.kt index 0f5970e6b..d4a24c94a 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/compose/data/GalleryPreview.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/compose/data/GalleryPreview.kt @@ -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 } } }