summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2013-09-14 01:59:43 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2013-09-14 01:59:43 +0000
commit35dc2e5a640375d51119f2051a240454b5f5b8c8 (patch)
tree2b35e5a1068a675c9c27cb13eaec598410a9b787 /src/display
parentFix serious bug in recent GdkPixbuf / Cairo interop rework (diff)
downloadinkscape-35dc2e5a640375d51119f2051a240454b5f5b8c8.tar.gz
inkscape-35dc2e5a640375d51119f2051a240454b5f5b8c8.zip
Do not recompress images when embedding and generating PDFs.
Fixes blocker bug #871563. Fixed bugs: - https://launchpad.net/bugs/871563 (bzr r12516)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/cairo-utils.cpp5
-rw-r--r--src/display/drawing-image.cpp4
-rw-r--r--src/display/nr-filter-image.cpp2
3 files changed, 9 insertions, 2 deletions
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp
index 2d94d024f..755553033 100644
--- a/src/display/cairo-utils.cpp
+++ b/src/display/cairo-utils.cpp
@@ -423,6 +423,11 @@ ink_cairo_set_source_pixbuf(cairo_t *ct, GdkPixbuf *pb, double x, double y)
* The returned surface is owned by the GdkPixbuf and should not be freed.
* Calling this function causes the pixbuf to be unsuitable for use
* with GTK drawing functions until ink_pixbuf_ensure_normal() is called.
+ *
+ * @bug You have to call g_object_set_data(G_OBJECT(pb), "cairo_surface", NULL)
+ * when unrefing the last reference to the pixbuf. Otherwise there will be
+ * crashes, because cairo_surface_destroy is called after the pixbuf data
+ * is already freed.
*/
cairo_surface_t *
ink_cairo_surface_get_for_pixbuf(GdkPixbuf *pb)
diff --git a/src/display/drawing-image.cpp b/src/display/drawing-image.cpp
index b94d48774..46f066b8e 100644
--- a/src/display/drawing-image.cpp
+++ b/src/display/drawing-image.cpp
@@ -46,7 +46,7 @@ DrawingImage::setARGB32Pixbuf(GdkPixbuf *pb)
}
if (_pixbuf != NULL) {
g_object_unref(_pixbuf);
- cairo_surface_destroy(_surface);
+ // unrefing the pixbuf also destroys surface
}
_pixbuf = pb;
_surface = pb ? ink_cairo_surface_get_for_pixbuf(pb) : NULL;
@@ -206,7 +206,7 @@ unsigned DrawingImage::_renderItem(DrawingContext &ct, Geom::IntRect const &/*ar
int orgstride = cairo_image_surface_get_stride(_surface);
int newstride = cairo_image_surface_get_stride(_new_surface);
- cairo_surface_flush(_surface);
+ //cairo_surface_flush(_surface);
cairo_surface_flush(_new_surface);
for(int y=0; y<newheight; y++) {
diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp
index 8b307ac00..b9d73f0ad 100644
--- a/src/display/nr-filter-image.cpp
+++ b/src/display/nr-filter-image.cpp
@@ -41,6 +41,7 @@ FilterImage::~FilterImage()
{
if (feImageHref)
g_free(feImageHref);
+ g_object_set_data(G_OBJECT(image->gobj()), "cairo_surface", NULL);
}
void FilterImage::render_cairo(FilterSlot &slot)
@@ -301,6 +302,7 @@ void FilterImage::set_href(const gchar *href){
if (feImageHref) g_free (feImageHref);
feImageHref = (href) ? g_strdup (href) : NULL;
+ g_object_set_data(G_OBJECT(image->gobj()), "cairo_surface", NULL);
image.reset();
broken_ref = false;
}