summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.cpp
diff options
context:
space:
mode:
authorPeter Moulder <peter.moulder@monash.edu>2009-04-07 06:13:27 +0000
committerpjrm <pjrm@users.sourceforge.net>2009-04-07 06:13:27 +0000
commit6b31af0edb1c4c6159d432291b461cd318fd0b28 (patch)
tree919a39489a3c71764ebcea083365d9d936f6d642 /src/selection-chemistry.cpp
parentnoop: rename a local var (diff)
downloadinkscape-6b31af0edb1c4c6159d432291b461cd318fd0b28.tar.gz
inkscape-6b31af0edb1c4c6159d432291b461cd318fd0b28.zip
(sp_selection_create_bitmap_copy): Fix: Set xlink:href relative to the correct directory.
(bzr r7647)
Diffstat (limited to 'src/selection-chemistry.cpp')
-rw-r--r--src/selection-chemistry.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index a57e5cfeb..8e9bf45da 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -27,6 +27,7 @@
#include "svg/svg.h"
#include "desktop.h"
#include "desktop-style.h"
+#include "dir-util.h"
#include "selection.h"
#include "tools-switch.h"
#include "desktop-handles.h"
@@ -52,6 +53,7 @@
#include <libnr/nr-matrix-ops.h>
#include <2geom/transforms.h>
#include "xml/repr.h"
+#include "xml/rebase-hrefs.h"
#include "style.h"
#include "document-private.h"
#include "sp-gradient.h"
@@ -2634,8 +2636,12 @@ sp_selection_create_bitmap_copy(SPDesktop *desktop)
if (pb) {
// Create the repr for the image
Inkscape::XML::Node * repr = xml_doc->createElement("svg:image");
- repr->setAttribute("xlink:href", basename);
- repr->setAttribute("sodipodi:absref", filepath);
+ {
+ repr->setAttribute("sodipodi:absref", filepath);
+ gchar *abs_base = Inkscape::XML::calc_abs_doc_base(document->base);
+ repr->setAttribute("xlink:href", sp_relative_path_from_path(filepath, abs_base));
+ g_free(abs_base);
+ }
if (res == PX_PER_IN) { // for default 90 dpi, snap it to pixel grid
sp_repr_set_svg_double(repr, "width", width);
sp_repr_set_svg_double(repr, "height", height);