From 54768bcc2efc1a3279bd15d1a04a35812c56bc30 Mon Sep 17 00:00:00 2001 From: Colin White Date: Thu, 24 Oct 2024 18:51:51 -0700 Subject: [PATCH] Convert EqualityDelegate to a composition local. --- .../api/android/coil-compose-core.api | 38 +++++++----- .../api/coil-compose-core.klib.api | 35 ++++++----- .../api/jvm/coil-compose-core.api | 38 +++++++----- .../kotlin/coil3/compose/AsyncImage.kt | 11 +--- .../kotlin/coil3/compose/AsyncImagePainter.kt | 36 +++++++----- .../kotlin/coil3/compose/EqualityDelegate.kt | 51 ---------------- .../LocalAsyncImageModelEqualityDelegate.kt | 58 +++++++++++++++++++ .../compose/LocalAsyncImagePreviewHandler.kt | 6 +- .../coil3/compose/SubcomposeAsyncImage.kt | 10 +--- .../kotlin/coil3/compose/internal/utils.kt | 8 ++- coil-compose/api/android/coil-compose.api | 12 ++-- coil-compose/api/coil-compose.klib.api | 12 ++-- coil-compose/api/jvm/coil-compose.api | 12 ++-- .../coil3/compose/SingletonAsyncImage.kt | 8 --- .../compose/SingletonAsyncImagePainter.kt | 8 --- .../compose/SingletonSubcomposeAsyncImage.kt | 10 +--- .../commonMain/kotlin/sample/compose/App.kt | 44 +++++++++++++- 17 files changed, 221 insertions(+), 176 deletions(-) delete mode 100644 coil-compose-core/src/commonMain/kotlin/coil3/compose/EqualityDelegate.kt create mode 100644 coil-compose-core/src/commonMain/kotlin/coil3/compose/LocalAsyncImageModelEqualityDelegate.kt diff --git a/coil-compose-core/api/android/coil-compose-core.api b/coil-compose-core/api/android/coil-compose-core.api index 5e34016d91..799d032946 100644 --- a/coil-compose-core/api/android/coil-compose-core.api +++ b/coil-compose-core/api/android/coil-compose-core.api @@ -1,6 +1,16 @@ public final class coil3/compose/AsyncImageKt { - public static final fun AsyncImage-J-FEaFM (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V - public static final fun AsyncImage-QgsmV_s (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V + public static final fun AsyncImage-nc27qi8 (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V + public static final fun AsyncImage-sKDTAoQ (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V +} + +public abstract interface class coil3/compose/AsyncImageModelEqualityDelegate { + public static final field Companion Lcoil3/compose/AsyncImageModelEqualityDelegate$Companion; + public static final field Default Lcoil3/compose/AsyncImageModelEqualityDelegate; + public abstract fun equals (Ljava/lang/Object;Ljava/lang/Object;)Z + public abstract fun hashCode (Ljava/lang/Object;)I +} + +public final class coil3/compose/AsyncImageModelEqualityDelegate$Companion { } public final class coil3/compose/AsyncImagePainter : androidx/compose/ui/graphics/painter/Painter, androidx/compose/runtime/RememberObserver { @@ -21,9 +31,10 @@ public final class coil3/compose/AsyncImagePainter$Companion { public final class coil3/compose/AsyncImagePainter$Input { public static final field $stable I - public fun (Lcoil3/ImageLoader;Lcoil3/request/ImageRequest;)V + public fun (Lcoil3/ImageLoader;Lcoil3/request/ImageRequest;Lcoil3/compose/AsyncImageModelEqualityDelegate;)V public fun equals (Ljava/lang/Object;)Z public final fun getImageLoader ()Lcoil3/ImageLoader; + public final fun getModelEqualityDelegate ()Lcoil3/compose/AsyncImageModelEqualityDelegate; public final fun getRequest ()Lcoil3/request/ImageRequest; public fun hashCode ()I public fun toString ()Ljava/lang/String; @@ -83,8 +94,8 @@ public final class coil3/compose/AsyncImagePainter$State$Success : coil3/compose } public final class coil3/compose/AsyncImagePainterKt { - public static final fun rememberAsyncImagePainter-0YpotYA (Ljava/lang/Object;Lcoil3/ImageLoader;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; - public static final fun rememberAsyncImagePainter-10Xjiaw (Ljava/lang/Object;Lcoil3/ImageLoader;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)Lcoil3/compose/AsyncImagePainter; + public static final fun rememberAsyncImagePainter-3HmZ8SU (Ljava/lang/Object;Lcoil3/ImageLoader;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILandroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; + public static final fun rememberAsyncImagePainter-5jETZwI (Ljava/lang/Object;Lcoil3/ImageLoader;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILandroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; } public abstract interface class coil3/compose/AsyncImagePreviewHandler { @@ -124,15 +135,6 @@ public final class coil3/compose/DrawScopeSizeResolverKt { public static final fun rememberDrawScopeSizeResolver (Landroidx/compose/runtime/Composer;I)Lcoil3/compose/DrawScopeSizeResolver; } -public abstract interface class coil3/compose/EqualityDelegate { - public abstract fun equals (Ljava/lang/Object;Ljava/lang/Object;)Z - public abstract fun hashCode (Ljava/lang/Object;)I -} - -public final class coil3/compose/EqualityDelegateKt { - public static final fun getDefaultModelEqualityDelegate ()Lcoil3/compose/EqualityDelegate; -} - public final class coil3/compose/ImagePainter : androidx/compose/ui/graphics/painter/Painter { public static final field $stable I public fun (Lcoil3/Image;)V @@ -145,6 +147,10 @@ public final class coil3/compose/ImagePainter_androidKt { public static synthetic fun asPainter-55t9-rM$default (Lcoil3/Image;Landroid/content/Context;IILjava/lang/Object;)Landroidx/compose/ui/graphics/painter/Painter; } +public final class coil3/compose/LocalAsyncImageModelEqualityDelegateKt { + public static final fun getLocalAsyncImageModelEqualityDelegate ()Landroidx/compose/runtime/ProvidableCompositionLocal; +} + public final class coil3/compose/LocalAsyncImagePreviewHandlerKt { public static final fun AsyncImagePreviewHandler (Lkotlin/jvm/functions/Function2;)Lcoil3/compose/AsyncImagePreviewHandler; public static final fun getLocalAsyncImagePreviewHandler ()Landroidx/compose/runtime/ProvidableCompositionLocal; @@ -155,8 +161,8 @@ public final class coil3/compose/LocalPlatformContext_androidKt { } public final class coil3/compose/SubcomposeAsyncImageKt { - public static final fun SubcomposeAsyncImage-FSyRiR8 (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;III)V - public static final fun SubcomposeAsyncImage-TCQMD7g (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V + public static final fun SubcomposeAsyncImage-MokUVwQ (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V + public static final fun SubcomposeAsyncImage-QgsmV_s (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;III)V public static final fun SubcomposeAsyncImageContent (Lcoil3/compose/SubcomposeAsyncImageScope;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/graphics/painter/Painter;Ljava/lang/String;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;ZLandroidx/compose/runtime/Composer;II)V } diff --git a/coil-compose-core/api/coil-compose-core.klib.api b/coil-compose-core/api/coil-compose-core.klib.api index f34996a058..ed94051351 100644 --- a/coil-compose-core/api/coil-compose-core.klib.api +++ b/coil-compose-core/api/coil-compose-core.klib.api @@ -15,13 +15,18 @@ abstract fun interface coil3.compose/AsyncImagePreviewHandler { // coil3.compose } } -abstract interface coil3.compose/DrawScopeSizeResolver : coil3.size/SizeResolver { // coil3.compose/DrawScopeSizeResolver|null[0] - abstract fun connect(kotlinx.coroutines.flow/Flow) // coil3.compose/DrawScopeSizeResolver.connect|connect(kotlinx.coroutines.flow.Flow){}[0] +abstract interface coil3.compose/AsyncImageModelEqualityDelegate { // coil3.compose/AsyncImageModelEqualityDelegate|null[0] + abstract fun equals(kotlin/Any?, kotlin/Any?): kotlin/Boolean // coil3.compose/AsyncImageModelEqualityDelegate.equals|equals(kotlin.Any?;kotlin.Any?){}[0] + abstract fun hashCode(kotlin/Any?): kotlin/Int // coil3.compose/AsyncImageModelEqualityDelegate.hashCode|hashCode(kotlin.Any?){}[0] + + final object Companion { // coil3.compose/AsyncImageModelEqualityDelegate.Companion|null[0] + final val Default // coil3.compose/AsyncImageModelEqualityDelegate.Companion.Default|{}Default[0] + final fun (): coil3.compose/AsyncImageModelEqualityDelegate // coil3.compose/AsyncImageModelEqualityDelegate.Companion.Default.|(){}[0] + } } -abstract interface coil3.compose/EqualityDelegate { // coil3.compose/EqualityDelegate|null[0] - abstract fun equals(kotlin/Any?, kotlin/Any?): kotlin/Boolean // coil3.compose/EqualityDelegate.equals|equals(kotlin.Any?;kotlin.Any?){}[0] - abstract fun hashCode(kotlin/Any?): kotlin/Int // coil3.compose/EqualityDelegate.hashCode|hashCode(kotlin.Any?){}[0] +abstract interface coil3.compose/DrawScopeSizeResolver : coil3.size/SizeResolver { // coil3.compose/DrawScopeSizeResolver|null[0] + abstract fun connect(kotlinx.coroutines.flow/Flow) // coil3.compose/DrawScopeSizeResolver.connect|connect(kotlinx.coroutines.flow.Flow){}[0] } abstract interface coil3.compose/SubcomposeAsyncImageScope : androidx.compose.foundation.layout/BoxScope { // coil3.compose/SubcomposeAsyncImageScope|null[0] @@ -114,10 +119,12 @@ final class coil3.compose/AsyncImagePainter : androidx.compose.runtime/RememberO } final class Input { // coil3.compose/AsyncImagePainter.Input|null[0] - constructor (coil3/ImageLoader, coil3.request/ImageRequest) // coil3.compose/AsyncImagePainter.Input.|(coil3.ImageLoader;coil3.request.ImageRequest){}[0] + constructor (coil3/ImageLoader, coil3.request/ImageRequest, coil3.compose/AsyncImageModelEqualityDelegate) // coil3.compose/AsyncImagePainter.Input.|(coil3.ImageLoader;coil3.request.ImageRequest;coil3.compose.AsyncImageModelEqualityDelegate){}[0] final val imageLoader // coil3.compose/AsyncImagePainter.Input.imageLoader|{}imageLoader[0] final fun (): coil3/ImageLoader // coil3.compose/AsyncImagePainter.Input.imageLoader.|(){}[0] + final val modelEqualityDelegate // coil3.compose/AsyncImagePainter.Input.modelEqualityDelegate|{}modelEqualityDelegate[0] + final fun (): coil3.compose/AsyncImageModelEqualityDelegate // coil3.compose/AsyncImagePainter.Input.modelEqualityDelegate.|(){}[0] final val request // coil3.compose/AsyncImagePainter.Input.request|{}request[0] final fun (): coil3.request/ImageRequest // coil3.compose/AsyncImagePainter.Input.request.|(){}[0] @@ -153,8 +160,8 @@ final val coil3.compose.internal/coil3_compose_internal_AsyncImageState$stablepr final val coil3.compose.internal/coil3_compose_internal_ContentPainterElement$stableprop // coil3.compose.internal/coil3_compose_internal_ContentPainterElement$stableprop|#static{}coil3_compose_internal_ContentPainterElement$stableprop[0] final val coil3.compose.internal/coil3_compose_internal_ContentPainterNode$stableprop // coil3.compose.internal/coil3_compose_internal_ContentPainterNode$stableprop|#static{}coil3_compose_internal_ContentPainterNode$stableprop[0] final val coil3.compose.internal/coil3_compose_internal_CrossfadePainter$stableprop // coil3.compose.internal/coil3_compose_internal_CrossfadePainter$stableprop|#static{}coil3_compose_internal_CrossfadePainter$stableprop[0] -final val coil3.compose/DefaultModelEqualityDelegate // coil3.compose/DefaultModelEqualityDelegate|{}DefaultModelEqualityDelegate[0] - final fun (): coil3.compose/EqualityDelegate // coil3.compose/DefaultModelEqualityDelegate.|(){}[0] +final val coil3.compose/LocalAsyncImageModelEqualityDelegate // coil3.compose/LocalAsyncImageModelEqualityDelegate|{}LocalAsyncImageModelEqualityDelegate[0] + final fun (): androidx.compose.runtime/ProvidableCompositionLocal // coil3.compose/LocalAsyncImageModelEqualityDelegate.|(){}[0] final val coil3.compose/LocalAsyncImagePreviewHandler // coil3.compose/LocalAsyncImagePreviewHandler|{}LocalAsyncImagePreviewHandler[0] final fun (): androidx.compose.runtime/ProvidableCompositionLocal // coil3.compose/LocalAsyncImagePreviewHandler.|(){}[0] final val coil3.compose/LocalPlatformContext // coil3.compose/LocalPlatformContext|{}LocalPlatformContext[0] @@ -174,11 +181,11 @@ final fun coil3.compose.internal/coil3_compose_internal_AsyncImageState$stablepr final fun coil3.compose.internal/coil3_compose_internal_ContentPainterElement$stableprop_getter(): kotlin/Int // coil3.compose.internal/coil3_compose_internal_ContentPainterElement$stableprop_getter|coil3_compose_internal_ContentPainterElement$stableprop_getter(){}[0] final fun coil3.compose.internal/coil3_compose_internal_ContentPainterNode$stableprop_getter(): kotlin/Int // coil3.compose.internal/coil3_compose_internal_ContentPainterNode$stableprop_getter|coil3_compose_internal_ContentPainterNode$stableprop_getter(){}[0] final fun coil3.compose.internal/coil3_compose_internal_CrossfadePainter$stableprop_getter(): kotlin/Int // coil3.compose.internal/coil3_compose_internal_CrossfadePainter$stableprop_getter|coil3_compose_internal_CrossfadePainter$stableprop_getter(){}[0] -final fun coil3.compose/AsyncImage(kotlin/Any?, kotlin/String?, coil3/ImageLoader, androidx.compose.ui/Modifier?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, coil3.compose/EqualityDelegate?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/AsyncImage|AsyncImage(kotlin.Any?;kotlin.String?;coil3.ImageLoader;androidx.compose.ui.Modifier?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;coil3.compose.EqualityDelegate?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] -final fun coil3.compose/AsyncImage(kotlin/Any?, kotlin/String?, coil3/ImageLoader, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, coil3.compose/EqualityDelegate?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/AsyncImage|AsyncImage(kotlin.Any?;kotlin.String?;coil3.ImageLoader;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;coil3.compose.EqualityDelegate?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/AsyncImage(kotlin/Any?, kotlin/String?, coil3/ImageLoader, androidx.compose.ui/Modifier?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/AsyncImage|AsyncImage(kotlin.Any?;kotlin.String?;coil3.ImageLoader;androidx.compose.ui.Modifier?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/AsyncImage(kotlin/Any?, kotlin/String?, coil3/ImageLoader, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/AsyncImage|AsyncImage(kotlin.Any?;kotlin.String?;coil3.ImageLoader;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] final fun coil3.compose/DrawScopeSizeResolver(): coil3.compose/DrawScopeSizeResolver // coil3.compose/DrawScopeSizeResolver|DrawScopeSizeResolver(){}[0] -final fun coil3.compose/SubcomposeAsyncImage(kotlin/Any?, kotlin/String?, coil3/ImageLoader, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, coil3.compose/EqualityDelegate?, kotlin/Function3, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/SubcomposeAsyncImage|SubcomposeAsyncImage(kotlin.Any?;kotlin.String?;coil3.ImageLoader;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;coil3.compose.EqualityDelegate?;kotlin.Function3;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] -final fun coil3.compose/SubcomposeAsyncImage(kotlin/Any?, kotlin/String?, coil3/ImageLoader, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function4?, kotlin/Function4?, kotlin/Function4?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, coil3.compose/EqualityDelegate?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/SubcomposeAsyncImage|SubcomposeAsyncImage(kotlin.Any?;kotlin.String?;coil3.ImageLoader;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function4?;kotlin.Function4?;kotlin.Function4?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;coil3.compose.EqualityDelegate?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/SubcomposeAsyncImage(kotlin/Any?, kotlin/String?, coil3/ImageLoader, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, kotlin/Function3, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/SubcomposeAsyncImage|SubcomposeAsyncImage(kotlin.Any?;kotlin.String?;coil3.ImageLoader;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;kotlin.Function3;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/SubcomposeAsyncImage(kotlin/Any?, kotlin/String?, coil3/ImageLoader, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function4?, kotlin/Function4?, kotlin/Function4?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/SubcomposeAsyncImage|SubcomposeAsyncImage(kotlin.Any?;kotlin.String?;coil3.ImageLoader;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function4?;kotlin.Function4?;kotlin.Function4?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] final fun coil3.compose/coil3_compose_AsyncImagePainter$stableprop_getter(): kotlin/Int // coil3.compose/coil3_compose_AsyncImagePainter$stableprop_getter|coil3_compose_AsyncImagePainter$stableprop_getter(){}[0] final fun coil3.compose/coil3_compose_AsyncImagePainter_Input$stableprop_getter(): kotlin/Int // coil3.compose/coil3_compose_AsyncImagePainter_Input$stableprop_getter|coil3_compose_AsyncImagePainter_Input$stableprop_getter(){}[0] final fun coil3.compose/coil3_compose_AsyncImagePainter_State_Empty$stableprop_getter(): kotlin/Int // coil3.compose/coil3_compose_AsyncImagePainter_State_Empty$stableprop_getter|coil3_compose_AsyncImagePainter_State_Empty$stableprop_getter(){}[0] @@ -187,8 +194,8 @@ final fun coil3.compose/coil3_compose_AsyncImagePainter_State_Loading$stableprop final fun coil3.compose/coil3_compose_AsyncImagePainter_State_Success$stableprop_getter(): kotlin/Int // coil3.compose/coil3_compose_AsyncImagePainter_State_Success$stableprop_getter|coil3_compose_AsyncImagePainter_State_Success$stableprop_getter(){}[0] final fun coil3.compose/coil3_compose_ConstraintsSizeResolver$stableprop_getter(): kotlin/Int // coil3.compose/coil3_compose_ConstraintsSizeResolver$stableprop_getter|coil3_compose_ConstraintsSizeResolver$stableprop_getter(){}[0] final fun coil3.compose/coil3_compose_ImagePainter$stableprop_getter(): kotlin/Int // coil3.compose/coil3_compose_ImagePainter$stableprop_getter|coil3_compose_ImagePainter$stableprop_getter(){}[0] -final fun coil3.compose/rememberAsyncImagePainter(kotlin/Any?, coil3/ImageLoader, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui.layout/ContentScale?, androidx.compose.ui.graphics/FilterQuality, coil3.compose/EqualityDelegate?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int): coil3.compose/AsyncImagePainter // coil3.compose/rememberAsyncImagePainter|rememberAsyncImagePainter(kotlin.Any?;coil3.ImageLoader;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.layout.ContentScale?;androidx.compose.ui.graphics.FilterQuality;coil3.compose.EqualityDelegate?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] -final fun coil3.compose/rememberAsyncImagePainter(kotlin/Any?, coil3/ImageLoader, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui.layout/ContentScale?, androidx.compose.ui.graphics/FilterQuality, coil3.compose/EqualityDelegate?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): coil3.compose/AsyncImagePainter // coil3.compose/rememberAsyncImagePainter|rememberAsyncImagePainter(kotlin.Any?;coil3.ImageLoader;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.layout.ContentScale?;androidx.compose.ui.graphics.FilterQuality;coil3.compose.EqualityDelegate?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/rememberAsyncImagePainter(kotlin/Any?, coil3/ImageLoader, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui.layout/ContentScale?, androidx.compose.ui.graphics/FilterQuality, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): coil3.compose/AsyncImagePainter // coil3.compose/rememberAsyncImagePainter|rememberAsyncImagePainter(kotlin.Any?;coil3.ImageLoader;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.layout.ContentScale?;androidx.compose.ui.graphics.FilterQuality;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/rememberAsyncImagePainter(kotlin/Any?, coil3/ImageLoader, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui.layout/ContentScale?, androidx.compose.ui.graphics/FilterQuality, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): coil3.compose/AsyncImagePainter // coil3.compose/rememberAsyncImagePainter|rememberAsyncImagePainter(kotlin.Any?;coil3.ImageLoader;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.layout.ContentScale?;androidx.compose.ui.graphics.FilterQuality;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] final fun coil3.compose/rememberConstraintsSizeResolver(androidx.compose.runtime/Composer?, kotlin/Int): coil3.compose/ConstraintsSizeResolver // coil3.compose/rememberConstraintsSizeResolver|rememberConstraintsSizeResolver(androidx.compose.runtime.Composer?;kotlin.Int){}[0] final fun coil3.compose/rememberDrawScopeSizeResolver(androidx.compose.runtime/Composer?, kotlin/Int): coil3.compose/DrawScopeSizeResolver // coil3.compose/rememberDrawScopeSizeResolver|rememberDrawScopeSizeResolver(androidx.compose.runtime.Composer?;kotlin.Int){}[0] final inline fun coil3.compose/AsyncImagePreviewHandler(crossinline kotlin.coroutines/SuspendFunction1): coil3.compose/AsyncImagePreviewHandler // coil3.compose/AsyncImagePreviewHandler|AsyncImagePreviewHandler(kotlin.coroutines.SuspendFunction1){}[0] diff --git a/coil-compose-core/api/jvm/coil-compose-core.api b/coil-compose-core/api/jvm/coil-compose-core.api index 62b4526bf4..18266b6a97 100644 --- a/coil-compose-core/api/jvm/coil-compose-core.api +++ b/coil-compose-core/api/jvm/coil-compose-core.api @@ -1,6 +1,16 @@ public final class coil3/compose/AsyncImageKt { - public static final fun AsyncImage-J-FEaFM (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V - public static final fun AsyncImage-QgsmV_s (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V + public static final fun AsyncImage-nc27qi8 (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V + public static final fun AsyncImage-sKDTAoQ (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V +} + +public abstract interface class coil3/compose/AsyncImageModelEqualityDelegate { + public static final field Companion Lcoil3/compose/AsyncImageModelEqualityDelegate$Companion; + public static final field Default Lcoil3/compose/AsyncImageModelEqualityDelegate; + public abstract fun equals (Ljava/lang/Object;Ljava/lang/Object;)Z + public abstract fun hashCode (Ljava/lang/Object;)I +} + +public final class coil3/compose/AsyncImageModelEqualityDelegate$Companion { } public final class coil3/compose/AsyncImagePainter : androidx/compose/ui/graphics/painter/Painter, androidx/compose/runtime/RememberObserver { @@ -21,9 +31,10 @@ public final class coil3/compose/AsyncImagePainter$Companion { public final class coil3/compose/AsyncImagePainter$Input { public static final field $stable I - public fun (Lcoil3/ImageLoader;Lcoil3/request/ImageRequest;)V + public fun (Lcoil3/ImageLoader;Lcoil3/request/ImageRequest;Lcoil3/compose/AsyncImageModelEqualityDelegate;)V public fun equals (Ljava/lang/Object;)Z public final fun getImageLoader ()Lcoil3/ImageLoader; + public final fun getModelEqualityDelegate ()Lcoil3/compose/AsyncImageModelEqualityDelegate; public final fun getRequest ()Lcoil3/request/ImageRequest; public fun hashCode ()I public fun toString ()Ljava/lang/String; @@ -83,8 +94,8 @@ public final class coil3/compose/AsyncImagePainter$State$Success : coil3/compose } public final class coil3/compose/AsyncImagePainterKt { - public static final fun rememberAsyncImagePainter-0YpotYA (Ljava/lang/Object;Lcoil3/ImageLoader;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; - public static final fun rememberAsyncImagePainter-10Xjiaw (Ljava/lang/Object;Lcoil3/ImageLoader;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)Lcoil3/compose/AsyncImagePainter; + public static final fun rememberAsyncImagePainter-3HmZ8SU (Ljava/lang/Object;Lcoil3/ImageLoader;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILandroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; + public static final fun rememberAsyncImagePainter-5jETZwI (Ljava/lang/Object;Lcoil3/ImageLoader;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILandroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; } public abstract interface class coil3/compose/AsyncImagePreviewHandler { @@ -124,15 +135,6 @@ public final class coil3/compose/DrawScopeSizeResolverKt { public static final fun rememberDrawScopeSizeResolver (Landroidx/compose/runtime/Composer;I)Lcoil3/compose/DrawScopeSizeResolver; } -public abstract interface class coil3/compose/EqualityDelegate { - public abstract fun equals (Ljava/lang/Object;Ljava/lang/Object;)Z - public abstract fun hashCode (Ljava/lang/Object;)I -} - -public final class coil3/compose/EqualityDelegateKt { - public static final fun getDefaultModelEqualityDelegate ()Lcoil3/compose/EqualityDelegate; -} - public final class coil3/compose/ImagePainter : androidx/compose/ui/graphics/painter/Painter { public static final field $stable I public fun (Lcoil3/Image;)V @@ -145,6 +147,10 @@ public final class coil3/compose/ImagePainter_nonAndroidKt { public static synthetic fun asPainter-55t9-rM$default (Lcoil3/Image;Lcoil3/PlatformContext;IILjava/lang/Object;)Landroidx/compose/ui/graphics/painter/Painter; } +public final class coil3/compose/LocalAsyncImageModelEqualityDelegateKt { + public static final fun getLocalAsyncImageModelEqualityDelegate ()Landroidx/compose/runtime/ProvidableCompositionLocal; +} + public final class coil3/compose/LocalAsyncImagePreviewHandlerKt { public static final fun AsyncImagePreviewHandler (Lkotlin/jvm/functions/Function2;)Lcoil3/compose/AsyncImagePreviewHandler; public static final fun getLocalAsyncImagePreviewHandler ()Landroidx/compose/runtime/ProvidableCompositionLocal; @@ -155,8 +161,8 @@ public final class coil3/compose/LocalPlatformContext_nonAndroidKt { } public final class coil3/compose/SubcomposeAsyncImageKt { - public static final fun SubcomposeAsyncImage-FSyRiR8 (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;III)V - public static final fun SubcomposeAsyncImage-TCQMD7g (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V + public static final fun SubcomposeAsyncImage-MokUVwQ (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V + public static final fun SubcomposeAsyncImage-QgsmV_s (Ljava/lang/Object;Ljava/lang/String;Lcoil3/ImageLoader;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;III)V public static final fun SubcomposeAsyncImageContent (Lcoil3/compose/SubcomposeAsyncImageScope;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/graphics/painter/Painter;Ljava/lang/String;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;ZLandroidx/compose/runtime/Composer;II)V } diff --git a/coil-compose-core/src/commonMain/kotlin/coil3/compose/AsyncImage.kt b/coil-compose-core/src/commonMain/kotlin/coil3/compose/AsyncImage.kt index c86328aba0..cf92a69831 100644 --- a/coil-compose-core/src/commonMain/kotlin/coil3/compose/AsyncImage.kt +++ b/coil-compose-core/src/commonMain/kotlin/coil3/compose/AsyncImage.kt @@ -49,8 +49,6 @@ import coil3.request.ImageRequest * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. * @param clipToBounds If true, clips the content to its bounds. Else, it will not be clipped. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. */ @Composable @NonRestartableComposable @@ -71,9 +69,8 @@ fun AsyncImage( colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DefaultFilterQuality, clipToBounds: Boolean = true, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, ) = AsyncImage( - state = AsyncImageState(model, modelEqualityDelegate, imageLoader), + state = AsyncImageState(model, LocalAsyncImageModelEqualityDelegate.current, imageLoader), contentDescription = contentDescription, modifier = modifier, transform = transformOf(placeholder, error, fallback), @@ -109,8 +106,6 @@ fun AsyncImage( * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. * @param clipToBounds If true, clips the content to its bounds. Else, it will not be clipped. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. */ @Composable @NonRestartableComposable @@ -127,9 +122,8 @@ fun AsyncImage( colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DefaultFilterQuality, clipToBounds: Boolean = true, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, ) = AsyncImage( - state = AsyncImageState(model, modelEqualityDelegate, imageLoader), + state = AsyncImageState(model, LocalAsyncImageModelEqualityDelegate.current, imageLoader), contentDescription = contentDescription, modifier = modifier, transform = transform, @@ -168,7 +162,6 @@ private fun AsyncImage( onState = onState, contentScale = contentScale, filterQuality = filterQuality, - modelEqualityDelegate = state.modelEqualityDelegate, ) // Draw the content. diff --git a/coil-compose-core/src/commonMain/kotlin/coil3/compose/AsyncImagePainter.kt b/coil-compose-core/src/commonMain/kotlin/coil3/compose/AsyncImagePainter.kt index fcba2f52f4..6f38e8132c 100644 --- a/coil-compose-core/src/commonMain/kotlin/coil3/compose/AsyncImagePainter.kt +++ b/coil-compose-core/src/commonMain/kotlin/coil3/compose/AsyncImagePainter.kt @@ -75,8 +75,6 @@ import kotlinx.coroutines.launch * to the same value that's passed to [Image]. * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. */ @Composable @NonRestartableComposable @@ -91,9 +89,8 @@ fun rememberAsyncImagePainter( onError: ((State.Error) -> Unit)? = null, contentScale: ContentScale = ContentScale.Fit, filterQuality: FilterQuality = DefaultFilterQuality, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, ) = rememberAsyncImagePainter( - state = AsyncImageState(model, modelEqualityDelegate, imageLoader), + state = AsyncImageState(model, LocalAsyncImageModelEqualityDelegate.current, imageLoader), transform = transformOf(placeholder, error, fallback), onState = onStateOf(onLoading, onSuccess, onError), contentScale = contentScale, @@ -115,8 +112,6 @@ fun rememberAsyncImagePainter( * to the same value that's passed to [Image]. * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. */ @Composable @NonRestartableComposable @@ -127,9 +122,8 @@ fun rememberAsyncImagePainter( onState: ((State) -> Unit)? = null, contentScale: ContentScale = ContentScale.Fit, filterQuality: FilterQuality = DefaultFilterQuality, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, ) = rememberAsyncImagePainter( - state = AsyncImageState(model, modelEqualityDelegate, imageLoader), + state = AsyncImageState(model, LocalAsyncImageModelEqualityDelegate.current, imageLoader), transform = transform, onState = onState, contentScale = contentScale, @@ -147,7 +141,7 @@ private fun rememberAsyncImagePainter( val request = requestOf(state.model) validateRequest(request) - val input = Input(state.imageLoader, request) + val input = Input(state.imageLoader, request, LocalAsyncImageModelEqualityDelegate.current) val painter = remember { AsyncImagePainter(input) } painter.scope = rememberCoroutineScope() painter.transform = transform @@ -226,12 +220,11 @@ class AsyncImagePainter internal constructor( (painter as? RememberObserver)?.onRemembered() // Observe the latest request and execute any emissions. - val inputs = restartSignal.flatMapLatest { _input } val previewHandler = previewHandler if (previewHandler != null) { // If we're in inspection mode use the preview renderer. rememberJob = scope.launch(Dispatchers.Unconfined) { - inputs.mapLatest { + restartSignal.flatMapLatest { _input }.mapLatest { val request = updateRequest(it.request, isPreview = true) previewHandler.handle(it.imageLoader, request) }.collect(::updateState) @@ -239,7 +232,7 @@ class AsyncImagePainter internal constructor( } else { // Else, execute the request as normal. rememberJob = scope.launch(safeImmediateMainDispatcher) { - inputs.mapLatest { + restartSignal.flatMapLatest { _input }.mapLatest { val request = updateRequest(it.request, isPreview = false) it.imageLoader.execute(request).toState() }.collect(::updateState) @@ -336,7 +329,24 @@ class AsyncImagePainter internal constructor( class Input( val imageLoader: ImageLoader, val request: ImageRequest, - ) + val modelEqualityDelegate: AsyncImageModelEqualityDelegate, + ) { + + override fun equals(other: Any?): Boolean { + if (this === other) return true + return other is Input && + imageLoader == other.imageLoader && + modelEqualityDelegate == other.modelEqualityDelegate && + modelEqualityDelegate.equals(request, other.request) + } + + override fun hashCode(): Int { + var result = imageLoader.hashCode() + result = 31 * result + modelEqualityDelegate.hashCode() + result = 31 * result + modelEqualityDelegate.hashCode(request) + return result + } + } /** * The current state of the [AsyncImagePainter]. diff --git a/coil-compose-core/src/commonMain/kotlin/coil3/compose/EqualityDelegate.kt b/coil-compose-core/src/commonMain/kotlin/coil3/compose/EqualityDelegate.kt deleted file mode 100644 index 8e1c36d9a9..0000000000 --- a/coil-compose-core/src/commonMain/kotlin/coil3/compose/EqualityDelegate.kt +++ /dev/null @@ -1,51 +0,0 @@ -package coil3.compose - -import androidx.compose.runtime.Stable -import coil3.request.ImageRequest - -/** - * Determines equality between two values or a value's hash code. - */ -@Stable -interface EqualityDelegate { - fun equals(self: Any?, other: Any?): Boolean - fun hashCode(self: Any?): Int -} - -/** - * The default [EqualityDelegate] used to determine equality and the hash code for the `model` - * argument for [rememberAsyncImagePainter], [AsyncImage], and [SubcomposeAsyncImage]. - */ -val DefaultModelEqualityDelegate = object : EqualityDelegate { - - override fun equals(self: Any?, other: Any?): Boolean { - if (self !is ImageRequest || other !is ImageRequest) { - return self == other - } - - return self.context == other.context && - self.data == other.data && - self.memoryCacheKey == other.memoryCacheKey && - self.memoryCacheKeyExtras == other.memoryCacheKeyExtras && - self.diskCacheKey == other.diskCacheKey && - self.sizeResolver == other.sizeResolver && - self.scale == other.scale && - self.precision == other.precision - } - - override fun hashCode(self: Any?): Int { - if (self !is ImageRequest) { - return self.hashCode() - } - - var result = self.context.hashCode() - result = 31 * result + self.data.hashCode() - result = 31 * result + self.memoryCacheKey.hashCode() - result = 31 * result + self.memoryCacheKeyExtras.hashCode() - result = 31 * result + self.diskCacheKey.hashCode() - result = 31 * result + self.sizeResolver.hashCode() - result = 31 * result + self.scale.hashCode() - result = 31 * result + self.precision.hashCode() - return result - } -} diff --git a/coil-compose-core/src/commonMain/kotlin/coil3/compose/LocalAsyncImageModelEqualityDelegate.kt b/coil-compose-core/src/commonMain/kotlin/coil3/compose/LocalAsyncImageModelEqualityDelegate.kt new file mode 100644 index 0000000000..c0819f5028 --- /dev/null +++ b/coil-compose-core/src/commonMain/kotlin/coil3/compose/LocalAsyncImageModelEqualityDelegate.kt @@ -0,0 +1,58 @@ +package coil3.compose + +import androidx.compose.runtime.Stable +import androidx.compose.runtime.staticCompositionLocalOf +import coil3.annotation.ExperimentalCoilApi +import coil3.request.ImageRequest +import kotlin.jvm.JvmField + +@ExperimentalCoilApi +val LocalAsyncImageModelEqualityDelegate = staticCompositionLocalOf { + AsyncImageModelEqualityDelegate.Default +} + +/** + * Determines equality between two models. + * + * This allows you to control when [rememberAsyncImagePainter], [AsyncImage], and + * [SubcomposeAsyncImage] execute a new request and recompose due to a `model` change. + */ +@ExperimentalCoilApi +@Stable +interface AsyncImageModelEqualityDelegate { + + fun equals(self: Any?, other: Any?): Boolean + fun hashCode(self: Any?): Int + + companion object { + @JvmField val Default = object : AsyncImageModelEqualityDelegate { + + override fun equals(self: Any?, other: Any?): Boolean { + if (this === other) return true + return self is ImageRequest && + other is ImageRequest && + self.context == other.context && + self.data == other.data && + self.memoryCacheKey == other.memoryCacheKey && + self.memoryCacheKeyExtras == other.memoryCacheKeyExtras && + self.diskCacheKey == other.diskCacheKey && + self.sizeResolver == other.sizeResolver && + self.scale == other.scale && + self.precision == other.precision + } + + override fun hashCode(self: Any?): Int { + if (self !is ImageRequest) return self.hashCode() + var result = self.context.hashCode() + result = 31 * result + self.data.hashCode() + result = 31 * result + self.memoryCacheKey.hashCode() + result = 31 * result + self.memoryCacheKeyExtras.hashCode() + result = 31 * result + self.diskCacheKey.hashCode() + result = 31 * result + self.sizeResolver.hashCode() + result = 31 * result + self.scale.hashCode() + result = 31 * result + self.precision.hashCode() + return result + } + } + } +} diff --git a/coil-compose-core/src/commonMain/kotlin/coil3/compose/LocalAsyncImagePreviewHandler.kt b/coil-compose-core/src/commonMain/kotlin/coil3/compose/LocalAsyncImagePreviewHandler.kt index d66251e97c..a353d1bf67 100644 --- a/coil-compose-core/src/commonMain/kotlin/coil3/compose/LocalAsyncImagePreviewHandler.kt +++ b/coil-compose-core/src/commonMain/kotlin/coil3/compose/LocalAsyncImagePreviewHandler.kt @@ -1,5 +1,6 @@ package coil3.compose +import androidx.compose.runtime.Stable import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.platform.LocalInspectionMode import coil3.Image @@ -14,13 +15,16 @@ import coil3.request.SuccessResult import kotlin.jvm.JvmField @ExperimentalCoilApi -val LocalAsyncImagePreviewHandler = staticCompositionLocalOf { AsyncImagePreviewHandler.Default } +val LocalAsyncImagePreviewHandler = staticCompositionLocalOf { + AsyncImagePreviewHandler.Default +} /** * Controls what [AsyncImage], [SubcomposeAsyncImage], and [AsyncImagePainter] render when * [LocalInspectionMode] is true. */ @ExperimentalCoilApi +@Stable fun interface AsyncImagePreviewHandler { suspend fun handle( diff --git a/coil-compose-core/src/commonMain/kotlin/coil3/compose/SubcomposeAsyncImage.kt b/coil-compose-core/src/commonMain/kotlin/coil3/compose/SubcomposeAsyncImage.kt index 0e823a53af..80fd5ad45c 100644 --- a/coil-compose-core/src/commonMain/kotlin/coil3/compose/SubcomposeAsyncImage.kt +++ b/coil-compose-core/src/commonMain/kotlin/coil3/compose/SubcomposeAsyncImage.kt @@ -59,8 +59,6 @@ import coil3.request.ImageRequest * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. * @param clipToBounds If true, clips the content to its bounds. Else, it will not be clipped. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. */ @Composable @NonRestartableComposable @@ -82,9 +80,8 @@ fun SubcomposeAsyncImage( colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DefaultFilterQuality, clipToBounds: Boolean = true, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, ) = SubcomposeAsyncImage( - state = AsyncImageState(model, modelEqualityDelegate, imageLoader), + state = AsyncImageState(model, LocalAsyncImageModelEqualityDelegate.current, imageLoader), contentDescription = contentDescription, modifier = modifier, transform = transform, @@ -124,8 +121,6 @@ fun SubcomposeAsyncImage( * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. * @param clipToBounds If true, clips the content to its bounds. Else, it will not be clipped. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. * @param content A callback to draw the content inside a [SubcomposeAsyncImageScope]. */ @Composable @@ -143,10 +138,9 @@ fun SubcomposeAsyncImage( colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DefaultFilterQuality, clipToBounds: Boolean = true, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, content: @Composable SubcomposeAsyncImageScope.() -> Unit, ) = SubcomposeAsyncImage( - state = AsyncImageState(model, modelEqualityDelegate, imageLoader), + state = AsyncImageState(model, LocalAsyncImageModelEqualityDelegate.current, imageLoader), contentDescription = contentDescription, modifier = modifier, transform = transform, diff --git a/coil-compose-core/src/commonMain/kotlin/coil3/compose/internal/utils.kt b/coil-compose-core/src/commonMain/kotlin/coil3/compose/internal/utils.kt index 2d6a1ac75b..5f43bad523 100644 --- a/coil-compose-core/src/commonMain/kotlin/coil3/compose/internal/utils.kt +++ b/coil-compose-core/src/commonMain/kotlin/coil3/compose/internal/utils.kt @@ -17,9 +17,9 @@ import androidx.compose.ui.unit.Constraints import androidx.compose.ui.unit.IntSize import coil3.ImageLoader import coil3.compose.AsyncImage +import coil3.compose.AsyncImageModelEqualityDelegate import coil3.compose.AsyncImagePainter.Companion.DefaultTransform import coil3.compose.AsyncImagePainter.State -import coil3.compose.EqualityDelegate import coil3.compose.LocalPlatformContext import coil3.compose.rememberConstraintsSizeResolver import coil3.request.ImageRequest @@ -132,19 +132,21 @@ internal fun onStateOf( @Stable internal class AsyncImageState( val model: Any?, - val modelEqualityDelegate: EqualityDelegate, + val modelEqualityDelegate: AsyncImageModelEqualityDelegate, val imageLoader: ImageLoader, ) { override fun equals(other: Any?): Boolean { if (this === other) return true return other is AsyncImageState && + modelEqualityDelegate == other.modelEqualityDelegate && modelEqualityDelegate.equals(model, other.model) && imageLoader == other.imageLoader } override fun hashCode(): Int { - var result = modelEqualityDelegate.hashCode(model) + var result = modelEqualityDelegate.hashCode() + result = 31 * result + modelEqualityDelegate.hashCode(model) result = 31 * result + imageLoader.hashCode() return result } diff --git a/coil-compose/api/android/coil-compose.api b/coil-compose/api/android/coil-compose.api index 8869226c81..f98b0358ac 100644 --- a/coil-compose/api/android/coil-compose.api +++ b/coil-compose/api/android/coil-compose.api @@ -1,11 +1,11 @@ public final class coil3/compose/SingletonAsyncImageKt { - public static final fun AsyncImage-Vb_qNX0 (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V - public static final fun AsyncImage-gl8XCv8 (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V + public static final fun AsyncImage-10Xjiaw (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V + public static final fun AsyncImage-x1rPTaM (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V } public final class coil3/compose/SingletonAsyncImagePainterKt { - public static final fun rememberAsyncImagePainter-EHKIwbg (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; - public static final fun rememberAsyncImagePainter-HtA5bXE (Ljava/lang/Object;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; + public static final fun rememberAsyncImagePainter-19ie5dc (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILandroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; + public static final fun rememberAsyncImagePainter-MqR-F_0 (Ljava/lang/Object;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILandroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; } public final class coil3/compose/SingletonImageLoadersKt { @@ -13,7 +13,7 @@ public final class coil3/compose/SingletonImageLoadersKt { } public final class coil3/compose/SingletonSubcomposeAsyncImageKt { - public static final fun SubcomposeAsyncImage-J-FEaFM (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V - public static final fun SubcomposeAsyncImage-OsCPg7o (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;III)V + public static final fun SubcomposeAsyncImage-gl8XCv8 (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;III)V + public static final fun SubcomposeAsyncImage-nc27qi8 (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V } diff --git a/coil-compose/api/coil-compose.klib.api b/coil-compose/api/coil-compose.klib.api index 0470ae89ba..b883c906d3 100644 --- a/coil-compose/api/coil-compose.klib.api +++ b/coil-compose/api/coil-compose.klib.api @@ -6,10 +6,10 @@ // - Show declarations: true // Library unique name: -final fun coil3.compose/AsyncImage(kotlin/Any?, kotlin/String?, androidx.compose.ui/Modifier?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, coil3.compose/EqualityDelegate?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/AsyncImage|AsyncImage(kotlin.Any?;kotlin.String?;androidx.compose.ui.Modifier?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;coil3.compose.EqualityDelegate?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] -final fun coil3.compose/AsyncImage(kotlin/Any?, kotlin/String?, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, coil3.compose/EqualityDelegate?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/AsyncImage|AsyncImage(kotlin.Any?;kotlin.String?;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;coil3.compose.EqualityDelegate?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] -final fun coil3.compose/SubcomposeAsyncImage(kotlin/Any?, kotlin/String?, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, coil3.compose/EqualityDelegate?, kotlin/Function3, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/SubcomposeAsyncImage|SubcomposeAsyncImage(kotlin.Any?;kotlin.String?;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;coil3.compose.EqualityDelegate?;kotlin.Function3;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] -final fun coil3.compose/SubcomposeAsyncImage(kotlin/Any?, kotlin/String?, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function4?, kotlin/Function4?, kotlin/Function4?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, coil3.compose/EqualityDelegate?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/SubcomposeAsyncImage|SubcomposeAsyncImage(kotlin.Any?;kotlin.String?;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function4?;kotlin.Function4?;kotlin.Function4?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;coil3.compose.EqualityDelegate?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] -final fun coil3.compose/rememberAsyncImagePainter(kotlin/Any?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui.layout/ContentScale?, androidx.compose.ui.graphics/FilterQuality, coil3.compose/EqualityDelegate?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): coil3.compose/AsyncImagePainter // coil3.compose/rememberAsyncImagePainter|rememberAsyncImagePainter(kotlin.Any?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.layout.ContentScale?;androidx.compose.ui.graphics.FilterQuality;coil3.compose.EqualityDelegate?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] -final fun coil3.compose/rememberAsyncImagePainter(kotlin/Any?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui.layout/ContentScale?, androidx.compose.ui.graphics/FilterQuality, coil3.compose/EqualityDelegate?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): coil3.compose/AsyncImagePainter // coil3.compose/rememberAsyncImagePainter|rememberAsyncImagePainter(kotlin.Any?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.layout.ContentScale?;androidx.compose.ui.graphics.FilterQuality;coil3.compose.EqualityDelegate?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/AsyncImage(kotlin/Any?, kotlin/String?, androidx.compose.ui/Modifier?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/AsyncImage|AsyncImage(kotlin.Any?;kotlin.String?;androidx.compose.ui.Modifier?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/AsyncImage(kotlin/Any?, kotlin/String?, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/AsyncImage|AsyncImage(kotlin.Any?;kotlin.String?;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/SubcomposeAsyncImage(kotlin/Any?, kotlin/String?, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, kotlin/Function3, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/SubcomposeAsyncImage|SubcomposeAsyncImage(kotlin.Any?;kotlin.String?;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;kotlin.Function3;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/SubcomposeAsyncImage(kotlin/Any?, kotlin/String?, androidx.compose.ui/Modifier?, kotlin/Function1?, kotlin/Function4?, kotlin/Function4?, kotlin/Function4?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui/Alignment?, androidx.compose.ui.layout/ContentScale?, kotlin/Float, androidx.compose.ui.graphics/ColorFilter?, androidx.compose.ui.graphics/FilterQuality, kotlin/Boolean, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // coil3.compose/SubcomposeAsyncImage|SubcomposeAsyncImage(kotlin.Any?;kotlin.String?;androidx.compose.ui.Modifier?;kotlin.Function1?;kotlin.Function4?;kotlin.Function4?;kotlin.Function4?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.Alignment?;androidx.compose.ui.layout.ContentScale?;kotlin.Float;androidx.compose.ui.graphics.ColorFilter?;androidx.compose.ui.graphics.FilterQuality;kotlin.Boolean;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/rememberAsyncImagePainter(kotlin/Any?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, androidx.compose.ui.graphics.painter/Painter?, kotlin/Function1?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui.layout/ContentScale?, androidx.compose.ui.graphics/FilterQuality, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): coil3.compose/AsyncImagePainter // coil3.compose/rememberAsyncImagePainter|rememberAsyncImagePainter(kotlin.Any?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;androidx.compose.ui.graphics.painter.Painter?;kotlin.Function1?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.layout.ContentScale?;androidx.compose.ui.graphics.FilterQuality;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] +final fun coil3.compose/rememberAsyncImagePainter(kotlin/Any?, kotlin/Function1?, kotlin/Function1?, androidx.compose.ui.layout/ContentScale?, androidx.compose.ui.graphics/FilterQuality, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): coil3.compose/AsyncImagePainter // coil3.compose/rememberAsyncImagePainter|rememberAsyncImagePainter(kotlin.Any?;kotlin.Function1?;kotlin.Function1?;androidx.compose.ui.layout.ContentScale?;androidx.compose.ui.graphics.FilterQuality;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] final fun coil3.compose/setSingletonImageLoaderFactory(kotlin/Function1, androidx.compose.runtime/Composer?, kotlin/Int) // coil3.compose/setSingletonImageLoaderFactory|setSingletonImageLoaderFactory(kotlin.Function1;androidx.compose.runtime.Composer?;kotlin.Int){}[0] diff --git a/coil-compose/api/jvm/coil-compose.api b/coil-compose/api/jvm/coil-compose.api index 8869226c81..f98b0358ac 100644 --- a/coil-compose/api/jvm/coil-compose.api +++ b/coil-compose/api/jvm/coil-compose.api @@ -1,11 +1,11 @@ public final class coil3/compose/SingletonAsyncImageKt { - public static final fun AsyncImage-Vb_qNX0 (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V - public static final fun AsyncImage-gl8XCv8 (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V + public static final fun AsyncImage-10Xjiaw (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V + public static final fun AsyncImage-x1rPTaM (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V } public final class coil3/compose/SingletonAsyncImagePainterKt { - public static final fun rememberAsyncImagePainter-EHKIwbg (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; - public static final fun rememberAsyncImagePainter-HtA5bXE (Ljava/lang/Object;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; + public static final fun rememberAsyncImagePainter-19ie5dc (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILandroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; + public static final fun rememberAsyncImagePainter-MqR-F_0 (Ljava/lang/Object;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Landroidx/compose/ui/graphics/painter/Painter;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/layout/ContentScale;ILandroidx/compose/runtime/Composer;II)Lcoil3/compose/AsyncImagePainter; } public final class coil3/compose/SingletonImageLoadersKt { @@ -13,7 +13,7 @@ public final class coil3/compose/SingletonImageLoadersKt { } public final class coil3/compose/SingletonSubcomposeAsyncImageKt { - public static final fun SubcomposeAsyncImage-J-FEaFM (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Landroidx/compose/runtime/Composer;III)V - public static final fun SubcomposeAsyncImage-OsCPg7o (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLcoil3/compose/EqualityDelegate;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;III)V + public static final fun SubcomposeAsyncImage-gl8XCv8 (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;III)V + public static final fun SubcomposeAsyncImage-nc27qi8 (Ljava/lang/Object;Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;FLandroidx/compose/ui/graphics/ColorFilter;IZLandroidx/compose/runtime/Composer;III)V } diff --git a/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonAsyncImage.kt b/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonAsyncImage.kt index 27ad6e23a7..8e2101b737 100644 --- a/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonAsyncImage.kt +++ b/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonAsyncImage.kt @@ -40,8 +40,6 @@ import coil3.request.ImageRequest * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. * @param clipToBounds If true, clips the content to its bounds. Else, it will not be clipped. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. */ @Composable @NonRestartableComposable @@ -61,7 +59,6 @@ fun AsyncImage( colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DefaultFilterQuality, clipToBounds: Boolean = true, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, ) = AsyncImage( model = model, contentDescription = contentDescription, @@ -79,7 +76,6 @@ fun AsyncImage( colorFilter = colorFilter, filterQuality = filterQuality, clipToBounds = clipToBounds, - modelEqualityDelegate = modelEqualityDelegate, ) /** @@ -104,8 +100,6 @@ fun AsyncImage( * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. * @param clipToBounds If true, clips the content to its bounds. Else, it will not be clipped. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. */ @Composable @NonRestartableComposable @@ -121,7 +115,6 @@ fun AsyncImage( colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DefaultFilterQuality, clipToBounds: Boolean = true, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, ) = AsyncImage( model = model, contentDescription = contentDescription, @@ -135,5 +128,4 @@ fun AsyncImage( colorFilter = colorFilter, filterQuality = filterQuality, clipToBounds = clipToBounds, - modelEqualityDelegate = modelEqualityDelegate, ) diff --git a/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonAsyncImagePainter.kt b/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonAsyncImagePainter.kt index 1968e62730..5525a4b6f9 100644 --- a/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonAsyncImagePainter.kt +++ b/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonAsyncImagePainter.kt @@ -29,8 +29,6 @@ import coil3.request.ImageRequest * to the same value that's passed to [Image]. * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. */ @Composable @NonRestartableComposable @@ -44,7 +42,6 @@ fun rememberAsyncImagePainter( onError: ((State.Error) -> Unit)? = null, contentScale: ContentScale = ContentScale.Fit, filterQuality: FilterQuality = DefaultFilterQuality, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, ) = rememberAsyncImagePainter( model = model, imageLoader = SingletonImageLoader.get(LocalPlatformContext.current), @@ -56,7 +53,6 @@ fun rememberAsyncImagePainter( onError = onError, contentScale = contentScale, filterQuality = filterQuality, - modelEqualityDelegate = modelEqualityDelegate, ) /** @@ -73,8 +69,6 @@ fun rememberAsyncImagePainter( * to the same value that's passed to [Image]. * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. */ @Composable @NonRestartableComposable @@ -84,7 +78,6 @@ fun rememberAsyncImagePainter( onState: ((State) -> Unit)? = null, contentScale: ContentScale = ContentScale.Fit, filterQuality: FilterQuality = DefaultFilterQuality, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, ) = rememberAsyncImagePainter( model = model, imageLoader = SingletonImageLoader.get(LocalPlatformContext.current), @@ -92,5 +85,4 @@ fun rememberAsyncImagePainter( onState = onState, contentScale = contentScale, filterQuality = filterQuality, - modelEqualityDelegate = modelEqualityDelegate, ) diff --git a/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonSubcomposeAsyncImage.kt b/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonSubcomposeAsyncImage.kt index 68667adbf6..63b923555a 100644 --- a/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonSubcomposeAsyncImage.kt +++ b/coil-compose/src/commonMain/kotlin/coil3/compose/SingletonSubcomposeAsyncImage.kt @@ -43,8 +43,6 @@ import coil3.request.ImageRequest * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. * @param clipToBounds If true, clips the content to its bounds. Else, it will not be clipped. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. */ @Composable @NonRestartableComposable @@ -65,7 +63,6 @@ fun SubcomposeAsyncImage( colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DefaultFilterQuality, clipToBounds: Boolean = true, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, ) = SubcomposeAsyncImage( model = model, contentDescription = contentDescription, @@ -82,9 +79,8 @@ fun SubcomposeAsyncImage( contentScale = contentScale, alpha = alpha, colorFilter = colorFilter, - clipToBounds = clipToBounds, - modelEqualityDelegate = modelEqualityDelegate, filterQuality = filterQuality, + clipToBounds = clipToBounds, ) /** @@ -112,8 +108,6 @@ fun SubcomposeAsyncImage( * @param filterQuality Sampling algorithm applied to a bitmap when it is scaled and drawn into the * destination. * @param clipToBounds If true, clips the content to its bounds. Else, it will not be clipped. - * @param modelEqualityDelegate Determines the equality of [model]. This controls whether this - * composable is redrawn and a new image request is launched when the outer composable recomposes. * @param content A callback to draw the content inside a [SubcomposeAsyncImageScope]. */ @Composable @@ -130,7 +124,6 @@ fun SubcomposeAsyncImage( colorFilter: ColorFilter? = null, filterQuality: FilterQuality = DefaultFilterQuality, clipToBounds: Boolean = true, - modelEqualityDelegate: EqualityDelegate = DefaultModelEqualityDelegate, content: @Composable SubcomposeAsyncImageScope.() -> Unit, ) = SubcomposeAsyncImage( model = model, @@ -145,6 +138,5 @@ fun SubcomposeAsyncImage( colorFilter = colorFilter, filterQuality = filterQuality, clipToBounds = clipToBounds, - modelEqualityDelegate = modelEqualityDelegate, content = content, ) diff --git a/samples/compose/src/commonMain/kotlin/sample/compose/App.kt b/samples/compose/src/commonMain/kotlin/sample/compose/App.kt index 0635dc464a..82ddc021f8 100644 --- a/samples/compose/src/commonMain/kotlin/sample/compose/App.kt +++ b/samples/compose/src/commonMain/kotlin/sample/compose/App.kt @@ -1,5 +1,6 @@ package sample.compose +import androidx.compose.foundation.Image import androidx.compose.foundation.clickable import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Box @@ -42,9 +43,12 @@ import coil3.compose.LocalPlatformContext import coil3.compose.setSingletonImageLoaderFactory import coil3.memory.MemoryCache import coil3.request.ImageRequest +import coil3.request.crossfade import coil3.util.component1 import coil3.util.component2 import io.coil_kt.coil3.compose.generated.resources.Res +import kotlinx.coroutines.delay +import kotlinx.coroutines.flow.flow import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.MissingResourceException import sample.common.AssetType @@ -66,7 +70,7 @@ fun App() { LaunchedEffect(viewModel) { viewModel.start() } - App(viewModel, debug = false) + App(viewModel, debug = true) } @Composable @@ -189,15 +193,51 @@ private fun ScaffoldContent( @Composable private fun DetailScreen(screen: Screen.Detail) { + val testFlow = remember { + flow { + var count = 0 + while (true) { + delay(1000) + emit(count++) + } + } + } + + val value by testFlow.collectAsState(0) + println("VALUE ${value / 10}") + + val context = LocalPlatformContext.current AsyncImage( - model = ImageRequest.Builder(LocalPlatformContext.current) + model = ImageRequest.Builder(context) .data(screen.image.uri) .placeholderMemoryCacheKey(screen.placeholder) + .memoryCacheKey("${value / 10}") .extras(screen.image.extras) + .crossfade(true) .build(), contentDescription = null, modifier = Modifier.fillMaxSize(), ) + +// val context = LocalPlatformContext.current +// val painter = rememberAsyncImagePainter( +// model = remember { +// ImageRequest.Builder(context) +// .data(screen.image.uri) +// .placeholderMemoryCacheKey(screen.placeholder) +// .memoryCacheKey("${value / 10}") +// .extras(screen.image.extras) +// .crossfade(true) +// .build() +// } +// ) +// Image( +// painter = painter, +// contentDescription = null, +// modifier = Modifier.fillMaxSize(), +// ) +// +// println("PAINTER STATE = ${painter.state.collectAsState().value}") } @Composable