mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-05 10:34:13 +02:00
f6f53e3f52
DiagramImageItem::toXml() PNG-encoded every picture on every save, autosave and copy, whether or not it had changed. That is most of the cost of pictures in a project: resaving one holding 60 of them took 6.2 s and now takes 3.8 s. The PNG bytes are now kept and reused while QPixmap::cacheKey() still matches, so any edit (replace, crop, mirror, transparency) re-encodes without each of those functions having to invalidate anything. On load the cache is filled with the file's own bytes, so the first save encodes nothing either. Output is byte-identical to before on the example projects. A picture whose PNG came from another encoder now keeps its original bytes instead of being re-encoded; the pixels are identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G2d2Zi8BfrYRPX88zhaoFG