diff options
author | Dom Lachowicz <doml@src.gnome.org> | 2003-02-01 23:38:01 +0000 |
---|---|---|
committer | Dom Lachowicz <doml@src.gnome.org> | 2003-02-01 23:38:01 +0000 |
commit | 915f7360b05aed41adf6d111aebb9d7a1a693b81 (patch) | |
tree | 1ae845dd3fbfbc11fed72ef4657fcfad174d8fd7 | |
parent | 9b759c0e5fdd7f7926a722b6f429ad6a1e97f45c (diff) | |
download | librsvg-915f7360b05aed41adf6d111aebb9d7a1a693b81.tar.gz |
fix divide by 0 bug, update doc
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | rsvg-gz.c | 4 | ||||
-rw-r--r-- | rsvg-paint-server.c | 9 | ||||
-rw-r--r-- | rsvg-shapes.c | 1 | ||||
-rw-r--r-- | rsvg-styles.c | 1 | ||||
-rw-r--r-- | rsvg.c | 27 | ||||
-rw-r--r-- | rsvg.h | 3 |
7 files changed, 42 insertions, 10 deletions
@@ -1,5 +1,12 @@ === librsvg 2.2.2 === +2003-02-0 Dom Lachowicz <cinamod@hotmail.com> + + * rsvg-paint-server.c: Fix evil devide by 0 bug that killed us on + some Krystal SVGs + * rsvg.c: update documentation - 95% complete (missing RsvgSizeFunc) + * rsvg-gz.c: Ditto + 2003-02-01 Dom Lachowicz <cinamod@hotmail.com> * rsvg.c (end_element): Fix regression @@ -85,9 +85,13 @@ rsvg_handle_gz_free_impl (RsvgHandle *handle) } /** + * rsvg_handle_new_gz + * * See rsvg_handle_new, except that this will handle GZipped SVGs (svgz) * Use the returned handle identically to how you use a handle returned * from rsvg_handle_new() + * + * Returns: a new SVGZ handle */ RsvgHandle * rsvg_handle_new_gz (void) diff --git a/rsvg-paint-server.c b/rsvg-paint-server.c index 8d747a0c..56f02b3c 100644 --- a/rsvg-paint-server.c +++ b/rsvg-paint-server.c @@ -31,6 +31,8 @@ #include <glib/gstrfuncs.h> #include <libart_lgpl/art_affine.h> #include <string.h> +#include <math.h> + #include "rsvg-css.h" typedef struct _RsvgPaintServerSolid RsvgPaintServerSolid; @@ -186,7 +188,12 @@ rsvg_paint_server_lin_grad_render (RsvgPaintServer *self, ArtRender *ar, gradient is in x1,y1 to x2,y2 dir */ dx = x2 - x1; dy = y2 - y1; - scale = 1.0 / (dx * dx + dy * dy); + + /* workaround for an evil devide by 0 bug - not sure if this is sufficient */ + if (fabs(dx + dy) <= 0.0000001) + scale = 0.; + else + scale = 1.0 / (dx * dx + dy * dy); agl->a = dx * scale; agl->b = dy * scale; agl->c = -(x1 * agl->a + y1 * agl->b); diff --git a/rsvg-shapes.c b/rsvg-shapes.c index 30eef3d5..9425c364 100644 --- a/rsvg-shapes.c +++ b/rsvg-shapes.c @@ -22,6 +22,7 @@ Author: Raph Levien <raph@artofcode.com> */ +#include <string.h> #include "rsvg-shapes.h" #include "rsvg-styles.h" diff --git a/rsvg-styles.c b/rsvg-styles.c index 70c5377d..ca87bc15 100644 --- a/rsvg-styles.c +++ b/rsvg-styles.c @@ -22,6 +22,7 @@ Author: Raph Levien <raph@artofcode.com> */ +#include <string.h> #include "rsvg.h" #include "rsvg-css.h" @@ -451,7 +451,8 @@ rsvg_start_linear_gradient (RsvgHandle *ctx, const xmlChar **atts) else if (!strcmp ((char *)atts[i], "gradientTransform")) got_transform = rsvg_parse_transform (affine, (const char *)atts[i + 1]); else if (!strcmp ((char *)atts[i], "gradientUnits")) { - obj_bbox = (strcmp ((char *)atts[i+1], "userSpaceOnUse") != 0); + if (!strcmp ((char *)atts[i+1], "userSpaceOnUse")) + obj_bbox = FALSE; got_bbox = TRUE; } } @@ -577,7 +578,8 @@ rsvg_start_radial_gradient (RsvgHandle *ctx, const xmlChar **atts, const char * } } else if (!strcmp ((char *)atts[i], "gradientUnits")) { - obj_bbox = (strcmp ((char *)atts[i+1], "userSpaceOnUse") != 0); + if (!strcmp ((char *)atts[i+1], "userSpaceOnUse")) + obj_bbox = FALSE; got_bbox = TRUE; } } @@ -735,7 +737,7 @@ rsvg_defs_handler_start (RsvgSaxHandler *self, const xmlChar *name, rsvg_state_init (ctx->state); ctx->n_state++; - /** + /* * conicalGradient isn't in the SVG spec and I'm not sure exactly what it does. libart definitely * has no analogue. But it does seem similar enough to a radialGradient that i'd rather get the * onscreen representation of the colour wrong than not have any colour displayed whatsoever @@ -959,6 +961,13 @@ static xmlSAXHandler rsvgSAXHandlerStruct = { NULL /* */ }; +/** + * rsvg_error_quark + * + * The error domain for RSVG + * + * Returns: The error domain + */ GQuark rsvg_error_quark (void) { @@ -1049,14 +1058,13 @@ rsvg_handle_free_impl (RsvgHandle *handle) /** * rsvg_handle_new: - * @void: * * Returns a new rsvg handle. Must be freed with @rsvg_handle_free. This * handle can be used for dynamically loading an image. You need to feed it * data using @rsvg_handle_write, then call @rsvg_handle_close when done. No * more than one image can be loaded with one handle. * - * Return value: A new #RsvgHandle + * Returns: A new #RsvgHandle **/ RsvgHandle * rsvg_handle_new (void) @@ -1168,7 +1176,7 @@ rsvg_handle_set_size_callback (RsvgHandle *handle, * the loader will be closed, and will not accept further writes. If FALSE is * returned, @error will be set to an error from the #RSVG_ERROR domain. * - * Return value: #TRUE if the write was successful, or #FALSE if there was an + * Returns: #TRUE if the write was successful, or #FALSE if there was an * error. **/ gboolean @@ -1185,13 +1193,14 @@ rsvg_handle_write (RsvgHandle *handle, /** * rsvg_handle_close: - * @handle: An #RsvgHandle + * @handle: A #RsvgHandle + * @error: A #GError * * Closes @handle, to indicate that loading the image is complete. This will * return #TRUE if the loader closed successfully. Note that @handle isn't * freed until @rsvg_handle_free is called. * - * Return value: #TRUE if the loader closed successfully, or #FALSE if there was + * Returns: #TRUE if the loader closed successfully, or #FALSE if there was * an error. **/ gboolean @@ -1214,7 +1223,7 @@ rsvg_handle_close (RsvgHandle *handle, * will be returned. Note that the pixbuf may not be complete until * @rsvg_handle_close has been called. * - * Return value: the pixbuf loaded by #handle, or %NULL. + * Returns: the pixbuf loaded by #handle, or %NULL. **/ GdkPixbuf * rsvg_handle_get_pixbuf (RsvgHandle *handle) @@ -38,6 +38,9 @@ GQuark rsvg_error_quark (void) G_GNUC_CONST; typedef struct RsvgHandle RsvgHandle; +/** + * Function to let a user of the library specify the SVG's dimensions + */ typedef void (* RsvgSizeFunc) (gint *width, gint *height, gpointer user_data); |