-
Notifications
You must be signed in to change notification settings - Fork 102
Add support for frame rate voting #2205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/node/RootNodeOwner.skiko.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/OwnedLayerManager.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/node/RootNodeOwner.skiko.kt
Outdated
Show resolved
Hide resolved
...ose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/GraphicsLayerOwnerLayer.skiko.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/PlatformContext.skiko.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/node/RootNodeOwner.skiko.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/node/RootNodeOwner.skiko.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/PlatformContext.skiko.kt
Show resolved
Hide resolved
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/OwnedLayerManager.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/node/RootNodeOwner.skiko.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general, just a few nitpicks/polishing/missing tests
| if (frameRate.isNaN() || frameRate < currentFrameRateCategory) { | ||
| currentFrameRateCategory = frameRate | ||
| } | ||
| } else if (frameRate < currentFrameRateCategory || (frameRate.isNaN() && isCurrentFrameRateCategoryUnset)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isNaN check should be done before comparison
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that the comparison would return false is frameRate.isNaN() == true or is that a convention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NaNis considered greater than any other element includingPOSITIVE_INFINITY
Found that statement, but it needs to be checked. Anyway, checking NaN before is safer anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that. Thanks!
|
LGTM, waiting for tests |
cffa3e7 to
b9e59d9
Compare
| ) | ||
| } | ||
|
|
||
| protected open val platformContext: PlatformContext get() = TestContext() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: It's public APIs for users. I'm not sure that we really want to expose it (even as experimental)
cc @m-sasha as owner of this API
compose/ui/ui/src/uikitInstrumentedTest/kotlin/androidx/compose/ui/modifiers/FrameRateTest.kt
Outdated
Show resolved
Hide resolved
| @Test | ||
| fun testNoVotedFrameRate() = runTest { | ||
| val surface = Surface.makeRasterN32Premul(100, 100) | ||
| val owner = RootNodeOwner( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As alternative: Use scene to test integration with public modifiers API. Since finding nodes/"clicking" is problematic, changes can be done via direct setting state values and re-drawing scene.
Not blocking because of it.
...e/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeHostingViewController.uikit.kt
Outdated
Show resolved
Hide resolved
...e/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeHostingViewController.uikit.kt
Outdated
Show resolved
Hide resolved
0c1a786 to
e1bdda7
Compare
In this PR:
Fixes - https://youtrack.jetbrains.com/issue/CMP-7802
Testing
This should be tested by QA
Release Notes
Features - iOS