mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-14 19:26:51 -04:00
* Affinity import: pie shapes with huge angles no longer hang the reader The reader raised the end angle of a pie shape (`ShPi`) by `TAU` in a loop until the end angle reached the start angle. Both angles come from the file. The loop ran about `(AngS - AngE) / TAU` times, and it never ended once adding `TAU` no longer changed the end angle: with `AngS` = 1e308 and `AngE` = -1e308, reading the document did not return. The reader now computes the pie's angles in constant time. The start angle is `AngS` modulo `TAU`. The sweep is `AngE - AngS` capped at one turn, or its remainder modulo `TAU` when `AngE` is below `AngS`. When `AngE` is below `AngS` and that difference overflows to negative infinity, the sweep comes from the remainders of the two angles. The change and its two tests come from Riccardo Balloch's commit 79c5d673 in storytold/vectorcraft, which fixed the same loop in VectorCraft's copy of this reader. Here the tests read the document on a thread of their own and fail when reading takes more than 20 seconds. Co-authored-by: Riccardo Balloch <[email protected]> * Contributors: add dotCooCoo (Robert Lee) --------- Co-authored-by: Riccardo Balloch <[email protected]> Co-authored-by: Brandon Thomas <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>