The first step towards adding libcss support is to build against
libcss. For now that means getting its "cflags" and "libs" from
pkg-config and putting them into CFLAGS and LDFLAGS.
src/svgtiny.c: remove old misleading libcss comments
There were a few comments in this file suggesting some future libcss
integration. However, now that we are beginning that integration (much
later), it is probably best to start with a clean slate. So, we remove
those comments.
examples/svgtiny_display_x11.c: add missing stdlib.h include
This file uses malloc(), free(), and exit() -- all of which are
defined in stdlib.h. GCC seems unhappy about the situation, so we now
include it. This allows the file to be compiled once again.
The svgtiny_LIBXML_ERROR constant was changed to throughout the
codebase to svgtiny_LIBDOM_ERROR a long time ago, in 9275ab308, but
this example was missed, probably because it isn't built by default.
This constant svgtiny_LIBXML_ERROR was changed throughout the codebase
to svgtiny_LIBDOM_ERROR a long time ago, in 9275ab308, but the README
was missed because nobody reads the documentation :)
Michael Drake [Thu, 20 Apr 2017 09:51:07 +0000 (10:51 +0100)]
Build: Include gperf-generated code directly.
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.
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.
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.
Vincent Sanders [Thu, 23 Oct 2014 21:18:16 +0000 (22:18 +0100)]
fix parsing of whitespace in transform operators
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.
Paul Mecklenburg [Fri, 10 Oct 2014 22:13:02 +0000 (23:13 +0100)]
Fix relative move commands following a path close.
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.
Chris Young [Sat, 5 Jan 2013 21:11:31 +0000 (21:11 +0000)]
Explicitly check if r0 or r1 are NaN, as if they are, on x86 the function evaluates as 0 (which is already handled), but on PPC the function evaluates to a negative value, causing the following for loop to become infinite.
James Bursa [Fri, 24 Sep 2010 23:41:14 +0000 (23:41 -0000)]
Split the string for stroke-width like it's done for the other attributes so svgtiny_parse_length doesn't get confused about the remainder of the string. Contributed by Peter Korsgaard.
John Mark Bell [Fri, 6 Nov 2009 07:05:12 +0000 (07:05 -0000)]
-Wextra is only understood by GCC 3.4.6 or later.
It is a more descriptive synonym for -W.
Use -W instead which is understood by all common versions of GCC
(i.e. GCC 2.95 supports it, which is the oldest GCC version we have to support)
Additionally, conditionalise our -Werror usage on whether we're building for
BeOS/Haiku. On these platforms, the standard library headers result in warnings.
GCC 2 is quite happy to build this code on other platforms, so shouldn't be
the trigger for dropping -Werror (even if BeOS is the only target where GCC2 is
likely to be used).