Skip to content

Move, zoom and pan the wallpaper in shiftpaper-render - #29

Merged
CPritch merged 1 commit into
mainfrom
feat/view
Oct 10, 2026
Merged

CPritch merged 1 commit into
mainfrom
feat/view

Conversation

@CPritch

@CPritch CPritch commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

The renderer always showed the middle of the image, cropped to the screen, so this teaches it to show any part.

  • View (public): a zoom from 1 up and a centre in image uv. Each Wallpaper carries one (View::default() shows the middle, as before), and OutputRenderState::set_view changes it live
  • OutputRenderState::set_pan: from 0 to 1, the horizontal centre runs from as far left as the image allows to as far right, in place of the view's own. None stops panning
  • The centre is clamped so the image always covers the screen, margin included, and zoom is never below 1
  • The shader's crop takes the centre, via two new uniforms, uv_center and next_uv_center. The portal and dissolve trails go through a Crop that matches it, so they still start from what's on screen
  • step_and_write reports a change of view or pan, so it gets drawn
  • A wallpaper bigger than the GPU's largest texture is shrunk to fit on upload. A wide panorama shrunk to fill a tall phone screen can be over 8192 px across

shiftpaperd doesn't use any of this yet, so it looks the same.

Format, clippy and tests pass locally. There are new tests for the view's zoom and clamping, for panning, and for the GPU size limit, and the portal reach test now also runs zoomed in off centre.

A View on each Wallpaper picks which part shows: a zoom from 1 up, and a
centre in the image that moves in as far as it must to keep the screen
covered. OutputRenderState::set_pan moves the centre across the image
instead, for following a launcher's pages. The shader's crop takes the
centre, and the portal and dissolve trails work out what's on screen
from the same Crop.

A wallpaper bigger than the GPU's largest texture is now shrunk to fit
on upload, since a wide photo shrunk to a tall screen can be.
@CPritch
CPritch merged commit 0132f08 into main Oct 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant