Releases: IconJar/IJSVG
2.2.0 - Massive performance boost and memory fixes.
This build vastly improves path data parsing by about 8x, how you ask? The slowest parts of parsing command data was allocation of memory and then memory copying to generate floats, we now use one memory buffer instance per SVG and keep reusing the same one over and over again, which greatly reduces memory and shoots performance through the root. The other slowdown was atof
or strtod_l
, converting a char *
over to a float, we now have a custom implementation which is almost 4x faster. This can all be found inside the new IJSVGCommandParser.h/m
class.
Rendering is now faster due to fixing a bug that resolved in memory leaks (IJSVG never leaked the memory, we just had fixes), we used to use CATransactionLock/Commit
to get around threading issues and the leak, but now, after hours of pain, setting the content of IJSVGLayer
to nil
in dealloc
fixes the memory leak on background threads, thus making rendering perform better as transaction does not need locking.
We have also rewritten the exporting path data processing so that the paths are more compressed and where possible, white space is removed between floating points that are either decimal or use exponents. This greatly reduces the file size when complicated SVG are exported.
This also fixes an issue where arc command were not being parsed correctly due to exported SVG's having their sweeping flags compressed together and being read as one whole float instead of flags. Each command now supports a IJSVGPathDataSequence
which can be supplied when being parsed which tells the parser how to treat and read certain floats in when parsing command data, these consist of kIJSVGPathDataSequenceTypeFloat
and kIJSVGPathDataSequenceTypeFlag
.
IJSVG.framework is now available
IJSVG is now a framework, reason being, its easier to implement into your project and also IJSVG is a non ARC project, it still uses manual memory management.
Whats fixed
This release fixes a lot of bugs, rendering issues, notable examples:
- Issues with masks
- Issues with arc commands not being parsed correctly
- Issues with various colours not being parsed correctly (namely transparent)
New things
- IJSVG is now a framework
- Exporting from IJSVG will now keep primitive types where applicable (circles, rect, line etc...)
- Completely refactored path data parsing command, each command can now specify a sequence for when reading data out of path data
- #RRGGBBAA is now supported
CALayer rendering overhaul and exporting.
This release has got a huge refactor of how SVG's are rendered. They used to be based on just directly drawing into a context, now though, the layer tree is built up of CALayers and them drawn into a context.
This produces far better results aswell and overcoming issues with masking and is just easier to maintain.
This release also features an exporter. The exporter allows you to export the layer tree directly to SVG with various optimisation options. The exporter also allows you to create an SVG out of IJSVGLayers and export those without needing to load an SVG from a file first.
Other features include:
- Custom float parsing method to greatly increase performance when parsing huge files.
- A callback helper block for when CALayers with custom drawing methods require knowing the scale of what they are drawing into.
- Pattern support has been greatly improved.
- Gradients now mainly obey their bounding box units.
- Masking now actually does proper masking for a group of elements.
- Transform now support skewX and skewY.
- Various fixes for colorspace so colors match there browser counterparts.