Repository navigation
fix(desktop-gpui): preserve translucent pixels in mask-only exports - #3244
Merged
richiemcilroy merged 1 commit intoOct 25, 2026
Merged
Conversation
Contributor
|
@himanshu748 is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
himanshu748
marked this pull request as ready for review
October 25, 2026 13:30
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Mask-only screenshot exports currently premultiply and demultiply the entire canvas even though the shape/text draw loop skips every annotation. Besides unnecessary work, that round trip changes translucent pixels outside the privacy mask:
[17, 30, 77, 1]becomes[0, 0, 0, 1]. Even an entirely off-canvas mask triggers it.Skip that draw stage when the annotation list contains only masks. Mask filtering still runs before it; shape/text exports retain their existing path. The production change is six lines.
Three regression tests cover all alpha values, an off-canvas mask, actual pixelation with untouched translucent pixels outside the mask, and mixed mask/rectangle drawing. All three fail on the original implementation and pass with this change.
CPU benchmark
One on-canvas 256×256 pixelate mask at level 16, on synthetic opaque images or images with a 32-pixel translucent border. Linux x86_64 KVM guest, AMD EPYC 7763, rustc 1.99.1, release thin LTO and one codegen unit. Before and after production compositors ran in the same executable with alternating order, five warmups and 30 measured samples, repeated three times. Times below are medians of the three run medians.
Opaque outputs are asserted byte-identical. Translucent outputs intentionally change to preserve original colors; the benchmark asserts preservation outside the mask. These measurements cover CPU composition only, excluding GPU rendering, PNG encoding, disk and native UI. They are not macOS or end-to-end export timings.
The standalone ignored test also confirmed the improvement, but absolute timings differed from the paired harness (4K translucent border: 49.161 → 39.436 ms). Treat the table as the paired synthetic benchmark, not an exact export-latency prediction.
The added ignored test reproduces these workloads against the checked-out revision:
Validation and limitations
screenshot_export.rstest module in an isolated Linux harness using actual project types, pixel kernels, tiny-skia, cosmic-text and extracted production geometry/color helpers. Patched: 12 passed, 2 benchmarks ignored; baseline: 9 passed and the three new regressions fail. The new ignored benchmark was also run separately on both revisions and passed.0983901353c759f4857520afdfdc5fe12b2ff19a.git diff --checkpass. Workspace formatting reports existing differences in untouched files.zed-capdependency and Cap's six patches; locked Cargo dependencies were fetched as well. The subsequent localcargo check --locked --offlineexited atalsa-sysbecausepkg-configcould not findalsa.pc(the required ALSA development package). No interactive application or macOS performance measurement was performed here.7c6102c12f4abcf6c95a98c42d31289c404afcf0.This follows the empty-annotation optimization in #2493 and is compatible with #2742's draw-call relocation. It does not change the frame-copy work in #3138.


Confidence Score: 5/5
The PR appears safe to merge.Summary
Preserves translucent colors in mask-only screenshot exports by skipping an unnecessary alpha conversion.
No actionable issues found. Review was based on code inspection; no tests or benchmarks were run.
Reviews (1) · Last reviewed commit: "fix(desktop-gpui): preserve translucent ..." · Reviewed by Greptile