From f6f427b170da21d2bc71a62b0a431dcc1fdbe8f6 Mon Sep 17 00:00:00 2001 From: tapframe <85391825+tapframe@users.noreply.github.com> Date: Tue, 9 Jun 2026 16:20:14 +0530 Subject: [PATCH] ref: image scal;ing gate to windows --- .../nuvio/app/core/ui/NuvioAsyncImage.desktop.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/composeApp/src/desktopMain/kotlin/com/nuvio/app/core/ui/NuvioAsyncImage.desktop.kt b/composeApp/src/desktopMain/kotlin/com/nuvio/app/core/ui/NuvioAsyncImage.desktop.kt index 83e76808..24d3d73d 100644 --- a/composeApp/src/desktopMain/kotlin/com/nuvio/app/core/ui/NuvioAsyncImage.desktop.kt +++ b/composeApp/src/desktopMain/kotlin/com/nuvio/app/core/ui/NuvioAsyncImage.desktop.kt @@ -36,6 +36,11 @@ private const val MinCustomDownscaleRatio = 1.08f private const val MaxDesktopSourceSizePx = 1536 private const val MaxScaledBitmapPixels = 1_250_000L +private val IsWindowsDesktop: Boolean = + System.getProperty("os.name") + ?.startsWith("Windows", ignoreCase = true) + ?: false + @Composable internal actual fun NuvioAsyncImage( model: Any?, @@ -56,8 +61,11 @@ internal actual fun NuvioAsyncImage( desktopImageScaling: NuvioDesktopImageScaling, ) { val context = LocalPlatformContext.current - val requestModel = remember(context, model, desktopImageScaling) { - if (desktopImageScaling == NuvioDesktopImageScaling.Disabled) { + val effectiveDesktopImageScaling = remember(desktopImageScaling) { + if (IsWindowsDesktop) desktopImageScaling else NuvioDesktopImageScaling.Disabled + } + val requestModel = remember(context, model, effectiveDesktopImageScaling) { + if (effectiveDesktopImageScaling == NuvioDesktopImageScaling.Disabled) { model } else { model.withDesktopHighQualitySize(context) @@ -67,7 +75,7 @@ internal actual fun NuvioAsyncImage( placeholder, error, fallback, - desktopImageScaling, + effectiveDesktopImageScaling, ) { { state -> when (state) { @@ -75,7 +83,7 @@ internal actual fun NuvioAsyncImage( placeholder?.let { state.copy(painter = it) } ?: state } is AsyncImagePainter.State.Success -> { - state.result.image.toScaledBitmapPainter(desktopImageScaling) + state.result.image.toScaledBitmapPainter(effectiveDesktopImageScaling) ?.let { state.copy(painter = it) } ?: state }