forked from androidx/androidx
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes JetBrains/compose-multiplatform#4870 ## Release Notes ### Features - Desktop - Add constructor with `reducePresentationLatency` to `ComposePanel`. Setting this flag to `true` gives a hint to renderer implementation to reduce the latency between the input and visual changes in exchange for possible screen tearing. --------- Co-authored-by: Ivan Matkov <ivan.matkov@jetbrains.com>
- Loading branch information
1 parent
6cc30a4
commit 03d732f
Showing
10 changed files
with
113 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/RenderingSettings.desktop.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2024 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package androidx.compose.ui.awt | ||
|
||
import androidx.compose.ui.ExperimentalComposeUiApi | ||
import androidx.compose.ui.ComposeFeatureFlags | ||
import org.jetbrains.skiko.SkikoProperties | ||
|
||
/** | ||
* Configuration class for rendering settings. | ||
* | ||
* @property isVsyncEnabled Indicates whether presentation vsync is enabled or not | ||
* When true, the internal implementation will attempt to synchronize drawable presentations | ||
* with vsync. It guarantees that the frame is presented without visual artifacts like tearing in | ||
* exchange for a latency increase. | ||
* When false, the internal implementation will not attempt to synchronize drawable presentations | ||
* it can reduce latency but may introduce visual artifacts like screen tearing. | ||
* When null, the internal implementation will use the global configuration from [SkikoProperties.vsyncEnabled] | ||
* | ||
* This flag has no effect if [ComposeFeatureFlags.useSwingGraphics] is true. In this case Compose | ||
* will render the content to Swing provided offscreen buffer and the presentation will be controlled | ||
* by Swing. | ||
*/ | ||
@ExperimentalComposeUiApi | ||
class RenderSettings( | ||
val isVsyncEnabled: Boolean? | ||
) { | ||
companion object { | ||
/** | ||
* Default rendering settings | ||
*/ | ||
val Default = RenderSettings( | ||
isVsyncEnabled = null | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters