Don't create a derived State for Element.drawScale
This CL removes the derived State that is used for the drawScale of the
element. This paves the way towards using the new Modifier Node API and
remove calls to `Modifier.compose {}`.
Bug: 291566282
Test: atest PlatformComposeSceneTransitionLayoutTests
Flag: NA
Change-Id: I1b9853386a3f40cea7240ab31248a5384ab84fa3
diff --git a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Element.kt b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Element.kt
index 6153e19..c01d32e 100644
--- a/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Element.kt
+++ b/packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/Element.kt
@@ -18,7 +18,6 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
-import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.movableContentOf
import androidx.compose.runtime.mutableStateOf
@@ -155,20 +154,16 @@
}
}
- val drawScale by
- remember(layoutImpl, element, scene, sceneValues) {
- derivedStateOf { getDrawScale(layoutImpl, element, scene, sceneValues) }
- }
-
drawWithContent {
if (shouldDrawElement(layoutImpl, scene, element)) {
+ val drawScale = getDrawScale(layoutImpl, element, scene, sceneValues)
if (drawScale == Scale.Default) {
- this@drawWithContent.drawContent()
+ drawContent()
} else {
scale(
drawScale.scaleX,
drawScale.scaleY,
- if (drawScale.pivot.isUnspecified) center else drawScale.pivot
+ if (drawScale.pivot.isUnspecified) center else drawScale.pivot,
) {
this@drawWithContent.drawContent()
}