Skip to content

Limit capture by samples per point, not by pixel width - #27

Merged
pulkitxm merged 1 commit into
Noveum:mainfrom
reesoousa:fix/capture-scale-by-display
Sep 15, 2026
Merged

pulkitxm merged 1 commit into
Noveum:mainfrom
reesoousa:fix/capture-scale-by-display

Conversation

@reesoousa

Copy link
Copy Markdown
Contributor

Problem

The capture width is capped at a fixed number of pixels:

let scale = min(screen.backingScaleFactor, 2400 / area.width)

A fixed pixel budget spread over a larger display means fewer samples per point, so the fold is softer on a bigger MacBook than on a smaller one with the same chip behind it:

Display Logical width Capture Samples per point
14 inch 1512 pt 2400 px 1.59
16 inch 1728 pt 2400 px 1.39

This turned up from a 16 inch owner reporting the effect looked worse than on a 14 inch, which is what sent me to this line.

Change

let scale = min(screen.backingScaleFactor, 2800 / area.width, 1.6)

Cap the ratio rather than the absolute width, so sharpness is the same on every built in display, and keep an absolute guard rail for any future larger panel.

1.6 is deliberate: it is where the old limit already landed on a 1512 point display, so the smaller machine is unchanged in practice and there is no regression to trade for the fix. A 1728 point display goes from 2400 to 2764 pixels wide, about a third more fragments through the blur chain, on hardware in the same family as the smaller machine that already handles it.

Why nothing else moves

Everything downstream of this line is already proportional, so the one line is the whole fix:

  • blur sigmas are derived from the small texture width ($0 * smallWidth / 786), so they scale with the capture and stay the same fraction of the screen
  • Fold.metal works entirely in normalized coordinates; its constants are proportions, not pixels
  • the fold geometry is expressed as percentages of the frame

Testing

Built with make build on an M4 MacBook Pro, macOS 26.6.2, where the change is a no op by design (1.587 to 1.600). The larger display case is reported rather than measured by me: I do not have a 16 inch to hand, so I am relying on the arithmetic above plus a user report, and I would rather say so than imply I verified it on both panels.

I could not run npm run check locally: the swift-format shipped with the Command Line Tools cannot read this repo's configuration schema, so CI lint is the authority on formatting here.

The capture width is capped at a fixed 2400 pixels, so a larger built in
display gets a softer fold than a smaller one: the same pixels are spread
over more points. A 1728 point display resolves 1.39 samples per point
where a 1512 point display resolves 1.59, and the difference is visible
in the fold even with the same chip behind it.

Cap the ratio at 1.6 instead, with a 2800 pixel guard rail above it.
Sharpness is then the same on every built in display. The smaller display
is unchanged in practice, because 1.6 is where its old limit already
landed, and a 1728 point display goes from 2400 to 2764 pixels wide.

Everything downstream is already proportional, so nothing else needs to
move: the blur sigmas scale with the small texture width, and the shader
works entirely in normalized coordinates.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 12, 2026

Copy link
Copy Markdown

@reesoousa is attempting to deploy a commit to the MagicAPI Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 41 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 16c5ee08-9086-4a80-be25-964a2f91e4e9

📥 Commits

Reviewing files that changed from the base of the PR and between a1ccaf6 and 9cb671d.

📒 Files selected for processing (2)
  • MOTION.md
  • Sources/LiveDesktop.swift

Comment @coderabbitai help to get the list of available commands.

@pulkitxm
pulkitxm merged commit df0f7cb into Noveum:main Sep 15, 2026
2 of 3 checks 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.

2 participants