Skip to content

PANA-5027: Support svgs with navigation3#3027

Merged
jonathanmos merged 5 commits into
developfrom
jmoskovich/PANA-5027/fix-alpha8
Dec 4, 2025
Merged

PANA-5027: Support svgs with navigation3#3027
jonathanmos merged 5 commits into
developfrom
jmoskovich/PANA-5027/fix-alpha8

Conversation

@jonathanmos

@jonathanmos jonathanmos commented Nov 26, 2025

Copy link
Copy Markdown
Member

What does this PR do?

Navigation3 bumps the compose-ui dependency to 1.9. Whereas previously we could get argb8888 from vectorDrawables with version 1.5, with 1.9 we get alpha8. In this pr, we convert the alpha8 mask into a grayscale bitmap, using the alpha transparency to set the level of gray. This means we lose color information but we have a performant method to keep supporting svgs.

To improve performance, we don't want to generate bitmaps from alpha8 on every recomposition. We therefore sample 16 horizontal and vertical or 256 alpha value points from every alpha8 in order to create a fast and accurate signature and use that to determine whether we have seen that svg before and whether a bitmap should be generated. This method is resistant to instance or id change of the svg, doesn't rely on unreliable internal metadata, and should have a minimal risk of collisions. The signature to resourceId is maintained in an lrucache similar to what exists for native bitmaps.

@jonathanmos jonathanmos force-pushed the jmoskovich/PANA-5027/fix-alpha8 branch from 2c9ea68 to d9ee674 Compare November 26, 2025 14:42
@datadog-official

datadog-official Bot commented Nov 26, 2025

Copy link
Copy Markdown

🎯 Code Coverage
Patch Coverage: 68.66%
Total Coverage: 71.30% (-0.04%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0b7cdaa | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@codecov-commenter

codecov-commenter commented Nov 26, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.67769% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.15%. Comparing base (cf41629) to head (0b7cdaa).
⚠️ Report is 75 commits behind head on develop.

Files with missing lines Patch % Lines
...lay/internal/recorder/resources/BitmapConverter.kt 18.18% 17 Missing and 1 partial ⚠️
...nal/recorder/resources/BitmapSignatureGenerator.kt 21.74% 15 Missing and 3 partials ⚠️
...ay/internal/recorder/resources/ResourceResolver.kt 86.11% 3 Missing and 2 partials ⚠️
...rnal/mappers/semantics/ImageSemanticsNodeMapper.kt 0.00% 4 Missing ⚠️
...ionreplay/compose/internal/utils/SemanticsUtils.kt 66.67% 0 Missing and 3 partials ⚠️
...internal/recorder/resources/Alpha8ResourceCache.kt 90.91% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3027      +/-   ##
===========================================
- Coverage    71.19%   71.15%   -0.04%     
===========================================
  Files          859      862       +3     
  Lines        31443    31543     +100     
  Branches      5302     5319      +17     
===========================================
+ Hits         22383    22443      +60     
- Misses        7560     7590      +30     
- Partials      1500     1510      +10     
Files with missing lines Coverage Δ
...nreplay/internal/recorder/SessionReplayRecorder.kt 95.45% <100.00%> (+0.14%) ⬆️
...internal/recorder/resources/Alpha8ResourceCache.kt 90.91% <90.91%> (ø)
...ionreplay/compose/internal/utils/SemanticsUtils.kt 68.92% <66.67%> (+0.80%) ⬆️
...rnal/mappers/semantics/ImageSemanticsNodeMapper.kt 8.00% <0.00%> (ø)
...ay/internal/recorder/resources/ResourceResolver.kt 77.66% <86.11%> (+0.28%) ⬆️
...lay/internal/recorder/resources/BitmapConverter.kt 18.18% <18.18%> (ø)
...nal/recorder/resources/BitmapSignatureGenerator.kt 21.74% <21.74%> (ø)

... and 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jonathanmos jonathanmos marked this pull request as ready for review November 27, 2025 12:28
@jonathanmos jonathanmos requested review from a team as code owners November 27, 2025 12:28
@jonathanmos jonathanmos force-pushed the jmoskovich/PANA-5027/fix-alpha8 branch 2 times, most recently from 2307cc6 to 103eaa7 Compare November 30, 2025 23:28
@jonathanmos jonathanmos force-pushed the jmoskovich/PANA-5027/fix-alpha8 branch 2 times, most recently from 0948195 to 00e7a04 Compare December 1, 2025 13:33
@jonathanmos jonathanmos force-pushed the jmoskovich/PANA-5027/fix-alpha8 branch from 00e7a04 to 3823714 Compare December 1, 2025 15:17
0xnm
0xnm previously approved these changes Dec 2, 2025
@jonathanmos jonathanmos force-pushed the jmoskovich/PANA-5027/fix-alpha8 branch from ec3cd85 to 0b7cdaa Compare December 3, 2025 09:57
@jonathanmos jonathanmos merged commit d2a2ec9 into develop Dec 4, 2025
26 checks passed
@jonathanmos jonathanmos deleted the jmoskovich/PANA-5027/fix-alpha8 branch December 4, 2025 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants