Skip to content

fix(send): scale QR tiles continuously to fill the stage, keep the chosen layout - #10

Merged
BlackPool25 merged 1 commit into
mainfrom
fix/continuous-qr-scaling
Aug 3, 2026
Merged

BlackPool25 merged 1 commit into
mainfrom
fix/continuous-qr-scaling

Conversation

@BlackPool25

Copy link
Copy Markdown
Owner

What & Why

The broadcast QR grid stepped tile size in whole-module jumps (integer px/module, floored), so a tile only grew when an entire extra module fit — and until then, growing the window just added dead space between and around the QRs. On a portrait phone a 2x2 grid left big empty margins, and the QRs sat small in the center.

This changes the renderer to continuous linear scaling:

  • The tile fills its cell edge-to-edge — the tile side is min(cellW, cellH), the px/module scale is fractional, so tiles grow proportionally as the window grows and no space is wasted between or around the QRs (only the QR-spec 4-module quiet zone separates tiles).
  • Rendering stays nearest-neighbour (FilterQuality.none blit, non-AA path fallback), so module edges remain hard at any scale — anti-aliasing, not fractional size, is the decode killer, so QRs stay camera-decodable (the decode-back e2e painter test still passes).
  • The chosen layout stays fixed: the adaptive layout re-flow from feat(send): re-flow the QR grid to fit the viewport #7 is removed — a 2x2 grid stays 2x2, exactly as selected (no mid-broadcast swapping to a "better-fitting" layout). Reverts the setLayout/LayoutBuilder machinery added in feat(send): re-flow the QR grid to fit the viewport #7.
  • docs/ARCHITECTURE.md px/module note updated to reflect continuous hard-edge scaling.

How it was tested

  • New painter tests: single tile fills the canvas edge to edge (no dead margin) and tiles scale linearly with the canvas, not in integer steps (canvas 116 vs 232 → module position doubles). Both fail on the previous renderer (module landed in the dead margin → expected white, got espresso).

  • Existing painter tests updated for the continuous geometry; the real-QR decode-back test and bitmap-vs-path identity test still pass unchanged.

  • Reverted the feat(send): re-flow the QR grid to fit the viewport #7 re-flow tests (setLayout, re-flows the live layout).

  • cd flutter_app/rust && cargo build --lib && cd flutter_app && flutter analyze && flutter test — 116 tests pass.

  • flutter analyze + flutter test

  • Manually tested on: Flutter Android / Flutter Linux / both (tile fill + linear scaling verified at multiple canvas sizes in widget tests)

Checklist

  • No wire-format/codec change
  • CHANGELOG / docs updated if user-facing
  • If AI-assisted, I reviewed and understood every line

…osen layout

The broadcast grid stepped tiles in whole-module jumps (integer px/module),
so growing the window wasted space between and around the QRs until the
next whole module fit. Tiles now fill their cell edge-to-edge with the
QR-spec quiet zone as the only separator, scaled continuously to the
viewport (nearest-neighbour rendering keeps module edges hard and
camera-decodable — anti-aliasing, not fractional size, was the decode
killer). The chosen layout stays fixed: the adaptive layout re-flow is
removed, so a 2x2 grid stays 2x2.
@BlackPool25
BlackPool25 merged commit a1c1ef2 into main Aug 3, 2026
2 checks passed
@BlackPool25
BlackPool25 deleted the fix/continuous-qr-scaling branch August 3, 2026 09:27
@BlackPool25 BlackPool25 mentioned this pull request Aug 3, 2026
4 tasks done
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