Skip to content

Reuse decoded image pixels across imports and edits - #153

Merged
vycdev merged 7 commits into
developfrom
t3/eliminate-redundant-image-decodes
Nov 16, 2026
Merged

vycdev merged 7 commits into
developfrom
t3/eliminate-redundant-image-decodes

Conversation

@vycdev

@vycdev vycdev commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Choosing or editing an image decoded the same pixels separately for the preview and swatches. Imports now reuse their validation decode, and edits/Undo/Redo load one shared snapshot. The 2D preview, image colors, 3D geometry, Auto-paint analysis, and Palette Proof read the same canonical pixels. This also prevents profiled colors from changing between consumers and collapsing two image regions into one printed layer.

Closes #131.

  • Validation bitmaps are closed after copying their pixels, including stale and failed imports. History retains encoded files and repeats their decoder settings; it keeps no open bitmaps. File acceptance, Refuse images over the browser canvas size limits on import #146's canvas limits, and Stack Matrix photo sampling are unchanged.
  • The editable original and processed canvases stay separate. Pending history loads block stale exports/builds; rapid touch-ups survive crop and bake, batched commits restore correctly on Undo, and failed saves roll back to the latest saved edit. Baking retains the existing adjustment-reset epoch.
  • Image dimensions appear before swatch scanning finishes. Checks over 150 ms show a localized, nonblocking checking indicator.

On the 3888x2916 JPEG fixture, paired production measurements fell from 1,052 to 305 ms in Chromium and 1,427 to 501 ms in WebKit, from file selection to size shown (seven trials per engine, medians on the same Windows machine). Imports use one bitmap decode and zero URL image loads, down from one bitmap plus three URL loads.

Proof: real Chromium/WebKit regressions preserve 8-/16-bit profiled color regions through import, bake, Undo/Redo, and exported 3MF volume/topology checks. Auto-paint and Palette Proof read the same pixels without additional decodes. The failure was reproduced before the fix, and the same fixtures pass after it.

Validation on rebased head 0ccb9ac:

  • Lint, TypeScript, and production build pass.
  • All 1,152 unit tests and 90 focused browser checks (45 Chromium + 45 WebKit) pass, including current develop's Auto-paint Run/Cancel and slicer chooser regressions.
  • All eight local e2e suites pass (118 smoke tests plus docs, landing, privacy, terms, 404, i18n, and i18n build). All 11 GitHub CI checks pass on this head.

Reviewed with sol-loop: 2 rounds with gpt-6.1-sol on xhigh. Sol verdict: approved. The subsequent clean rebase preserved all seven reviewed patches unchanged.

Created with GPT-6.1 Sol in T3 Code (Codex).

@vycdev
vycdev force-pushed the t3/eliminate-redundant-image-decodes branch from 83034f2 to 7898539 Compare November 16, 2026 18:45
Share the validated import snapshot with the preview, swatches, and build
warnings, and decode edited/history URLs once for those consumers. Close
validation bitmaps after copying their pixels and discard obsolete loads.

Publish dimensions before swatch scanning, add delayed import feedback,
and cover decode counts, cleanup, adjustments, edits, and history in tests.

Refs #131
Guard preview exports until the selected history entry is ready, while
allowing current live touch-up pixels to be used before their URL loads.
Crop from the editable original so rapid touch-ups are preserved.

Add held-decode regressions for pending undo, baking live touch-ups, and
cropping live touch-ups. Update the unreleased import entry.

Refs #131
Distinguish pending and failed shared snapshots from an empty workspace,
retaining image dimensions and updating feedback during history loads.
Schedule a preview render for each loaded canvas independently of swatches.

Retain only the latest successful touch-up snapshot until its shared canvas
loads. Restore it after an encoding failure, cancel subsequent unsaved
strokes, and keep the commit queue usable after thrown encoder errors.
Release owned snapshot backing stores when discarded or superseded.

Add browser regressions for loading, failed saves, thrown encodes, and
failed-load recovery. Update the unreleased import entry.

Refs #131
Consume self-commit markers through the most recently rendered commit.
Earlier commits skipped by React batching must be restored from history,
while newer pending commits retain their live-canvas fast path.

Add a browser regression with two saves batched before one render and
verify Undo restores the intermediate pixels in Chromium and WebKit.

Refs #131
@vycdev
vycdev force-pushed the t3/eliminate-redundant-image-decodes branch from 7898539 to 0ccb9ac Compare November 16, 2026 19:10
@vycdev
vycdev merged commit 93b4be6 into develop Nov 16, 2026
11 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.

1 participant