Skip to content

fix(canvas): preserve live ink and bound overview rendering work - #61

Open
markm39 wants to merge 14 commits into
mainfrom
fix/seamless-canvas
Open

markm39 wants to merge 14 commits into
mainfrom
fix/seamless-canvas

Conversation

@markm39

@markm39 markm39 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Continuous notebooks could clip ink at page edges, repeat document work while panning, and block touch delivery while waiting for a Metal drawable. Preserve whole strokes across page boundaries, render 25% overviews, and keep drawing/history usable through saves.

Decode and partition document snapshots off the input thread. Prepare Metal resources on a bounded background queue, retain GPU live previews on their rendering context, and cache resolved tiles without pinning multisample attachments. Acquire drawables off UIKit, coalesce updates in an on-demand loop, synchronize drawable size after zoom, and allow GPU execution to overlap the next acquisition. One acquisition/encoding remains active at a time; Metal's drawable pool bounds submitted work. Timing includes drawable waiting. Cancellation, release, CPU fallback, and legacy page compositing remain covered.

Validation for fbb8017:

  • Full package/native/example CI passes: https://github.com/mathnotes-app/mobile-ink/actions/runs/39638052977. Locally, 159 Jest tests, TypeScript, and blocked-provider/cancellation/reuse checks pass.
  • Pixel, overview, erase, selection, snapshot and JNI checks cover live GPU updates, context changes, CPU capture, and exact live/saved colors. The paired GPU cache check reduces retained resources from 176 MB to 38 MB and checks transparent reuse without ghost ink.
  • Both apps pin the identical archive and checksum; 437 packaged iOS/source/library files match their installed dependencies.
  • MathNotes passes native pan/zoom, Pages/keyboard, and writing-through-autosave functional audits with production animations. Pan render p95 is 15.36 ms, maximum 111.30 ms; writing p95 is 1.70 ms, worst main delay 112.87 ms. Cold startup reaches 550.04 ms and first keyboard use reaches 1,983.64 ms. The strict timing gate FAILS. Earlier WDA pan evidence also exceeds the p95 target; these results do not establish physical Pencil latency.
  • OpenNotes passes all six native cross-page/history/recovery/dense cases on fbb8017. Filesystem checks preserve exactly 20,000 strokes and every malformed-fixture byte. Writing p95 is 1.82 ms and main maximum 32.76 ms; pan p95 is 17.74 ms and main maximum 36.97 ms. Both gesture windows have no >=100 ms main stalls, but first keyboard use reaches 1,308.41 ms. Its strict overall gate also FAILS.

Keep this PR unmerged until required timing/correctness gates and independent review pass.

Simplify/security self-reviews: no remaining code findings. Existing large native view/engine owners retain their coupled lifecycle/input state. PathRenderer.cpp adds only a lifetime hint in its existing pressure-outline builder; splitting the unrelated spline implementation would broaden the repair. New acquisition/preparation/audit helpers are separate files. No user notes or profiling traces are committed.

This branch has not been deployed

No deployments
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