mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-27 17:01:38 +01:00
When renders from scratch take longer than about a frame, every new zoom got a coarse preview first (#312), with a quarter of the pixels each way. After a zoom out that is right: the old image, re-projected, covers a small part of the view. After a zoom in it covers all of it, and enlarged up to 4x it is at least as sharp as the preview. During a pinch or a held zoom each step also dropped its refined image as soon as the next step's request came, so the canvas stayed coarse until the zoom stopped. Now a zoom in to at most PREVIEW_FACTOR times the image last shown, inside the area that image covers, gets no preview, up front or from the watchdog: the image on screen stands in until the refined one comes. Zoom outs, other pages and files, larger zoom ins and zooms to an area the image doesn't cover still get previews. The browser's banded renders take the same rule, measured from the last image finished rather than one still being drawn. The previews' doc comments in render_worker.rs and zoom_preview_tests.rs still say "a new zoom"; they now hold for zoom outs and large zoom ins. Measured in the app on a page of 11 000 layers and 237 images (M4 Max), 39 zoom steps from 10% to 200%, read through `ui.inspect`: before, 5 of them showed a preview; with this change none did, each showed the refined image, and full renders at those zooms took 5-14 ms.