forked from androidx/androidx
-
Notifications
You must be signed in to change notification settings - Fork 154
Introduces several caching of objects across graphics Skiko code #3117
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
Closed
Apolo (ApoloApps)
wants to merge
121
commits into
JetBrains:jb-main
from
ApoloApps:followupMatrixSkiko
Closed
Changes from 8 commits
Commits
Show all changes
121 commits
Select commit
Hold shift + click to select a range
de99b4e
Cache Matrix class in SkiaBackedPath to mimic Android behaviour
ApoloApps 250ac4d
Cache RoundedRect FloatArray object to avoid allocating it each time.…
ApoloApps 78e6ee1
Add toFloatArray method that avoids iterator allocation (compiles to …
ApoloApps 329ba77
Adds CanvasHolder class to avoid creating a new SkiaBackedCanvas obje…
ApoloApps ebc198a
Merge branch 'jb-main' into followupMatrixSkiko
ApoloApps eddb40b
Fix after rebase
ApoloApps fd6b122
Avoid Rect allocations on extremely hot paths. (each frame, single or…
ApoloApps 211369e
Reduce number of copies in SyntheticEventSender and use Primitive Col…
ApoloApps 9db20d7
Change comment mentioning Android Canvas
ApoloApps 56f34cf
Fix crash in method setComposingRegion (#3112)
ASalavei 3b98945
Update iOS version in GH actions (#3115)
janinadavydova a0a2e85
Fix lifecycle state handling for ComposeContainer (#3118)
ASalavei 694a400
Fix incorrect frames order on high load (#3122)
ASalavei 56920dc
Extend compose ios instrumented tests runners matrix (#3125)
svastven 400f7af
`DeprecationLevel.ERROR` for skiko-specific types in ui-graphics API …
MatkovIvan b19a6f4
iOS instrumented tests for textfield menu items availability (#3129)
janinadavydova edc0857
Align frame snapshot/invalidation with Android's model (#3096)
MatkovIvan fccbf4e
Web: Enhance scroll behavior by distinguishing trackpad gestures and …
terrakok 869255f
Removed caret snapping inside grapheme clusters hack (#3049)
mazunin-v-jb 93b3ad1
Update skiko to 0.149.0 (#3124)
hub-bla 4a60e33
Fix iOS 26 swipe-back conflict with horizontal Compose scrollables (#…
svastven 65d526d
[web] style backing field inputs in shadow css definitions (#3133)
Schahen 34e7fbf
Copy lifecycle from f68fb752573
igordmn 5432759
artifactRedirection.version.androidx.lifecycle=2.11.0
igordmn 272adbe
Web: Fix Safari wheel event (#3135)
terrakok e69ba78
Copy compose-material3 from fb82b6431c9
igordmn dee46c0
artifactRedirection.version.androidx.compose.material3=1.5.0-alpha22
igordmn 7a55736
SkikoMenu. Get rid of transformOriginState
igordmn 37f90c6
Dump API
igordmn 38b9288
Fix ExposedDropdownMenuTest.edm_withScrolledContent
igordmn 9ad050b
Fix testFocusableAboveKeyboardInModalBottomSheet on iOS
igordmn 642ca62
Update skiko to 0.150.0 (#3138)
hub-bla d82f0c1
Copy compose from 4b6028d232d
igordmn ac7baac
Stub ":appcompat:appcompat" Android project
igordmn ca5ea98
Dump API
igordmn 989c9b1
Fix Modifier.textFieldOverlay
igordmn bd4f401
compose:ui: Disable isTriggerMoveEventsWhenLocationHasNotChangedEnabled
XSJoJo aadd326
Copy navigation3 from 1f0933dbe56
igordmn 5693eba
artifactRedirection.version.androidx.navigation3=1.2.0-alpha03
igordmn 28c7756
Change the native keyCode for `Key.NumPadDot` to `KeyEvent.VK_DECIMAL…
m-sasha 655390a
Remove `SkikoSelectionModifierElement` (#3141)
m-sasha bf4631b
Implement `GraphicsLayer.setOutsets` for non-Android platforms (#3144)
MatkovIvan b8752a7
Fix some event-dispatching tests and move them into a separate file (…
m-sasha 358b728
Web: deliver both scroll axes in wheel events (fix diagonal scroll) (…
terrakok 22ce9a3
Introduce `ComposeDesktopEntryPoint` interface (#3140)
m-sasha ae753e6
Fix skiko text helpers visibility (#3150)
MatkovIvan 25bffda
Support `MeshGradientPainter` in `Modifier.paint` (#3143)
MatkovIvan 2ba56cc
Fix invalidation during removing the layer (#3146)
MatkovIvan e1d75f3
Implement `PrefetchScheduler` for iOS (#3149)
svastven e89db56
Remove old/unused publications (#3151)
MatkovIvan 192c90b
Retry loading fallback fonts in case of network errors (#3152)
terrakok 7c9e6ef
Support Locale and Verbatim VoiceOver annotation (#3145)
ASalavei eebc779
artifact redirection rework (#3121)
shishkin-pavel f7487a8
Fix coordinate conversion for WINDOW layers (#3154)
MatkovIvan c13a064
Refactor frame rate voting management (#3148)
svastven 68991cc
Check accessibleChild for `null` in `defaultAccessibilityFocusTarget`…
m-sasha 2ea252f
Don't set alwaysOnTop in WindowComposeSceneLayer (#3153)
m-sasha 57ef0b4
Fix printing `GlobalSnapshotManager` concurrent registrations warning…
MatkovIvan b478d81
Poll the system theme in desktop (#3063)
m-sasha 545691b
Remove `foundation` dependency on skiko `SystemTheme` (#3160)
m-sasha 0799f00
Set isClearFocusOnMouseDownEnabled to false by default (#3162)
m-sasha b74c2df
Increase swipe duration (#3161)
svastven 2adbe7c
Fix issue of loading Compose scene inside ComposeHostingViewControlle…
ASalavei fa55d7a
[web] use css min for positioning backing input fields, calc is redun…
Schahen 1c9cfe7
[web] Introduce separate test for composite input which invokes both …
Schahen 6cdb45a
Implement `ComposeDesktopEntryPoint.captureContentToImage` (#3155)
m-sasha 3df4bf6
Implement `SkikoComposeUiTest.runWithoutImplicitWait` (#3168)
m-sasha 0f952f2
Prevent `NavigationDrawer` drags during swipe-back (#3165)
svastven 6e33c7d
(script) Copy settings.gradle
igordmn 25dd987
(script) Copy build-fork.gradle for every project in fork-project/set…
igordmn b2b3e54
(script) Copy buildSrc-fork
igordmn 5bed868
Fork pluginManagement and buildscript in settings.gradle
igordmn 371c223
Use forked build files
igordmn 08ffa9b
(script) copy libs.versions.toml
igordmn 1a22833
Use libs-fork.versions.toml
igordmn bf31387
Fix buildSrc paths in settings-fork.gradle (#3174)
igordmn 997e244
Fix frame drops when dragging scrollable content (#3171)
ASalavei 20569b5
Update skiko to 0.150.1 (#3178)
hub-bla 158e65e
CoreTextField: Trigger relayout when stale fonts are detected in meas…
terrakok 7ae39c9
Add iOS instrumented tests run configuration script (#3173)
svastven 0b0759c
Update skiko to 0.150.1 in the new libs-fork.versions.toml (#3185)
hub-bla 1c86b9a
buildSrc-fork. Fork more files (#3186)
igordmn 9d98832
buildSrc-fork. Remove unused build code. Remove plugins (#3187)
igordmn 7542c5e
Run `GlobalSnapshotManager` on `trampolineDispatcher` (#3175)
MatkovIvan cfa57dc
Do not rely on offscreen layer for outsets handling (#3191)
MatkovIvan 60cab5f
Update back gesture layout direction handling on iOS (#3188)
svastven 4648f4e
Add SelectionContainer iOS instrumented tests (#3113)
janinadavydova 4802b3b
[demo] Update Selection example to toggle the isSelectionAutoScrollEn…
Schahen 77724b3
Fix new line detection in `TextInputHelpers` loop logic for iOS (#3197)
mazunin-v-jb 96134b0
[demo] Introduce isFromHardwareSource - synced label to the BasicText…
Schahen a042eab
Update skiko to `0.151.0-alpha01` (#3204)
MatkovIvan 07c508b
Convert UIKit keyboard animation curve to UIViewAnimationOptions (#3183)
Kyle-Ye 6618df7
Remove pre-iOS 14 compatibility branches (#3180)
svastven e99a7f3
Update wasm Demo run configuration settings (#3093)
ApoloApps 92f811f
Add PrefetchScheduler for Web Platforms (#2928)
ApoloApps 713a8e2
Prevent recursive frame rendering in ComposeSceneMediator (#3206)
ASalavei c196ebe
Migrate to the new skiko web runtime publication (#3210)
terrakok 6c758c5
Add isAlive checks to access accessibility node data (#3205)
ASalavei 3ab5858
Fix `CAFrameRateRangeDefault` unavailable on iOS 14 (#3207)
svastven dc21c06
Window Insets support for Compose for Web (#3202)
terrakok 84023cf
Use single skiko-awt-runtime-all fat jar dependency on Desktop (#3198)
hub-bla facc274
Support OutOfFrameExecutor in Web platform (#2929)
ApoloApps ee871c6
Fix iOS text field focus transfer across scenes (#3203)
Kyle-Ye 145268a
Fix a11y root element having 0×0 dimensions on web (#3035)
spookyvert 7036ba6
Fix a regression in scrolling when ComposeViewport is embedded in HTM…
eymar ee91968
Fix dropped edge taps on iOS (#3209)
svastven 82f4310
Add WebGL2 support check to ComposeWindow for improved error handling…
eymar 2380572
[web] backing fields for inputs are actually contenteditable dom and …
Schahen 6e43138
Add swipe back tests (#3176)
svastven 3dbdf9a
Make web demo full screen and add a loading indicator (#3225)
eymar bb16f00
Use didMoveToWindow callback to start CMPViewController lifecycle (#3…
ASalavei 605c93b
Ensure floating cursor stays within text layout bounds on iOS (#3224)
gavr123456789 567f7a6
Call preventDefault on touch events when Compose consumed correspondi…
eymar c6af05e
Update demo project to use separate skiko-skottie dependencies (#3234)
hub-bla ca8c16f
[web] Reuse same mediaQuery listener logic both for resize and theme …
Schahen 6631afc
Configure karma to wait for skiko.wasm initialization before running …
eymar 4cce5cf
Remove `ComposeUiFlags.useLegacyRenderNodeLayers` flag (#3213)
MatkovIvan b07ce24
UI - optimize object allocations (#3164)
ApoloApps d65f0eb
Adds CanvasHolder class to avoid creating a new SkiaBackedCanvas obje…
ApoloApps 5ebe3d6
Change comment mentioning Android Canvas
ApoloApps a864797
Update ComposeUiTest.skiko.kt after rebase on top of jb-main
ApoloApps File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ import org.jetbrains.skia.Matrix44 | |
| import org.jetbrains.skia.MipmapMode | ||
| import org.jetbrains.skia.Paint as SkPaint | ||
| import org.jetbrains.skia.SamplingMode | ||
| import org.jetbrains.skia.Surface | ||
| import org.jetbrains.skia.impl.use | ||
|
|
||
| @Deprecated( | ||
|
|
@@ -46,13 +47,15 @@ internal actual fun ActualCanvas(image: ImageBitmap): Canvas { | |
| require(!skiaBitmap.isImmutable) { | ||
| "Cannot draw on immutable ImageBitmap" | ||
| } | ||
| return SkiaBackedCanvas(SkCanvas(skiaBitmap)) | ||
| return SkiaBackedCanvas().apply { | ||
| internalSkiaCanvas = SkCanvas(skiaBitmap) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Convert the [org.jetbrains.skia.Canvas] instance into a Compose-compatible Canvas | ||
| */ | ||
| fun SkCanvas.asComposeCanvas(): Canvas = SkiaBackedCanvas(this) | ||
| fun SkCanvas.asComposeCanvas(): Canvas = SkiaBackedCanvas().apply { internalSkiaCanvas = this@asComposeCanvas } | ||
|
|
||
| /** | ||
| * Provides access to the underlying [org.jetbrains.skia.Canvas] instance. | ||
|
|
@@ -75,6 +78,26 @@ val Canvas.skiaCanvas: SkCanvas | |
| val Canvas.nativeCanvas: NativeCanvas | ||
| get() = skiaCanvas | ||
|
|
||
|
|
||
| // Stub canvas instance used to keep the internal canvas parameter non-null during its | ||
| // scoped usage and prevent unnecessary byte code null checks from being generated | ||
| private val EmptyCanvas = Surface.makeNull(1,1).canvas | ||
|
|
||
| /** | ||
| * Holder class that is used to issue scoped calls to a [Canvas] from the framework equivalent | ||
| * canvas without having to allocate an object on each draw call | ||
| */ | ||
| class CanvasHolder { | ||
| @PublishedApi internal val skiaBackedCanvas = SkiaBackedCanvas() | ||
|
|
||
| inline fun drawInto(targetCanvas: SkCanvas, block: Canvas.() -> Unit) { | ||
| val previousCanvas = skiaBackedCanvas.internalSkiaCanvas | ||
| skiaBackedCanvas.internalSkiaCanvas = targetCanvas | ||
| skiaBackedCanvas.block() | ||
| skiaBackedCanvas.internalSkiaCanvas = previousCanvas | ||
| } | ||
| } | ||
|
|
||
| // This was added for internal usage from old render layers (another submodule), | ||
| // but wasn't properly marked as internal. Keep it as deprecated for some time to be safe. | ||
| @InternalComposeApi | ||
|
|
@@ -86,9 +109,12 @@ var Canvas.alphaMultiplier: Float | |
| get() = (this as SkiaBackedCanvas).alphaMultiplier | ||
| set(value) { (this as SkiaBackedCanvas).alphaMultiplier = value } | ||
|
|
||
| internal class SkiaBackedCanvas( | ||
| internal val internalSkiaCanvas: SkCanvas, | ||
| ) : Canvas { | ||
| @PublishedApi | ||
| internal class SkiaBackedCanvas : Canvas { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It wasn't supposed to be exposed. Again, requirement for binary compatibility in a place where we're not ready to do it |
||
|
|
||
| // Keep the internal canvas as a var prevent having to allocate an AndroidCanvas | ||
| // instance on each draw call | ||
| @PublishedApi internal var internalSkiaCanvas: SkCanvas = EmptyCanvas | ||
| internal var alphaMultiplier: Float = 1.0f | ||
|
|
||
| private fun Paint.asSkiaPaintWithAppliedAlphaMultiplier(): SkPaint { | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: a new public-stable API that we'll have to maintain forever