File tree Expand file tree Collapse file tree 4 files changed +12
-0
lines changed
androidMain/kotlin/com/mr3y/ludi/shared/ui/components
commonMain/kotlin/com/mr3y/ludi/shared/ui
desktopMain/kotlin/com/mr3y/ludi/shared/ui/components Expand file tree Collapse file tree 4 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -3,5 +3,9 @@ package com.mr3y.ludi.shared.ui.components
33import androidx.compose.ui.graphics.ImageBitmap
44import androidx.compose.ui.graphics.asImageBitmap
55import coil3.Bitmap
6+ import coil3.request.ImageRequest
7+ import coil3.request.allowHardware
8+
9+ actual fun ImageRequest.Builder.platformSpecificConfig (allowHardware : Boolean ): ImageRequest .Builder = this .allowHardware(allowHardware)
610
711actual fun Bitmap.asImageBitmap (): ImageBitmap = this .asImageBitmap()
Original file line number Diff line number Diff line change @@ -23,13 +23,15 @@ fun LudiAsyncImage(
2323 contentScale : ContentScale = ContentScale .Fit ,
2424 alignment : Alignment = Alignment .Center ,
2525 customMemoryCacheKey : String? = null,
26+ allowBitmapHardware : Boolean = true,
2627 filterQuality : FilterQuality = FilterQuality .Low
2728) {
2829 val context = LocalPlatformContext .current
2930 coil3.compose.AsyncImage (
3031 model = ImageRequest .Builder (context)
3132 .data(url)
3233 .memoryCacheKey(customMemoryCacheKey)
34+ .platformSpecificConfig(allowBitmapHardware)
3335 .build(),
3436 contentDescription = contentDescription,
3537 transform = { state ->
@@ -47,4 +49,6 @@ fun LudiAsyncImage(
4749 )
4850}
4951
52+ expect fun ImageRequest.Builder.platformSpecificConfig (allowHardware : Boolean ): ImageRequest .Builder
53+
5054expect fun Bitmap.asImageBitmap (): ImageBitmap
Original file line number Diff line number Diff line change @@ -165,6 +165,7 @@ fun TrendingGameCard(
165165 contentDescription = null ,
166166 // Set a custom memory cache key to avoid overwriting the displayed image in the cache
167167 customMemoryCacheKey = " $imageUrl .palette" ,
168+ allowBitmapHardware = false ,
168169 contentScale = ContentScale .Crop ,
169170 alignment = rememberParallaxAlignment(lazyListState, key = game?.id)
170171 )
Original file line number Diff line number Diff line change @@ -3,5 +3,8 @@ package com.mr3y.ludi.shared.ui.components
33import androidx.compose.ui.graphics.ImageBitmap
44import androidx.compose.ui.graphics.asComposeImageBitmap
55import coil3.Bitmap
6+ import coil3.request.ImageRequest
7+
8+ actual fun ImageRequest.Builder.platformSpecificConfig (allowHardware : Boolean ): ImageRequest .Builder = this
69
710actual fun Bitmap.asImageBitmap (): ImageBitmap = this .asComposeImageBitmap()
You can’t perform that action at this time.
0 commit comments