Repository navigation
perf(gpui): reduce screenshot editor startup time - #2703
Open
dovidmoishe wants to merge 2 commits into
Open
dovidmoishe wants to merge 2 commits into
dovidmoishe wants to merge 2 commits into
Conversation
Contributor
|
@dovidmoishe is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
Comment on lines
+204
to
+207
| let image = match cap_recording::screenshot::capture_screenshot(target.clone()).await { | ||
| Ok(image) | ||
| if image.width() <= crate::screenshot_editor::MAX_DIMENSION | ||
| && image.height() <= crate::screenshot_editor::MAX_DIMENSION => |
Contributor
There was a problem hiding this comment.
Large screenshots are not saved
capture_and_write now rejects images over 16,384 pixels in either direction before saving the PNG, even for save-only and clipboard-only captures. If a window spans enough high-resolution displays to exceed that size, the X11 capture path uses its full physical bounds and reaches this check. Previously the PNG was saved even if the editor could not open it; now the user gets neither a file nor a clipboard image.
Keep the size limit at the editor boundary so larger screenshots can still be saved and copied.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/screenshot.rs
Line: 204-207
Comment:
**Large screenshots are not saved**
`capture_and_write` now rejects images over 16,384 pixels in either direction before saving the PNG, even for save-only and clipboard-only captures. If a window spans enough high-resolution displays to exceed that size, the X11 capture path uses its full physical bounds and reaches this check. Previously the PNG was saved even if the editor could not open it; now the user gets neither a file nor a clipboard image.
Keep the size limit at the editor boundary so larger screenshots can still be saved and copied.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Author
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.
Screenshot capture now passes retained pixels directly to the editor, avoiding a second PNG decode and showing an initial preview while GPU rendering initializes.
Adds opt-in experiments for preparing the editor window during capture and warming GPU resources. Hidden preparation is limited to Windows/macOS.
With both experiments enabled and warmed up, capture-to-render median fell from 909ms to 483ms (47%) across four samples per mode.
Validation: 63 screenshot-related tests passed. All four Windows modes passed visibility, export, close, and reopen checks, with identical fresh/reopened exports. Native Linux/macOS testing remains outstanding.


Confidence Score: 5/5
The PR appears safe to merge; the previous large-screenshot saving issue is fixed, and no new blocking issues were found.Summary
Speeds up screenshot editor startup by passing captured pixels directly to the editor.
No new actionable issues were found. Checks were based on source review; native UI checks and tests were not run.
Reviews (2) · Last reviewed commit: "fix(gpui): preserve oversized screenshot..." · Reviewed by Greptile