mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-28 04:06:54 -06:00
ase::read accepted any number of colors in a swatch exchange file, and swatch.load looked up each incoming name with a linear search through the document's swatches. The time to load a file grew with the square of its number of colors: in a test build, 50,000 colors used 2.5 s of CPU and 100,000 used 9.6 s. No limit applied to larger files. ase::read now returns an error for a file with more than 100,000 colors (ase::MAX_COLORS). load_swatches looks up each name's first swatch in a HashMap, and each color added from the file is indexed too. A file of 100,000 colors now loads in under 0.1 s. The merge follows the same rules as before: names already in the document are kept unless replace is set, a name repeated in the file matches its first copy, and a locked swatch is left unchanged.