Hello community, here is the log from the commit of package librsvg for openSUSE:Factory checked in at 2015-03-03 11:13:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/librsvg (Old) and /work/SRC/openSUSE:Factory/.librsvg.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "librsvg" Changes: -------- --- /work/SRC/openSUSE:Factory/librsvg/librsvg.changes 2015-02-20 13:50:48.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.librsvg.new/librsvg.changes 2015-03-03 11:13:15.000000000 +0100 @@ -1,0 +2,11 @@ +Fri Feb 27 17:37:38 UTC 2015 - [email protected] + +- Update to version 2.40.8 (boo#916784): + + Bugs fixed from fuzz testing: bgo#744688 - possible double + g_free() when processing stroke-dasharray. + + Optimize rendering of polylines, lines, rectangles, circles, + and ellipses. These should be marginally faster, marginally + more precise, and should put less pressure on the memory + allocator. + +------------------------------------------------------------------- Old: ---- librsvg-2.40.7.tar.xz New: ---- librsvg-2.40.8.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ librsvg.spec ++++++ --- /var/tmp/diff_new_pack.t0OokQ/_old 2015-03-03 11:13:16.000000000 +0100 +++ /var/tmp/diff_new_pack.t0OokQ/_new 2015-03-03 11:13:16.000000000 +0100 @@ -17,7 +17,7 @@ Name: librsvg -Version: 2.40.7 +Version: 2.40.8 Release: 0 Summary: A Library for Rendering SVG Data License: LGPL-2.0+ and GPL-2.0+ ++++++ librsvg-2.40.7.tar.xz -> librsvg-2.40.8.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/ChangeLog new/librsvg-2.40.8/ChangeLog --- old/librsvg-2.40.7/ChangeLog 2015-02-13 22:59:53.000000000 +0100 +++ new/librsvg-2.40.8/ChangeLog 2015-02-27 17:37:39.000000000 +0100 @@ -1,3 +1,191 @@ +commit 8eb0392f2041080f32830949ae22cd463bf219b7 +Author: Federico Mena Quintero <[email protected]> +Date: Thu Feb 26 16:03:52 2015 -0600 + + Update NEWS + + Signed-off-by: Federico Mena Quintero <[email protected]> + + NEWS | 7 +++++++ + 1 file changed, 7 insertions(+) + +commit 310500cf1739f8e827331d822bd9f9f08f6fc2b0 +Author: Federico Mena Quintero <[email protected]> +Date: Thu Feb 26 15:38:38 2015 -0600 + + bgo#745177 - Revert "RsvgPathBuilder: don't add a terminating moveto after closepath" + + This reverts commit 0c98142e31cdc91963860f99ec933e52f3cc63c6. + + This was causing bug https://bugzilla.gnome.org/show_bug.cgi?id=745177 + + rsvg-path.c | 9 +++++++++ + rsvg-path.h | 1 + + 2 files changed, 10 insertions(+) + +commit 6fd7493ef2ba7ed9d8e76a3ae5b064c34825422f +Author: Federico Mena Quintero <[email protected]> +Date: Fri Feb 20 16:24:02 2015 -0600 + + RsvgNodeEllipse: Use RsvgPathBuilder instead of building/parsing a path string + + Signed-off-by: Federico Mena Quintero <[email protected]> + + rsvg-shapes.c | 93 +++++++++++++++++++---------------------------------------- + 1 file changed, 29 insertions(+), 64 deletions(-) + +commit 3f49de8d77f787489bc0f1215ef92e3619a9875a +Author: Federico Mena Quintero <[email protected]> +Date: Fri Feb 20 16:10:49 2015 -0600 + + RsvgNodeCircle: Use RsvgPathBuilder instead of building/parsing a path string + + Signed-off-by: Federico Mena Quintero <[email protected]> + + rsvg-shapes.c | 82 +++++++++++++++++------------------------------------------ + 1 file changed, 23 insertions(+), 59 deletions(-) + +commit 9fe6fadb403de56fedc937f0f72b9378c5dd311f +Author: Federico Mena Quintero <[email protected]> +Date: Fri Feb 20 15:53:07 2015 -0600 + + RsvgNodeRect: Use RsvgPathBuilder instead of building/parsing a path string + + Signed-off-by: Federico Mena Quintero <[email protected]> + + rsvg-shapes.c | 185 ++++++++++++++++++++++++++++++++-------------------------- + 1 file changed, 101 insertions(+), 84 deletions(-) + +commit 3e15bb2f249606fead047989bb6a9d9f63e22ca1 +Author: Federico Mena Quintero <[email protected]> +Date: Fri Feb 20 14:45:50 2015 -0600 + + Make rsvg_path_builder_arc() public/internal + + This is just a rename of rsvg_path_arc(). + + Signed-off-by: Federico Mena Quintero <[email protected]> + + rsvg-path.c | 30 +++++++++++++++--------------- + rsvg-path.h | 9 +++++++++ + 2 files changed, 24 insertions(+), 15 deletions(-) + +commit 529bc934ce00ea4a21539fc080f45d3be0ee49fb +Author: Federico Mena Quintero <[email protected]> +Date: Fri Feb 20 14:42:59 2015 -0600 + + rsvg_path_arc(): take an RsvgPathBuilder, not a full RSVGParsePathCtx + + The ctx was used to extract the start point for the arc, and to + set the 'current point' to the arc's end point when the drawing + is finished. + + We now pass in extra arguments for the start point (which don't come + with the path builder). + + Also, added whitespace in the math-y part, because without whitespace + it makes me sad. + + Signed-off-by: Federico Mena Quintero <[email protected]> + + rsvg-path.c | 155 +++++++++++++++++++++++++++++++++++------------------------- + 1 file changed, 90 insertions(+), 65 deletions(-) + +commit a376c1ce16594ae8f62be9dd13d97932398c2ea2 +Author: Federico Mena Quintero <[email protected]> +Date: Fri Feb 20 14:15:30 2015 -0600 + + rsvg_path_arc_segment(): Take in a RsvgPathBuilder, not a whole RSVGParsePathCtx + + Signed-off-by: Federico Mena Quintero <[email protected]> + + rsvg-path.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +commit ac5564493f13ff905c9d29d4fc6088da06e61a9e +Author: Federico Mena Quintero <[email protected]> +Date: Fri Feb 20 13:34:40 2015 -0600 + + RsvgNodeLine: Use RsvgPathBuilder instead of building/parsing a path string + + Again; no need to go through the production process for Luwak coffee just to + paint a line. + + Signed-off-by: Federico Mena Quintero <[email protected]> + + rsvg-shapes.c | 31 ++++++++++++------------------- + 1 file changed, 12 insertions(+), 19 deletions(-) + +commit 0b11fe8358a7e7477bc2c4ae6d3b49e0bfb4ca47 +Author: Federico Mena Quintero <[email protected]> +Date: Fri Feb 20 13:28:28 2015 -0600 + + RsvgNodePoly: Use RsvgPathBuilder instead of building/parsing a path string + + We have all the machinery to build paths on the fly; we don't need to + fake a path on a string, parse that, and construct a path. + + Signed-off-by: Federico Mena Quintero <[email protected]> + + rsvg-shapes.c | 38 ++++++++++++++++++-------------------- + 1 file changed, 18 insertions(+), 20 deletions(-) + +commit 191405182e985e1745a5e5a70e2579f2bed897fb +Author: Federico Mena Quintero <[email protected]> +Date: Fri Feb 20 13:00:33 2015 -0600 + + rsvg-test: Don't include unnecessary header + + Signed-off-by: Federico Mena Quintero <[email protected]> + + tests/rsvg-test.c | 1 - + 1 file changed, 1 deletion(-) + +commit 0c98142e31cdc91963860f99ec933e52f3cc63c6 +Author: Federico Mena Quintero <[email protected]> +Date: Fri Feb 20 12:55:36 2015 -0600 + + RsvgPathBuilder: don't add a terminating moveto after closepath + + When we used libart, before Cairo, it was necessary to add a moveto after a closepath, since + the starting and ending points of a closed path were supposed to coincide. + + Cairo handles closed paths without needing the caller to manually move back to + the starting point. + + Signed-off-by: Federico Mena Quintero <[email protected]> + + rsvg-path.c | 9 --------- + rsvg-path.h | 1 - + 2 files changed, 10 deletions(-) + +commit f8019aaa9f785061285def07712b5cfcd7ab26aa +Author: Federico Mena Quintero <[email protected]> +Date: Thu Feb 19 18:12:49 2015 -0600 + + bgo#744688 - Fix double g_free() when processing stroke-dasharray + + The part of rsvg_parse_style_pair() that validates the dash pattern, by seeing + if any actual dash length was generated, could leave a dangling pointer after + a g_free() if the dash pattern turned out to be invalid. Later, rsvg_state_inherit_run() + would try to g_free() this dangling pointer as well. + + Found by Atte Kettunen's fuzz testing. + + Signed-off-by: Federico Mena Quintero <[email protected]> + + rsvg-styles.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +commit d7b49df88d28ef70efd0efc9db319fd4b6969b91 +Author: Federico Mena Quintero <[email protected]> +Date: Fri Feb 13 16:47:13 2015 -0600 + + Post-release version bump + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit aadbf6968df5fa93e182b7e7c93dc5cc076d44ce Author: Federico Mena Quintero <[email protected]> Date: Fri Feb 13 14:49:11 2015 -0600 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/NEWS new/librsvg-2.40.8/NEWS --- old/librsvg-2.40.7/NEWS 2015-02-13 21:48:55.000000000 +0100 +++ new/librsvg-2.40.8/NEWS 2015-02-26 23:03:06.000000000 +0100 @@ -1,3 +1,10 @@ +Version 2.40.8 +- Bugs fixed from fuzz testing: #744688 - possible double g_free() + when processing stroke-dasharray +- Optimize rendering of polylines, lines, rectangles, circles, and + ellipses. These should be marginally faster, marginally more + precise, and should put less pressure on the memory allocator. + Version 2.40.7 - Bugs fixed from fuzz testing: #703102, #738050, #738169, #744270, #744299 - Fixed unfiled bug from fuzz testing, where the convolution filter diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/configure new/librsvg-2.40.8/configure --- old/librsvg-2.40.7/configure 2015-02-13 21:53:47.000000000 +0100 +++ new/librsvg-2.40.8/configure 2015-02-27 17:36:55.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for RSVG 2.40.7. +# Generated by GNU Autoconf 2.69 for RSVG 2.40.8. # # Report bugs to <https://bugzilla.gnome.org/enter_bug.cgi?product=librsvg>. # @@ -591,8 +591,8 @@ # Identity of this package. PACKAGE_NAME='RSVG' PACKAGE_TARNAME='librsvg' -PACKAGE_VERSION='2.40.7' -PACKAGE_STRING='RSVG 2.40.7' +PACKAGE_VERSION='2.40.8' +PACKAGE_STRING='RSVG 2.40.8' PACKAGE_BUGREPORT='https://bugzilla.gnome.org/enter_bug.cgi?product=librsvg' PACKAGE_URL='' @@ -1422,7 +1422,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures RSVG 2.40.7 to adapt to many kinds of systems. +\`configure' configures RSVG 2.40.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1492,7 +1492,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of RSVG 2.40.7:";; + short | recursive ) echo "Configuration of RSVG 2.40.8:";; esac cat <<\_ACEOF @@ -1642,7 +1642,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -RSVG configure 2.40.7 +RSVG configure 2.40.8 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2011,7 +2011,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by RSVG $as_me 2.40.7, which was +It was created by RSVG $as_me 2.40.8, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2880,7 +2880,7 @@ # Define the identity of the package. PACKAGE='librsvg' - VERSION='2.40.7' + VERSION='2.40.8' cat >>confdefs.h <<_ACEOF @@ -3018,13 +3018,13 @@ # =========================================================================== -RSVG_LT_VERSION_INFO=42:7:40 +RSVG_LT_VERSION_INFO=42:8:40 LIBRSVG_MAJOR_VERSION=2 LIBRSVG_MINOR_VERSION=40 -LIBRSVG_MICRO_VERSION=7 +LIBRSVG_MICRO_VERSION=8 @@ -15547,7 +15547,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by RSVG $as_me 2.40.7, which was +This file was extended by RSVG $as_me 2.40.8, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15613,7 +15613,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -RSVG config.status 2.40.7 +RSVG config.status 2.40.8 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/configure.ac new/librsvg-2.40.8/configure.ac --- old/librsvg-2.40.7/configure.ac 2015-02-12 17:59:21.000000000 +0100 +++ new/librsvg-2.40.8/configure.ac 2015-02-13 23:47:01.000000000 +0100 @@ -1,6 +1,6 @@ m4_define([rsvg_major_version],[2]) m4_define([rsvg_minor_version],[40]) -m4_define([rsvg_micro_version],[7]) +m4_define([rsvg_micro_version],[8]) m4_define([rsvg_extra_version],[]) m4_define([rsvg_version],[rsvg_major_version.rsvg_minor_version.rsvg_micro_version()rsvg_extra_version]) m4_define([rsvg_lt_version_info],m4_eval(rsvg_major_version + rsvg_minor_version):rsvg_micro_version:rsvg_minor_version) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/doc/html/annotation-glossary.html new/librsvg-2.40.8/doc/html/annotation-glossary.html --- old/librsvg-2.40.7/doc/html/annotation-glossary.html 2015-02-13 22:59:53.000000000 +0100 +++ new/librsvg-2.40.8/doc/html/annotation-glossary.html 2015-02-27 17:37:39.000000000 +0100 @@ -21,32 +21,35 @@ <td><a accesskey="n" href="licence.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> </tr> <tr><td colspan="5" class="shortcuts"> -<a class="shortcut" href="#glsA">A</a> +<a class="shortcut" href="#glsO">O</a> | - <a class="shortcut" href="#glsO">O</a> + <a class="shortcut" href="#glsA">A</a> + | + <a class="shortcut" href="#glsT">T</a> | <a class="shortcut" href="#glsE">E</a> | - <a class="shortcut" href="#glsT">T</a> + <a class="shortcut" href="#glsA">A</a> </td></tr> </table> <div class="glossary"> <div class="titlepage"><div><div><h1 class="title"> <a name="annotation-glossary"></a>Annotation Glossary</h1></div></div></div> -<a name="glsA"></a><h3 class="title">A</h3> -<dt><span class="glossterm"><a name="annotation-glossterm-allow-none"></a>allow-none</span></dt> -<dd class="glossdef"><p>NULL is ok, both for passing and for returning.</p></dd> -<dt><span class="glossterm"><a name="annotation-glossterm-array"></a>array</span></dt> -<dd class="glossdef"><p>Parameter points to an array of items.</p></dd> <a name="glsO"></a><h3 class="title">O</h3> <dt><span class="glossterm"><a name="annotation-glossterm-out"></a>out</span></dt> <dd class="glossdef"><p>Parameter for returning results. Default is <acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>.</p></dd> -<a name="glsE"></a><h3 class="title">E</h3> -<dt><span class="glossterm"><a name="annotation-glossterm-element-type"></a>element-type</span></dt> -<dd class="glossdef"><p>Generics and defining elements of containers and arrays.</p></dd> +<a name="glsA"></a><h3 class="title">A</h3> +<dt><span class="glossterm"><a name="annotation-glossterm-array"></a>array</span></dt> +<dd class="glossdef"><p>Parameter points to an array of items.</p></dd> <a name="glsT"></a><h3 class="title">T</h3> <dt><span class="glossterm"><a name="annotation-glossterm-transfer%20full"></a>transfer full</span></dt> <dd class="glossdef"><p>Free data after the code is done.</p></dd> +<a name="glsE"></a><h3 class="title">E</h3> +<dt><span class="glossterm"><a name="annotation-glossterm-element-type"></a>element-type</span></dt> +<dd class="glossdef"><p>Generics and defining elements of containers and arrays.</p></dd> +<a name="glsA"></a><h3 class="title">A</h3> +<dt><span class="glossterm"><a name="annotation-glossterm-allow-none"></a>allow-none</span></dt> +<dd class="glossdef"><p>NULL is ok, both for passing and for returning.</p></dd> </div> <div class="footer"> <hr> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/doc/html/index.html new/librsvg-2.40.8/doc/html/index.html --- old/librsvg-2.40.7/doc/html/index.html 2015-02-13 22:59:53.000000000 +0100 +++ new/librsvg-2.40.8/doc/html/index.html 2015-02-27 17:37:39.000000000 +0100 @@ -15,7 +15,7 @@ <div> <div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">RSVG Libary Reference Manual</p></th></tr></table></div> <div><p class="releaseinfo"> - For RSVG version 2.40.7 + For RSVG version 2.40.8 . The latest version of this documentation can be found on-line at the <a class="ulink" href="http://library.gnome.org/devel/rsvg/index.html" target="_top">GNOME Library</a>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/doc/html/index.sgml new/librsvg-2.40.8/doc/html/index.sgml --- old/librsvg-2.40.7/doc/html/index.sgml 2015-02-13 22:59:53.000000000 +0100 +++ new/librsvg-2.40.8/doc/html/index.sgml 2015-02-27 17:37:39.000000000 +0100 @@ -96,8 +96,8 @@ <ANCHOR id="LIBRSVG-HAVE-SVGZ:CAPS" href="rsvg/rsvg-Version-check-and-feature-tests.html#LIBRSVG-HAVE-SVGZ:CAPS"> <ANCHOR id="LIBRSVG-HAVE-CSS:CAPS" href="rsvg/rsvg-Version-check-and-feature-tests.html#LIBRSVG-HAVE-CSS:CAPS"> <ANCHOR id="LIBRSVG-CHECK-FEATURE:CAPS" href="rsvg/rsvg-Version-check-and-feature-tests.html#LIBRSVG-CHECK-FEATURE:CAPS"> -<ANCHOR id="annotation-glossterm-allow-none" href="rsvg/annotation-glossary.html#annotation-glossterm-allow-none"> -<ANCHOR id="annotation-glossterm-array" href="rsvg/annotation-glossary.html#annotation-glossterm-array"> <ANCHOR id="annotation-glossterm-out" href="rsvg/annotation-glossary.html#annotation-glossterm-out"> -<ANCHOR id="annotation-glossterm-element-type" href="rsvg/annotation-glossary.html#annotation-glossterm-element-type"> +<ANCHOR id="annotation-glossterm-array" href="rsvg/annotation-glossary.html#annotation-glossterm-array"> <ANCHOR id="annotation-glossterm-transfer full" href="rsvg/annotation-glossary.html#annotation-glossterm-transfer full"> +<ANCHOR id="annotation-glossterm-element-type" href="rsvg/annotation-glossary.html#annotation-glossterm-element-type"> +<ANCHOR id="annotation-glossterm-allow-none" href="rsvg/annotation-glossary.html#annotation-glossterm-allow-none"> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/doc/version.xml new/librsvg-2.40.8/doc/version.xml --- old/librsvg-2.40.7/doc/version.xml 2015-02-13 21:53:51.000000000 +0100 +++ new/librsvg-2.40.8/doc/version.xml 2015-02-27 17:36:59.000000000 +0100 @@ -1 +1 @@ -2.40.7 +2.40.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/librsvg-features.h new/librsvg-2.40.8/librsvg-features.h --- old/librsvg-2.40.7/librsvg-features.h 2015-02-13 21:53:51.000000000 +0100 +++ new/librsvg-2.40.8/librsvg-features.h 2015-02-27 17:36:59.000000000 +0100 @@ -7,8 +7,8 @@ #define LIBRSVG_MAJOR_VERSION (2) #define LIBRSVG_MINOR_VERSION (40) -#define LIBRSVG_MICRO_VERSION (7) -#define LIBRSVG_VERSION "2.40.7" +#define LIBRSVG_MICRO_VERSION (8) +#define LIBRSVG_VERSION "2.40.8" #define LIBRSVG_CHECK_VERSION(major,minor,micro) \ (LIBRSVG_MAJOR_VERSION > (major) || \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/rsvg-path.c new/librsvg-2.40.8/rsvg-path.c --- old/librsvg-2.40.7/rsvg-path.c 2015-02-12 17:50:14.000000000 +0100 +++ new/librsvg-2.40.8/rsvg-path.c 2015-02-26 22:38:38.000000000 +0100 @@ -177,7 +177,7 @@ } static void -rsvg_path_arc_segment (RSVGParsePathCtx * ctx, +rsvg_path_arc_segment (RsvgPathBuilder *builder, double xc, double yc, double th0, double th1, double rx, double ry, double x_axis_rotation) @@ -200,39 +200,43 @@ x2 = x3 + rx*(t * sin (th1)); y2 = y3 + ry*(-t * cos (th1)); - rsvg_path_builder_curve_to (&ctx->builder, - xc + cosf*x1 - sinf*y1, - yc + sinf*x1 + cosf*y1, - xc + cosf*x2 - sinf*y2, - yc + sinf*x2 + cosf*y2, - xc + cosf*x3 - sinf*y3, - yc + sinf*x3 + cosf*y3); + rsvg_path_builder_curve_to (builder, + xc + cosf*x1 - sinf*y1, + yc + sinf*x1 + cosf*y1, + xc + cosf*x2 - sinf*y2, + yc + sinf*x2 + cosf*y2, + xc + cosf*x3 - sinf*y3, + yc + sinf*x3 + cosf*y3); } /** - * rsvg_path_arc: - * @ctx: Path context. + * rsvg_path_builder_arc: + * @builder: Path builder. + * @x1: Starting x coordinate + * @y1: Starting y coordinate * @rx: Radius in x direction (before rotation). * @ry: Radius in y direction (before rotation). * @x_axis_rotation: Rotation angle for axes. * @large_arc_flag: 0 for arc length <= 180, 1 for arc >= 180. - * @sweep: 0 for "negative angle", 1 for "positive angle". - * @x: New x coordinate. - * @y: New y coordinate. + * @sweep_flag: 0 for "negative angle", 1 for "positive angle". + * @x2: Ending x coordinate + * @y2: Ending y coordinate * * Add an RSVG arc to the path context. **/ -static void -rsvg_path_arc (RSVGParsePathCtx * ctx, - double rx, double ry, double x_axis_rotation, - int large_arc_flag, int sweep_flag, double x, double y) +void +rsvg_path_builder_arc (RsvgPathBuilder *builder, + double x1, double y1, + double rx, double ry, + double x_axis_rotation, + gboolean large_arc_flag, gboolean sweep_flag, + double x2, double y2) { /* See Appendix F.6 Elliptical arc implementation notes http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes */ double f, sinf, cosf; - double x1, y1, x2, y2; double x1_, y1_; double cx_, cy_, cx, cy; double gamma; @@ -241,103 +245,95 @@ int i, n_segs; - /* Start and end of path segment */ - x1 = ctx->cp.point.x; - y1 = ctx->cp.point.y; - - x2 = x; - y2 = y; - - if(x1 == x2 && y1 == y2) + if (x1 == x2 && y1 == y2) return; /* X-axis */ f = x_axis_rotation * M_PI / 180.0; - sinf = sin(f); - cosf = cos(f); + sinf = sin (f); + cosf = cos (f); + + rx = fabs (rx); + ry = fabs (ry); /* Check the radius against floading point underflow. See http://bugs.debian.org/508443 */ - if ((fabs(rx) < DBL_EPSILON) || (fabs(ry) < DBL_EPSILON)) { - rsvg_path_builder_line_to (&ctx->builder, x, y); + if ((rx < DBL_EPSILON) || (ry < DBL_EPSILON)) { + rsvg_path_builder_line_to (builder, x2, y2); return; } - if(rx < 0)rx = -rx; - if(ry < 0)ry = -ry; - - k1 = (x1 - x2)/2; - k2 = (y1 - y2)/2; + k1 = (x1 - x2) / 2; + k2 = (y1 - y2) / 2; x1_ = cosf * k1 + sinf * k2; y1_ = -sinf * k1 + cosf * k2; - gamma = (x1_*x1_)/(rx*rx) + (y1_*y1_)/(ry*ry); + gamma = (x1_ * x1_) / (rx * rx) + (y1_ * y1_) / (ry * ry); if (gamma > 1) { - rx *= sqrt(gamma); - ry *= sqrt(gamma); + rx *= sqrt (gamma); + ry *= sqrt (gamma); } /* Compute the center */ - k1 = rx*rx*y1_*y1_ + ry*ry*x1_*x1_; - if(k1 == 0) + k1 = rx * rx * y1_ * y1_ + ry * ry * x1_ * x1_; + if (k1 == 0) return; - k1 = sqrt(fabs((rx*rx*ry*ry)/k1 - 1)); - if(sweep_flag == large_arc_flag) + k1 = sqrt (fabs ((rx * rx * ry * ry) / k1 - 1)); + if (sweep_flag == large_arc_flag) k1 = -k1; - cx_ = k1*rx*y1_/ry; - cy_ = -k1*ry*x1_/rx; + cx_ = k1 * rx * y1_ / ry; + cy_ = -k1 * ry * x1_ / rx; - cx = cosf*cx_ - sinf*cy_ + (x1+x2)/2; - cy = sinf*cx_ + cosf*cy_ + (y1+y2)/2; + cx = cosf * cx_ - sinf * cy_ + (x1 + x2) / 2; + cy = sinf * cx_ + cosf * cy_ + (y1 + y2) / 2; /* Compute start angle */ - k1 = (x1_ - cx_)/rx; - k2 = (y1_ - cy_)/ry; - k3 = (-x1_ - cx_)/rx; - k4 = (-y1_ - cy_)/ry; - - k5 = sqrt(fabs(k1*k1 + k2*k2)); - if(k5 == 0)return; - - k5 = k1/k5; - if(k5 < -1)k5 = -1; - else if(k5 > 1)k5 = 1; - theta1 = acos(k5); - if(k2 < 0)theta1 = -theta1; + k1 = (x1_ - cx_) / rx; + k2 = (y1_ - cy_) / ry; + k3 = (-x1_ - cx_) / rx; + k4 = (-y1_ - cy_) / ry; + + k5 = sqrt (fabs (k1 * k1 + k2 * k2)); + if (k5 == 0) + return; + + k5 = k1 / k5; + k5 = CLAMP (k5, -1, 1); + theta1 = acos (k5); + if (k2 < 0) + theta1 = -theta1; /* Compute delta_theta */ - k5 = sqrt(fabs((k1*k1 + k2*k2)*(k3*k3 + k4*k4))); - if(k5 == 0)return; + k5 = sqrt (fabs ((k1 * k1 + k2 * k2) * (k3 * k3 + k4 * k4))); + if (k5 == 0) + return; - k5 = (k1*k3 + k2*k4)/k5; - if(k5 < -1)k5 = -1; - else if(k5 > 1)k5 = 1; - delta_theta = acos(k5); - if(k1*k4 - k3*k2 < 0)delta_theta = -delta_theta; - - if(sweep_flag && delta_theta < 0) - delta_theta += M_PI*2; - else if(!sweep_flag && delta_theta > 0) - delta_theta -= M_PI*2; + k5 = (k1 * k3 + k2 * k4) / k5; + k5 = CLAMP (k5, -1, 1); + delta_theta = acos (k5); + if (k1 * k4 - k3 * k2 < 0) + delta_theta = -delta_theta; + + if (sweep_flag && delta_theta < 0) + delta_theta += M_PI * 2; + else if (!sweep_flag && delta_theta > 0) + delta_theta -= M_PI * 2; /* Now draw the arc */ n_segs = ceil (fabs (delta_theta / (M_PI * 0.5 + 0.001))); for (i = 0; i < n_segs; i++) - rsvg_path_arc_segment (ctx, cx, cy, + rsvg_path_arc_segment (builder, cx, cy, theta1 + i * delta_theta / n_segs, theta1 + (i + 1) * delta_theta / n_segs, rx, ry, x_axis_rotation); - - ctx->cp.point.x = x; - ctx->cp.point.y = y; } @@ -513,9 +509,38 @@ break; case 'a': if (ctx->param == 7 || final) { - rsvg_path_arc (ctx, - ctx->params[0], ctx->params[1], ctx->params[2], - ctx->params[3], ctx->params[4], ctx->params[5], ctx->params[6]); + double x1, y1; + double rx, ry; + double x_axis_rotation; + gboolean large_arc_flag; + gboolean sweep_flag; + double x2, y2; + + x1 = ctx->cp.point.x; + y1 = ctx->cp.point.y; + + rx = ctx->params[0]; + ry = ctx->params[1]; + + x_axis_rotation = ctx->params[2]; + + large_arc_flag = (ctx->params[3] == 0 ? FALSE : TRUE); + sweep_flag = (ctx->params[4] == 0 ? FALSE : TRUE); + + x2 = ctx->params[5]; + y2 = ctx->params[6]; + + rsvg_path_builder_arc (&ctx->builder, + x1, y1, + rx, ry, + x_axis_rotation, + large_arc_flag, + sweep_flag, + x2, y2); + + ctx->cp.point.x = x2; + ctx->cp.point.y = y2; + ctx->param = 0; } break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/rsvg-path.h new/librsvg-2.40.8/rsvg-path.h --- old/librsvg-2.40.7/rsvg-path.h 2013-12-03 21:19:50.000000000 +0100 +++ new/librsvg-2.40.8/rsvg-path.h 2015-02-26 22:38:38.000000000 +0100 @@ -56,6 +56,15 @@ double y2, double x3, double y3); + +G_GNUC_INTERNAL +void rsvg_path_builder_arc (RsvgPathBuilder *builder, + double x1, double y1, + double rx, double ry, + double x_axis_rotation, + gboolean large_arc_flag, gboolean sweep_flag, + double x2, double y2); + G_GNUC_INTERNAL void rsvg_path_builder_close_path (RsvgPathBuilder *builder); G_GNUC_INTERNAL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/rsvg-shapes.c new/librsvg-2.40.8/rsvg-shapes.c --- old/librsvg-2.40.7/rsvg-shapes.c 2015-02-06 19:46:11.000000000 +0100 +++ new/librsvg-2.40.8/rsvg-shapes.c 2015-02-20 23:22:33.000000000 +0100 @@ -146,9 +146,8 @@ { double *pointlist; guint pointlist_len, i; - GString *d; + RsvgPathBuilder builder; cairo_path_t *path; - char buf[G_ASCII_DTOSTR_BUF_SIZE]; pointlist = rsvg_css_parse_number_list (value, &pointlist_len); if (pointlist == NULL) @@ -159,40 +158,39 @@ return NULL; } - d = g_string_new (NULL); + /* Calculate the number of cairo_path_data_t we'll need: + * + * pointlist_len / 2 -> number of commands + * pointlist_len / 2 -> number of points + * + 1 -> closepath + * --------------------------------------------- + * pointlist_len + 1 -> total + */ + rsvg_path_builder_init (&builder, pointlist_len + 1); - /* "M %f %f " */ - g_string_append (d, " M "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), pointlist[0])); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), pointlist[1])); + rsvg_path_builder_move_to (&builder, pointlist[0], pointlist[1]); - /* "L %f %f " */ for (i = 2; i < pointlist_len; i += 2) { - double p; + double x, y; - g_string_append (d, " L "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), pointlist[i])); - g_string_append_c (d, ' '); + x = pointlist[i]; /* We expect points to come in coordinate pairs. But if there is a * missing part of one pair in a corrupt SVG, we'll have an incomplete * list. In that case, we reuse the last-known Y coordinate. */ if (i + 1 < pointlist_len) - p = pointlist[i + 1]; + y = pointlist[i + 1]; else - p = pointlist[i - 1]; + y = pointlist[i - 1]; - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), p)); + rsvg_path_builder_line_to (&builder, x, y); } if (close_path) - g_string_append (d, " Z"); + rsvg_path_builder_close_path (&builder); - path = rsvg_parse_path (d->str); - - g_string_free (d, TRUE); + path = rsvg_path_builder_finish (&builder); g_free (pointlist); return path; @@ -283,34 +281,27 @@ static void _rsvg_node_line_draw (RsvgNode * overself, RsvgDrawingCtx * ctx, int dominate) { - GString *d; cairo_path_t *path; - char buf[G_ASCII_DTOSTR_BUF_SIZE]; + RsvgPathBuilder builder; RsvgNodeLine *self = (RsvgNodeLine *) overself; + double x1, y1, x2, y2; + + rsvg_path_builder_init (&builder, 4); + + x1 = _rsvg_css_normalize_length (&self->x1, ctx, 'h'); + y1 = _rsvg_css_normalize_length (&self->y1, ctx, 'v'); + x2 = _rsvg_css_normalize_length (&self->x2, ctx, 'h'); + y2 = _rsvg_css_normalize_length (&self->y2, ctx, 'v'); - /* emulate a line using a path */ - /* ("M %f %f L %f %f", x1, y1, x2, y2) */ - d = g_string_new ("M "); - - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), - _rsvg_css_normalize_length (&self->x1, ctx, 'h'))); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), - _rsvg_css_normalize_length (&self->y1, ctx, 'v'))); - g_string_append (d, " L "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), - _rsvg_css_normalize_length (&self->x2, ctx, 'h'))); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), - _rsvg_css_normalize_length (&self->y2, ctx, 'v'))); + rsvg_path_builder_move_to (&builder, x1, y1); + rsvg_path_builder_line_to (&builder, x2, y2); + + path = rsvg_path_builder_finish (&builder); rsvg_state_reinherit_top (ctx, overself->state, dominate); - path = rsvg_parse_path (d->str); rsvg_render_path (ctx, path); rsvg_cairo_path_destroy (path); - - g_string_free (d, TRUE); } RsvgNode * @@ -339,6 +330,7 @@ const char *klazz = NULL, *id = NULL, *value; RsvgNodeRect *rect = (RsvgNodeRect *) self; + /* FIXME: negative w/h/rx/ry is an error, per http://www.w3.org/TR/SVG11/shapes.html#RectElement */ if (rsvg_property_bag_size (atts)) { if ((value = rsvg_property_bag_lookup (atts, "x"))) rect->x = _rsvg_css_parse_length (value); @@ -371,126 +363,142 @@ _rsvg_node_rect_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate) { double x, y, w, h, rx, ry; - GString *d = NULL; + double half_w, half_h; + RsvgPathBuilder builder; cairo_path_t *path; RsvgNodeRect *rect = (RsvgNodeRect *) self; - char buf[G_ASCII_DTOSTR_BUF_SIZE]; x = _rsvg_css_normalize_length (&rect->x, ctx, 'h'); y = _rsvg_css_normalize_length (&rect->y, ctx, 'v'); - w = _rsvg_css_normalize_length (&rect->w, ctx, 'h'); - h = _rsvg_css_normalize_length (&rect->h, ctx, 'v'); - rx = _rsvg_css_normalize_length (&rect->rx, ctx, 'h'); - ry = _rsvg_css_normalize_length (&rect->ry, ctx, 'v'); + + /* FIXME: negative w/h/rx/ry is an error, per http://www.w3.org/TR/SVG11/shapes.html#RectElement + * For now we'll just take the absolute value. + */ + w = fabs (_rsvg_css_normalize_length (&rect->w, ctx, 'h')); + h = fabs (_rsvg_css_normalize_length (&rect->h, ctx, 'v')); + rx = fabs (_rsvg_css_normalize_length (&rect->rx, ctx, 'h')); + ry = fabs (_rsvg_css_normalize_length (&rect->ry, ctx, 'v')); if (w == 0. || h == 0.) - return; + return; if (rect->got_rx) rx = rx; else rx = ry; + if (rect->got_ry) ry = ry; else ry = rx; - if (rx > fabs (w / 2.)) - rx = fabs (w / 2.); - if (ry > fabs (h / 2.)) - ry = fabs (h / 2.); + half_w = w / 2; + half_h = h / 2; + + if (rx > half_w) + rx = half_w; + + if (ry > half_h) + ry = half_h; if (rx == 0) ry = 0; else if (ry == 0) rx = 0; - /* emulate a rect using a path */ - d = g_string_new ("M "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), x + rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), y)); - - g_string_append (d, " H "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), x + w - rx)); - - g_string_append (d, " A"); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 0.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 0.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 1.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), x + w)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), y + ry)); - - g_string_append (d, " V "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), y + h - ry)); - - g_string_append (d, " A"); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 0.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 0.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 1.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), x + w - rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), y + h)); - - g_string_append (d, " H "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), x + rx)); - - g_string_append (d, " A"); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 0.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 0.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 1.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), x)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), y + h - ry)); - - g_string_append (d, " V "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), y + ry)); - - g_string_append (d, " A"); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 0.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 0.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), 1.)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), x + rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), y)); + if (rx == 0) { + /* Easy case, no rounded corners */ - g_string_append (d, " Z"); + rsvg_path_builder_init (&builder, 11); - rsvg_state_reinherit_top (ctx, self->state, dominate); + rsvg_path_builder_move_to (&builder, x, y); + rsvg_path_builder_line_to (&builder, x + w, y); + rsvg_path_builder_line_to (&builder, x + w, y + h); + rsvg_path_builder_line_to (&builder, x, y + h); + rsvg_path_builder_line_to (&builder, x, y); + rsvg_path_builder_close_path (&builder); + } else { + double top_x1, top_x2, top_y; + double bottom_x1, bottom_x2, bottom_y; + double left_x, left_y1, left_y2; + double right_x, right_y1, right_y2; + + /* Hard case, rounded corners + * + * (top_x1, top_y) (top_x2, top_y) + * *--------------------------------* + * / \ + * * (left_x, left_y1) * (right_x, right_y1) + * | | + * | | + * | | + * | | + * | | + * | | + * | | + * | | + * | | + * * (left_x, left_y2) * (right_x, right_y2) + * \ / + * *--------------------------------* + * (bottom_x1, bottom_y) (bottom_x2, bottom_y) + */ + + top_x1 = x + rx; + top_x2 = x + w - rx; + top_y = y; + + bottom_x1 = top_x1; + bottom_x2 = top_x2; + bottom_y = y + h; + + left_x = x; + left_y1 = y + ry; + left_y2 = y + h - ry; + + right_x = x + w; + right_y1 = left_y1; + right_y2 = left_y2; + + rsvg_path_builder_init (&builder, 32); /* an estimate; the arc segments may grow the array anyway */ + + rsvg_path_builder_move_to (&builder, top_x1, top_y); + rsvg_path_builder_line_to (&builder, top_x2, top_y); + + rsvg_path_builder_arc (&builder, + top_x2, top_y, + rx, ry, 0, FALSE, TRUE, + right_x, right_y1); + + rsvg_path_builder_line_to (&builder, right_x, right_y2); + + rsvg_path_builder_arc (&builder, + right_x, right_y2, + rx, ry, 0, FALSE, TRUE, + bottom_x2, bottom_y); + + rsvg_path_builder_line_to (&builder, bottom_x1, bottom_y); + + rsvg_path_builder_arc (&builder, + bottom_x1, bottom_y, + rx, ry, 0, FALSE, TRUE, + left_x, left_y2); - path = rsvg_parse_path (d->str); + rsvg_path_builder_line_to (&builder, left_x, left_y1); + + rsvg_path_builder_arc (&builder, + left_x, left_y1, + rx, ry, 0, FALSE, TRUE, + top_x1, top_y); + + rsvg_path_builder_close_path (&builder); + } + + path = rsvg_path_builder_finish (&builder); + + rsvg_state_reinherit_top (ctx, self->state, dominate); rsvg_render_path (ctx, path); rsvg_cairo_path_destroy (path); - g_string_free (d, TRUE); } RsvgNode * @@ -540,11 +548,10 @@ static void _rsvg_node_circle_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate) { - GString *d = NULL; cairo_path_t *path; RsvgNodeCircle *circle = (RsvgNodeCircle *) self; - char buf[G_ASCII_DTOSTR_BUF_SIZE]; double cx, cy, r; + RsvgPathBuilder builder; cx = _rsvg_css_normalize_length (&circle->cx, ctx, 'h'); cy = _rsvg_css_normalize_length (&circle->cy, ctx, 'v'); @@ -555,72 +562,37 @@ /* approximate a circle using 4 bezier curves */ - d = g_string_new ("M "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + r)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy)); - - g_string_append (d, " C "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + r)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy + r * RSVG_ARC_MAGIC)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + r * RSVG_ARC_MAGIC)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy + r)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy + r)); - - g_string_append (d, " C "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx - r * RSVG_ARC_MAGIC)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy + r)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx - r)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy + r * RSVG_ARC_MAGIC)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx - r)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy)); - - g_string_append (d, " C "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx - r)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy - r * RSVG_ARC_MAGIC)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx - r * RSVG_ARC_MAGIC)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy - r)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy - r)); - - g_string_append (d, " C "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + r * RSVG_ARC_MAGIC)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy - r)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + r)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy - r * RSVG_ARC_MAGIC)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + r)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy)); + rsvg_path_builder_init (&builder, 19); - g_string_append (d, " Z"); + rsvg_path_builder_move_to (&builder, cx + r, cy); - rsvg_state_reinherit_top (ctx, self->state, dominate); + rsvg_path_builder_curve_to (&builder, + cx + r, cy + r * RSVG_ARC_MAGIC, + cx + r * RSVG_ARC_MAGIC, cy + r, + cx, cy + r); + + rsvg_path_builder_curve_to (&builder, + cx - r * RSVG_ARC_MAGIC, cy + r, + cx - r, cy + r * RSVG_ARC_MAGIC, + cx - r, cy); + + rsvg_path_builder_curve_to (&builder, + cx - r, cy - r * RSVG_ARC_MAGIC, + cx - r * RSVG_ARC_MAGIC, cy - r, + cx, cy - r); + + rsvg_path_builder_curve_to (&builder, + cx + r * RSVG_ARC_MAGIC, cy - r, + cx + r, cy - r * RSVG_ARC_MAGIC, + cx + r, cy); + + rsvg_path_builder_close_path (&builder); + + path = rsvg_path_builder_finish (&builder); - path = rsvg_parse_path (d->str); + rsvg_state_reinherit_top (ctx, self->state, dominate); rsvg_render_path (ctx, path); rsvg_cairo_path_destroy (path); - - g_string_free (d, TRUE); } RsvgNode * @@ -672,10 +644,9 @@ _rsvg_node_ellipse_draw (RsvgNode * self, RsvgDrawingCtx * ctx, int dominate) { RsvgNodeEllipse *ellipse = (RsvgNodeEllipse *) self; - GString *d = NULL; cairo_path_t *path; - char buf[G_ASCII_DTOSTR_BUF_SIZE]; double cx, cy, rx, ry; + RsvgPathBuilder builder; cx = _rsvg_css_normalize_length (&ellipse->cx, ctx, 'h'); cy = _rsvg_css_normalize_length (&ellipse->cy, ctx, 'v'); @@ -684,74 +655,40 @@ if (rx <= 0 || ry <= 0) return; + /* approximate an ellipse using 4 bezier curves */ - d = g_string_new ("M "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy)); - - g_string_append (d, " C "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy - RSVG_ARC_MAGIC * ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + RSVG_ARC_MAGIC * rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy - ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy - ry)); - - g_string_append (d, " C "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx - RSVG_ARC_MAGIC * rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy - ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx - rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy - RSVG_ARC_MAGIC * ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx - rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy)); - - g_string_append (d, " C "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx - rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy + RSVG_ARC_MAGIC * ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx - RSVG_ARC_MAGIC * rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy + ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy + ry)); - - g_string_append (d, " C "); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + RSVG_ARC_MAGIC * rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy + ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy + RSVG_ARC_MAGIC * ry)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cx + rx)); - g_string_append_c (d, ' '); - g_string_append (d, g_ascii_dtostr (buf, sizeof (buf), cy)); + rsvg_path_builder_init (&builder, 19); - g_string_append (d, " Z"); + rsvg_path_builder_move_to (&builder, cx + rx, cy); - rsvg_state_reinherit_top (ctx, self->state, dominate); + rsvg_path_builder_curve_to (&builder, + cx + rx, cy - RSVG_ARC_MAGIC * ry, + cx + RSVG_ARC_MAGIC * rx, cy - ry, + cx, cy - ry); + + rsvg_path_builder_curve_to (&builder, + cx - RSVG_ARC_MAGIC * rx, cy - ry, + cx - rx, cy - RSVG_ARC_MAGIC * ry, + cx - rx, cy); + + rsvg_path_builder_curve_to (&builder, + cx - rx, cy + RSVG_ARC_MAGIC * ry, + cx - RSVG_ARC_MAGIC * rx, cy + ry, + cx, cy + ry); - path = rsvg_parse_path (d->str); + rsvg_path_builder_curve_to (&builder, + cx + RSVG_ARC_MAGIC * rx, cy + ry, + cx + rx, cy + RSVG_ARC_MAGIC * ry, + cx + rx, cy); + + rsvg_path_builder_close_path (&builder); + + path = rsvg_path_builder_finish (&builder); + + rsvg_state_reinherit_top (ctx, self->state, dominate); rsvg_render_path (ctx, path); rsvg_cairo_path_destroy (path); - - g_string_free (d, TRUE); } RsvgNode * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/rsvg-styles.c new/librsvg-2.40.8/rsvg-styles.c --- old/librsvg-2.40.7/rsvg-styles.c 2015-02-12 21:03:33.000000000 +0100 +++ new/librsvg-2.40.8/rsvg-styles.c 2015-02-20 01:18:08.000000000 +0100 @@ -311,7 +311,7 @@ if (function (dst->has_text_anchor, src->has_text_anchor)) dst->text_anchor = src->text_anchor; if (function (dst->has_letter_spacing, src->has_letter_spacing)) - dst->letter_spacing = src->letter_spacing; + dst->letter_spacing = src->letter_spacing; if (function (dst->has_startMarker, src->has_startMarker)) dst->startMarker = src->startMarker; if (function (dst->has_middleMarker, src->has_middleMarker)) @@ -329,10 +329,10 @@ } if (function (dst->has_space_preserve, src->has_space_preserve)) - dst->space_preserve = src->space_preserve; + dst->space_preserve = src->space_preserve; if (function (dst->has_visible, src->has_visible)) - dst->visible = src->visible; + dst->visible = src->visible; if (function (dst->has_lang, src->has_lang)) { if (dst->has_lang) @@ -807,6 +807,7 @@ if (state->dash.n_dash != 0) { /* free any cloned dash data */ g_free (state->dash.dash); + state->dash.dash = NULL; state->dash.n_dash = 0; } } else { @@ -840,6 +841,7 @@ be ignored */ if (total == 0) { g_free (state->dash.dash); + state->dash.dash = NULL; state->dash.n_dash = 0; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librsvg-2.40.7/tests/rsvg-test.c new/librsvg-2.40.8/tests/rsvg-test.c --- old/librsvg-2.40.7/tests/rsvg-test.c 2013-12-03 21:19:50.000000000 +0100 +++ new/librsvg-2.40.8/tests/rsvg-test.c 2015-02-20 19:59:10.000000000 +0100 @@ -40,7 +40,6 @@ #endif #include "rsvg.h" -#include "rsvg-cairo.h" #include "rsvg-private.h" #include "rsvg-size-callback.h" -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
