summaryrefslogtreecommitdiff
path: root/src/svgtiny.c
Commit message (Collapse)AuthorAgeFilesLines
* implement svg path arc correctlyVincent Sanders2020-10-031-18/+498
|
* Fix various bugs which caused ASAN and UBSAN to be upsetDaniel Silverstone2018-07-291-1/+2
|
* Fix parsing of multiple vertical lineto commandsMichael Drake2017-07-241-1/+1
| | | | Thanks to Nils for spotting this.
* Build: Include gperf-generated code directly.Michael Drake2017-04-201-0/+3
| | | | | | | Previously we built the generated code separatly and then linked to it. However, this caused problems with certain compilers and gperf versions. This change includes the generated code directly in svgtiny.c instead, which is the only place its used.
* Parse: Ensure consumed characters count is initiliased.Michael Drake2016-10-261-0/+1
|
* Parse: Make the parse state have two sets of gradient details.Michael Drake2016-10-261-39/+62
| | | | | | | | | | | | | | | | | | One for fills and another for strokes. This stops an SVG such as <svg viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="foo"> <stop stop-color="#69f" offset="0"/> <stop stop-color="#468" offset="1"/> </linearGradient> </defs> <path fill="url(#foo)" stroke='url(#bar)' d='M10 10 H 90 V 90 H 10 Z' /> </svg> from getting its fill gradient details trampled when we reset the gradient for the the missing bar gadient definition. Note, we only handle linearGradient on the fill anyway.
* Parse: Avoid strndup with unchecked return value.Michael Drake2016-10-261-3/+3
|
* Parse: Remove explicit init of gradient state; gets memset anyway.Michael Drake2016-10-261-5/+0
|
* cope with lack of root svg elementVincent Sanders2016-08-241-0/+6
|
* Fix reallocation of path buffer length to cope with differng path lengthsVincent Sanders2015-08-231-21/+41
|
* Ensure path generation does not overrun allocated storage.Vincent Sanders2015-01-151-6/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes bug #2251 which was caused by the svg: <svg width="11" height="11" id="support-entry-icon" y="3389"><g><g><path fill-rule="evenodd" clip-rule="evenodd" fill="#D6D6D6" d="M0,0v11h11V0H0z M10,10H1V1h9V10z M9,3H2v1h7V3z M9,5H2v1h7V5z M9,7H2v1h7V7z"/></g></g></svg> The svg was causing more path elements to be generated in the internal representation than space was allocated for and overrunning heap blocks. The path element parsing was using a fixed size allocation for the path elements and never bounds checked. Further it did not cope with zero length paths (which the spec says are permitted). It was also grossly overallocating for the common case. This changes the path element array to be bounds checked and then extended if required, the initial allocation is generally sufficient and in testing very few resizes occurred. The reallocation strategy grows the element storage by 2.5 each time this means even in the degenerate case very few reallocations are required. In testing no more than a single reallocation has been observed. The final path element array will always be reallocted to the minimum required size. This reduces overall memory usage which is useful with complex scenes.
* fix parsing of whitespace in transform operatorsVincent Sanders2014-10-231-18/+18
| | | | | | | | The SVG spec for the transform attribute allows whitespace in places that were causing the %n specifier in the ssanf to return 0 as the match failed before it completed the parse. http://www.w3.org/TR/SVG/coords.html#TransformAttribute
* Fix relative move commands following a path close.Paul Mecklenburg2014-10-101-0/+7
| | | | | | | | | Both 'M' and 'm' are moves and therefore start a new (sub)path. In either case the location should be cached so that a later 'close path' (z or Z) knows the location it is returning to. The location is not written to 'p', since it is assumed that the client code remembers. If the next move is relative (lowercase), then it's important that last_x, last_y were correctly updated while processing Z/z.
* Move gradient logging to svgtiny_gradient.c, and suppress when not debugging ↵Michael Drake2013-08-231-2/+0
| | | | gradients.
* Fix leak of gradient dom strings.Michael Drake2013-08-231-35/+189
|
* Handle empty text nodes correctly.John-Mark Bell2012-12-311-3/+7
|
* Drop const, as this can't work with libdom.John-Mark Bell2012-12-301-6/+6
|
* Replace dom_string_length with dom_string_byte_length -- faster and more correctDaniel Silverstone2012-11-031-8/+8
|
* Void myself unpleasantly in order to satisfy RISC OS toolchainDaniel Silverstone2012-11-031-2/+3
|
* Clean up properlyDaniel Silverstone2012-11-031-1/+9
|
* The library now buildsDaniel Silverstone2012-11-031-0/+1
|
* More work towards libdom conversionDaniel Silverstone2012-11-031-69/+110
|
* Parse textDaniel Silverstone2012-11-031-19/+65
|
* Make more svg elements parse againDaniel Silverstone2012-11-031-57/+127
|
* More work to bring svgtiny into the libdom eraDaniel Silverstone2012-11-031-53/+110
|
* Begin conversion to libdomDaniel Silverstone2012-11-031-42/+98
|
* s/strndup/svgtiny_strndupJohn Mark Bell2011-01-021-1/+1
| | | | svn path=/trunk/libsvgtiny/; revision=11186
* Use built-in strndup if the platform we're targetting doesn't have oneJohn Mark Bell2010-12-291-1/+20
| | | | svn path=/trunk/libsvgtiny/; revision=11140
* Split the string for stroke-width like it's done for the other attributes so ↵James Bursa2010-09-241-1/+3
| | | | | | svgtiny_parse_length doesn't get confused about the remainder of the string. Contributed by Peter Korsgaard. svn path=/trunk/libsvgtiny/; revision=10837
* Lots of C89, please test...François Revel2010-01-021-29/+57
| | | | svn path=/trunk/libsvgtiny/; revision=9771
* Round stroke widths to nearest integer instead of down, and force to 1 if it ↵James Bursa2009-11-281-2/+4
| | | | | | would be rounded to 0. svn path=/trunk/libsvgtiny/; revision=9707
* Implement <ellipse> element. Improve error handling for <circle>.James Bursa2009-11-281-18/+109
| | | | svn path=/trunk/libsvgtiny/; revision=9706
* Despite M_PI being #defined in math.h, and math.h being #included, in certainChris Young2009-11-221-0/+3
| | | | | | circumstances it doesn't get #defined. Catch this. svn path=/trunk/libsvgtiny/; revision=9701
* Start implementing arcs in paths. Fix crash when an empty path has a ↵James Bursa2009-11-221-2/+27
| | | | | | gradient fill. svn path=/trunk/libsvgtiny/; revision=9682
* Squash warningsJohn Mark Bell2009-08-241-1/+5
| | | | svn path=/trunk/libsvgtiny/; revision=9423
* Beginnings of port to core buildsystemJohn Mark Bell2009-08-241-0/+1079
svn path=/trunk/libsvgtiny/; revision=9419