mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-14 17:44:13 +02:00
6751fc6f19
Each picture of a folio was decoded in turn while its item was built, a quarter of a second for a 12 megapixel photo. Diagram::fromXml() now reads every picture of the folio first, decodes them all at once on a pool of its own (one thread per core, at most one per picture), then builds the items in file order in the GUI thread as before. The decoding (base64 text, then the picture file) moves out of DiagramImageItem::fromXml() into decodePicture(), which touches only its argument. QImage::fromData() then QPixmap::fromImage() is what QPixmap::loadFromData() does, so the pixels are the same. On a 263 MB project with 22 photos on one folio: --info 21.3 s -> 12.5 s, the folio's content 10.6 s -> 3.2 s, opening its .qetz 15.6 s -> 9.3 s. Peak memory +220 MB (1.81 -> 2.03 GB), the pictures' text being converted by several threads at once. A resave is byte-identical to master's, and so is a PNG export. tst_folioimageload: six pictures come back with their own pixels and positions, and an <image> without a picture does not stop the others. It fails when the decoded pictures are handed to the wrong items. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>