mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-24 10:08:00 -06:00
Optimize reads a JPEG's header again for every group of fragments it tries, and one image can be drawn many times. The scan skipped stray bytes between segments one at a time, so a JPEG with megabytes of them after SOI cost a full walk on every call: 64 references to one such image delayed the first progress call by seconds. The scan now treats a stray byte as an unreadable header, which leaves the image as it is, and stops after 4096 markers and fill bytes. Each step jumps over a whole segment, so the work no longer grows with the stream's size.