Repository navigation
Conversation
Contributor
|
@kyzer1023 is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
flatten_rgba_to_rgb_over_whitebuilt its output with a per-pixelextend_from_slice. It now allocatesvec![0u8; rgba.len() / 4 * 3]once and writes each pixel intodst[i..i + 3], using the same three alpha branches and the same blend.rgba_to_rgbandencode_jpeg_rgba_as_rgbare untouched.Files:
apps/desktop-gpui/kernels/src/codec.rsand a bench case inapps/desktop-gpui/kernels/benches/frame_export.rs. Based onmainat85219015.Correctness
Output is byte-identical to the old loop for opaque, fully transparent, and mixed-alpha buffers, including a hand-checked
alpha == 128pixel.cap-gpui-kernelslib tests: 42 passed, 1 ignored, on rustc 1.88.0 and 1.99.1. The full desktop-gpui app was not built here because gpui is patched to a localzed-capcheckout.Benchmarks
Measured under the profile desktop-gpui ships with (its own workspace:
opt-level = 3,lto = "thin",codegen-units = 1,strip = "symbols"), rustc 1.99.1, 4 vCPU. Each run is 5 warmups and the median of 25 samples; the table is the median of 5 runs. 3840×2160.Opaque frames (the common share case) and transparent frames are faster. Mixed alpha is about 2% slower on stable and flat on 1.88.0.
Overlap
Does not touch
rgba_to_rgb/encode_jpeg_rgba_as_rgb(#2672) or PNG filtering (#2674).

Confidence Score: 5/5
This PR appears safe to merge; no actionable issues were found.Summary
flatten_rgba_to_rgb_over_whitenow sizes the RGB buffer upfront and writes pixels into it directly.No actionable issues found. Tests and benchmarks were inspected, not run.
Reviews (1) · Last reviewed commit: "perf(desktop-gpui): presize flattened RG..." · Reviewed by Greptile