You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I drag the window from my main display (2560x1600) to my secondary one (2560 x 1440), the Icon composable is duplicated and is shown at another size. It looks fine when I drag it back to the first screen though.
(or other any component that uses DrawCache)
FixesJetBrains/compose-multiplatform#677
When density changes - the current size changes
(for example, `previousDrawSize` is 200 and `size` is 100)
and `drawCachedImage` calls.
And when we call `drawCachedImage` - we call `clear` with this
new passed size (100) instead of the size of bitmap (200).
So the bitmap draws with the previous drawn content.
Now we draw only part of the bitmap - with the passed to cache size.
```
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Icon
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Refresh
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.Density
import kotlinx.coroutines.delay
@composable
fun App() {
var density by remember { mutableStateOf(2f) }
LaunchedEffect(Unit) {
delay(1000)
density = 1f
}
Box(Modifier.fillMaxSize()) {
CompositionLocalProvider(LocalDensity provides Density(density)) {
Icon(
imageVector = Icons.Default.Refresh,
contentDescription = null
)
}
}
}
```
Test: manual (see code above)
Test: ./gradlew buildOnServer
Change-Id: Ib4a1ec9037eefd355c27ffb871a0bd7ca0693b6b
When I drag the window from my main display (2560x1600) to my secondary one (2560 x 1440), the
Icon
composable is duplicated and is shown at another size. It looks fine when I drag it back to the first screen though.I'm on Compose version
0.4.0-build190
.MInimal repro code:
The text was updated successfully, but these errors were encountered: