mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-28 04:16:46 -06:00
Whether a zoom got a preview rested on the previous render from scratch, so the first render, another page or file, and a zoom from a quick view to a heavy one came without one: the page colour showed until the full render was done. Rendering every such preview up front would cost 8-56% of a full render (bench pages of 1k-50k layers at 2880x1800; per-layer costs dominate large pages). Instead the render thread arms a watchdog thread as it starts a render from scratch without a preview; once that render has run past 12 ms the watchdog renders the preview beside it, on one core while the full render keeps the others, and sends it unless the full image is done. Quick renders cost nothing and never flash a preview. Warm slow zooms keep the preview first, which keeps up with a gesture. With two threads sending, finished images carry their request's number: a poll takes the newest request's, and of one request the refined image; the canvas never shows a preview over the refined image of its own or a newer request. Refs #295