Skip to content

fix: anti-alias presentation downscaling with an area filter - #29

Open
maryny4 wants to merge 1 commit into
MuNeNiCK:mainfrom
maryny4:fix/presentation-downscale-filter
Open

fix: anti-alias presentation downscaling with an area filter#29
maryny4 wants to merge 1 commit into
MuNeNiCK:mainfrom
maryny4:fix/presentation-downscale-filter

Conversation

@maryny4

@maryny4 maryny4 commented Aug 6, 2026

Copy link
Copy Markdown

Problem

Presentation scaling picks a single nearest source pixel per output pixel. When a 4K physical output is presented at a window-sized resolution (e.g. 3840x2160 → ~1536x864), most source pixels are simply dropped, and fine content — text above all — renders with heavy aliasing ("pixelated" look reported by users of physical-output capture).

Fix

Average the source region each output pixel covers (integer box filter with rounding). Downscaling now anti-aliases; for upscaling the box degenerates to a single source pixel, matching the previous behavior byte for byte, and the identity path stays zero-copy as before.

A regression test downscales a black/white pair to one pixel and asserts mid-gray — nearest sampling would return one of the extremes.

cargo fmt --check, clippy -- -D warnings, cargo test (both feature sets) pass.

Presentation scaling picked a single nearest source pixel per output
pixel, so downscaling a 4K output to a window-sized presentation drops
most source pixels and renders text with heavy aliasing.

Average the source region each output pixel covers instead (integer box
filter, rounded). For upscaling the box degenerates to one source pixel,
matching the previous behavior, and the identity path is untouched.

(cherry picked from commit 5edcda3)
@maryny4
maryny4 marked this pull request as draft August 6, 2026 13:18
@maryny4
maryny4 marked this pull request as ready for review August 6, 2026 13:22
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