summaryrefslogtreecommitdiffstats
path: root/src/trace/trace.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2013-09-19 00:57:10 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2013-09-19 00:57:10 +0000
commit083367b313247a4cf0c082fff25e993892dc38d1 (patch)
tree35e5da339ef5d30a333270d644ac1d61e6ed6620 /src/trace/trace.cpp
parentMerge in patch for Jabiertxo Arraiza Cenoz in bug lp:1127103 (diff)
downloadinkscape-083367b313247a4cf0c082fff25e993892dc38d1.tar.gz
inkscape-083367b313247a4cf0c082fff25e993892dc38d1.zip
Encapsulate the shared memory hack for Cairo and GdkPixbuf in a class
called Inkscape::Pixbuf. Replace usage in the code as appropriate. (bzr r12531)
Diffstat (limited to '')
-rw-r--r--src/trace/trace.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp
index cad8ea9be..e2cda6247 100644
--- a/src/trace/trace.cpp
+++ b/src/trace/trace.cpp
@@ -31,6 +31,7 @@
#include <2geom/transforms.h>
#include "verbs.h"
+#include "display/cairo-utils.h"
#include "display/drawing.h"
#include "display/drawing-shape.h"
@@ -336,8 +337,17 @@ Glib::RefPtr<Gdk::Pixbuf> Tracer::getSelectedImage()
if (!img->pixbuf)
return Glib::RefPtr<Gdk::Pixbuf>(NULL);
- Glib::RefPtr<Gdk::Pixbuf> pixbuf =
- Glib::wrap(img->pixbuf, true);
+ GdkPixbuf *raw_pb = img->pixbuf->getPixbufRaw(false);
+ GdkPixbuf *trace_pb = gdk_pixbuf_copy(raw_pb);
+ if (img->pixbuf->pixelFormat() == Inkscape::Pixbuf::PF_CAIRO) {
+ convert_pixels_argb32_to_pixbuf(
+ gdk_pixbuf_get_pixels(trace_pb),
+ gdk_pixbuf_get_width(trace_pb),
+ gdk_pixbuf_get_height(trace_pb),
+ gdk_pixbuf_get_rowstride(trace_pb));
+ }
+
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::wrap(trace_pb, false);
if (sioxEnabled)
{
@@ -410,7 +420,16 @@ void Tracer::traceThread()
return;
}
- Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::wrap(img->pixbuf, true);
+ GdkPixbuf *trace_pb = gdk_pixbuf_copy(img->pixbuf->getPixbufRaw(false));
+ if (img->pixbuf->pixelFormat() == Inkscape::Pixbuf::PF_CAIRO) {
+ convert_pixels_argb32_to_pixbuf(
+ gdk_pixbuf_get_pixels(trace_pb),
+ gdk_pixbuf_get_width(trace_pb),
+ gdk_pixbuf_get_height(trace_pb),
+ gdk_pixbuf_get_rowstride(trace_pb));
+ }
+
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf = Glib::wrap(trace_pb, false);
pixbuf = sioxProcessImage(img, pixbuf);