Repository navigation
Conversation
Screenshot save and copy encoded RGBA through the single-threaded image PNG encoder. encode_png_rgba now calls png::encode (level 6, parallel strips), the same path write_png_file uses for Default + Adaptive compression.
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
encode_png_rgba(used by screenshot save, copy, transparent share, and the screenshot editor's PNG export) went through theimagecrate's single-threaded PNG encoder. It now calls the in-treepng::encode(zlib level 6, parallel strips), the same pathwrite_png_filealready uses for default compression with adaptive filtering. TheCompressionType::Fastcapture path is unchanged.One commit, one file:
apps/desktop-gpui/kernels/src/codec.rs. Based onmainat85219015c.Correctness
Decoded pixels match the previous encoder.
cargo +stable test -p cap-gpui-kernelspasses (41 tests), including a 16×16 frame of every alpha value (the patternunannotated_composite_and_copy_preserve_all_alpha_valuesencodes) and the existing 3024×1964 strip round trip. PNG size stays within about 0.1%.The full desktop-gpui binary was not built here because gpui is patched to a local
zed-capcheckout.Benchmarks
kernels/benches/png_encode.rs, stable rustc 1.99.1, release, 4 vCPU. Bench median of 10 samples; the bench asserts decoded pixels equal the source.UI-like RGBA (toolbar, solid window, translucent edge), median of five runs:
Detailed RGBA (
screen_like), two runs:Flat frames have less deflate work, so the gain is smaller there. More cores should widen the gap (the writer uses up to 8 strips).
Overlap
Does not touch
filter_rows/ adaptive filter code (#2674),rgba_to_rgb/encode_jpeg_rgba_as_rgb(#2672), or capturewrite_png(#2703).

Confidence Score: 5/5
This PR appears safe to merge; no actionable issues were found.Summary
encode_png_rgbanow uses the existing parallel PNG writer for screenshot save, copy, transparent share, and PNG export.Reviews (1) · Last reviewed commit: "perf(desktop-gpui): encode screenshot PN..." · Reviewed by Greptile