Repository navigation
fix(capture): turn 90° and 270° output captures upright for Freeze and Zoom - #448
Merged
Merged
Conversation
…d Zoom A screencopy frame holds the output's framebuffer: the logical image with the output transform already applied. For a 90° output, that is the content rotated 90° counter-clockwise, and ext-image-copy-capture reports the same transform for its frames. Painting the frame on the logical overlay needs the inverse transform, but transformed_coords applied the transform itself. 180° and the four flipped transforms are their own inverses, so only 90° and 270° were wrong: they were rotated a second quarter turn in the same direction, and the frozen or zoomed screen came out upside down. The 270° Hyprland case from #178 had the same inverted rotation. Swap the 90° and 270° mappings, and document that screencopy frames are assumed to be in framebuffer orientation. Hyprland 0.57 and newer render screencopy frames upright while wl_output still advertises the rotation, so Freeze and Zoom still turn those frames a second time. That is unchanged here; ext-image-copy- capture reports each frame's own transform and would avoid it. A new test compares all eight transforms against grim's out2com composition, with padded SHM rows, both y_invert values, and the output size and stride. It fails without the fix. The existing 90°, 270°, and rotated-crop tests had locked in the wrong direction and are corrected. Fixes #446
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.
Fixes #446.
On an output rotated 90° (niri,
wlr-randr --output … --transform 90),wayscriber --active --freezeshowed the frozen screen upside down. Annotations drawn on top stayed upright.A screencopy frame holds the output's framebuffer: the logical image with the output transform already applied. For 90°, that is the content rotated 90° counter-clockwise. To paint it on the logical overlay, Wayscriber must apply the inverse transform, but
transformed_coordsapplied the transform itself. 180° and the four flipped transforms are their own inverses, so they were already correct. 90° and 270° were rotated the wrong way, and two quarter turns in the same direction leave the image upside down. The 270° Hyprland case from #178 had the same inverted rotation.Changes:
transformed_coordsswaps the 90° and 270° mappings. Freeze and Zoom now rotate screencopy andext-image-copy-captureframes back to the logical orientation, and crops of the frozen or zoom image read the upright raster.with_output_transformdocs say it undoes the compositor's transform, and state that screencopy frames are assumed to be in framebuffer orientation.Limitations:
wl_outputstill advertises the rotation. Freeze and Zoom rotate those frames a second time. At 90° and 270° the image then fails the size check, and at 180° it shows upside down. This happens with and without this change.ext-image-copy-capturereports each frame's own transform and would avoid the problem. That is a separate change.Validation:
out2comcomposition, which uses pixman's rotation matrix. It covers padded SHM rows, bothy_invertvalues, and the output size and stride. It fails without the fix: at 90°, the expected and actual pixels come out in reverse order, which means the image is upside down. The existing 90°, 270°, and rotated-crop tests had locked in the wrong direction, and their expectations are corrected.git diff --checkpassed. All Rust steps of./tools/lint-and-test.shpassed: fmt, clippy, and builds and tests with all features and with no default features, plus the isolated render tests. The C# repository checks passed. One C# packaging test,RepositoryBuildProducesAVerifiableSignedRpm, could not run locally becausedpkg-debis not installed; this change does not touch packaging.