Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba469660 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

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
parent cb1adc75
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.compose.animation.scene

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 @@ internal fun Modifier.element(
        }
    }

    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()
                    }