diff options
author | Dom Lachowicz <doml@src.gnome.org> | 2004-07-10 14:30:01 +0000 |
---|---|---|
committer | Dom Lachowicz <doml@src.gnome.org> | 2004-07-10 14:30:01 +0000 |
commit | 777f2ef8549dbf4bf1b6482dab3c1491e1376797 (patch) | |
tree | 649f3cfcd2096e8e427e6b54ace9e0b620cdf450 | |
parent | 70d4592d2c9699ac2387a36491b4bae6cbec7a11 (diff) | |
download | librsvg-777f2ef8549dbf4bf1b6482dab3c1491e1376797.tar.gz |
fix bug #145477
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | rsvg-file-util.c | 3 | ||||
-rw-r--r-- | rsvg-shapes.c | 33 | ||||
-rw-r--r-- | test-display.c | 2 |
5 files changed, 43 insertions, 7 deletions
@@ -1,3 +1,9 @@ +2004-07-10 Dom Lachowicz <cinamod@hotmail.com> + + * rsvg-styles.c: Fix bug #145477 - RSVG can now handle relative + paths to image resources + * rsvg-file-util.c: Ditto + 2004-07-09 Dom Lachowicz <cinamod@hotmail.com> * rsvg-styles.c: Fix bug #145392, by @@ -1,11 +1,13 @@ Version 2.7.x - Filters +- GTK+ theme engine - Masks -- Tons of bug fixes +- Markers - Mozilla plugin +- Numerous bug fixes +- Patterns - Standalone viewer -- GTK+ theme engine == gnome-2-6 branch == diff --git a/rsvg-file-util.c b/rsvg-file-util.c index e7952207..2d3d895e 100644 --- a/rsvg-file-util.c +++ b/rsvg-file-util.c @@ -132,7 +132,8 @@ rsvg_pixbuf_from_file_with_size_data_ex (RsvgHandle * handle, g_strerror (errno)); return NULL; } - + + rsvg_handle_set_base_uri (handle, file_name); rsvg_handle_set_size_callback (handle, rsvg_size_callback, data, NULL); while (!feof(f) && !ferror(f) && ((result = fread (chars, 1, SVG_BUFFER_SIZE, f)) > 0)) diff --git a/rsvg-shapes.c b/rsvg-shapes.c index 3b2db699..0423e492 100644 --- a/rsvg-shapes.c +++ b/rsvg-shapes.c @@ -1421,8 +1421,31 @@ rsvg_pixbuf_new_from_data_at_size (const char *data, return rsvg_pixbuf_ensure_alpha_channel(pixbuf); } +static gchar * +rsvg_get_file_path (const gchar * filename, const gchar *basedir) +{ + gchar *absolute_filename; + + if (g_path_is_absolute(filename)) { + absolute_filename = g_strdup (filename); + } else { + gchar *tmpcdir; + + if (basedir) + tmpcdir = g_path_get_dirname (basedir); + else + tmpcdir = g_get_current_dir (); + + absolute_filename = g_build_filename (tmpcdir, filename, NULL); + g_free(tmpcdir); + } + + return absolute_filename; +} + static GdkPixbuf * rsvg_pixbuf_new_from_file_at_size (const char *filename, + const char *base_uri, int width, int height, gboolean keep_aspect_ratio, @@ -1430,7 +1453,8 @@ rsvg_pixbuf_new_from_file_at_size (const char *filename, { GdkPixbufLoader *loader; GdkPixbuf *pixbuf; - + gchar *path; + guchar buffer [4096]; int length; FILE *f; @@ -1443,7 +1467,10 @@ rsvg_pixbuf_new_from_file_at_size (const char *filename, g_return_val_if_fail (filename != NULL, NULL); g_return_val_if_fail (width > 0 && height > 0, NULL); - f = fopen (filename, "rb"); + path = rsvg_get_file_path (filename, base_uri); + f = fopen (path, "rb"); + g_free (path); + if (!f) { g_set_error (error, G_FILE_ERROR, @@ -1616,7 +1643,7 @@ rsvg_pixbuf_new_from_href (const char *href, img = rsvg_pixbuf_new_from_data_at_size (href, w, h, keep_aspect_ratio, err); if(!img) - img = rsvg_pixbuf_new_from_file_at_size (href, w, h, keep_aspect_ratio, err); + img = rsvg_pixbuf_new_from_file_at_size (href, base_uri, w, h, keep_aspect_ratio, err); #ifdef HAVE_GNOME_VFS if(!img) diff --git a/test-display.c b/test-display.c index c34c93cd..4384abbb 100644 --- a/test-display.c +++ b/test-display.c @@ -564,7 +564,7 @@ main (int argc, char **argv) in = stdin; else { in = fopen (args[0], "rb"); - /* base_uri = args[0]; */ + base_uri = (char *)args[0]; } if(!in) |