From b392a16cc5fc3e0c43846ce55cb3dffd0a807d61 Mon Sep 17 00:00:00 2001 From: ishmal Date: Fri, 11 May 2007 23:12:52 +0000 Subject: [PATCH] Applied gorodish's patch 1714710 for bug 1709383. Passes the test. --- src/sp-image.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 961661fc6..d710c109e 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -697,8 +697,8 @@ sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags) if (image->href) { GdkPixbuf *pixbuf; pixbuf = sp_image_repr_read_image ( - object->repr->attribute("xlink:href"), - object->repr->attribute("sodipodi:absref"), + object->repr->attribute("xlink:href"), + object->repr->attribute("sodipodi:absref"), doc->base); if (pixbuf) { pixbuf = sp_image_pixbuf_force_rgba (pixbuf); @@ -740,7 +740,7 @@ sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags) intent = INTENT_PERCEPTUAL; } cmsHPROFILE destProf = cmsCreate_sRGBProfile(); - cmsHTRANSFORM transf = cmsCreateTransform( prof, + cmsHTRANSFORM transf = cmsCreateTransform( prof, TYPE_RGBA_8, destProf, TYPE_RGBA_8, @@ -1062,7 +1062,7 @@ sp_image_repr_read_image (const gchar *href, const gchar *absref, const gchar *b if (!docbase) docbase = "."; fullname = g_build_filename(docbase, filename, NULL); - // document base can be wrong (on the temporary doc when importing bitmap from a + // document base can be wrong (on the temporary doc when importing bitmap from a // different dir) or unset (when doc is not saved yet), so we check for base+href existence first, // and if it fails, we also try to use bare href regardless of its g_path_is_absolute if (g_file_test (fullname, G_FILE_TEST_EXISTS) && !g_file_test (fullname, G_FILE_TEST_IS_DIR)) { @@ -1070,7 +1070,7 @@ sp_image_repr_read_image (const gchar *href, const gchar *absref, const gchar *b g_free (fullname); if (pixbuf != NULL) return pixbuf; } - } + } /* try filename as absolute */ if (g_file_test (filename, G_FILE_TEST_EXISTS) && !g_file_test (filename, G_FILE_TEST_IS_DIR)) { @@ -1084,7 +1084,11 @@ sp_image_repr_read_image (const gchar *href, const gchar *absref, const gchar *b filename = absref; if (filename != NULL) { // using absref is outside of SVG rules, so we must at least warn the user - g_warning (" did not resolve to a valid image file (base dir is %s), now trying sodipodi:absref=\"%s\"", href, base, absref); + if ( base != NULL && href != NULL ) + g_warning (" did not resolve to a valid image file (base dir is %s), now trying sodipodi:absref=\"%s\"", href, base, absref); + else + g_warning ("xlink:href did not resolve to a valid image file, now trying sodipodi:absref=\"%s\"", absref); + pixbuf = Inkscape::IO::pixbuf_new_from_file( filename, NULL ); if (pixbuf != NULL) return pixbuf; } -- 2.30.2