Skip to content

fix(android): correct cover-fill scaling in SinkSurface vertices - #249

Merged
parkergrt merged 1 commit into
pixpark:mainfrom
rainboy93:fix/sink-surface-fill-mode-vertices
Sep 26, 2026
Merged

parkergrt merged 1 commit into
pixpark:mainfrom
rainboy93:fix/sink-surface-fill-mode-vertices

Conversation

@rainboy93

Copy link
Copy Markdown
Contributor

Problem

In SinkSurface::UpdateDisplayVertices, FillMode::PreserveAspectRatioAndFill computes scaled_width = view_width_ / inset_framebuffer_height and scaled_height = view_height_ / inset_framebuffer_width — each axis divided by the other axis's extent, which is not a scale factor. On a portrait preview the content renders pillarboxed (e.g. ~608px inside a 1080px view) instead of filling and cropping.

Fix

Compute a single uniform cover factor (max of the per-axis fits) and apply it on both axes, so the content scales up until it spans the view and the long axis crops — which is what cover-fill means. The FitCenter branch is unchanged.

Verified on Android: preview fills the full view width with correct aspect and cropping.

FillMode::PreserveAspectRatioAndFill computed scaled_width from
view_width_ / inset_framebuffer_height and scaled_height from
view_height_ / inset_framebuffer_width — each axis divided by the other
axis's extent, which is not a scale factor. On a portrait preview the
content rendered pillarboxed (e.g. ~608px inside a 1080px view) instead
of filling and cropping. Compute a single uniform cover factor and apply
it on both axes.
@parkergrt
parkergrt merged commit ad356d3 into pixpark:main Sep 26, 2026
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